ria/app/Models/IpCreditNotesItemsModel.php

72 lines
1.6 KiB
PHP

<?php
namespace App\Models;
use CodeIgniter\Model;
class IpCreditNotesItemsModel extends Model
{
protected $table = 'ip_credit_notes_items';
protected $primaryKey = 'line_item_id';
protected $useAutoIncrement = false;
protected $allowedFields = [
'line_item_id',
'item_id',
'creditnote_id',
'sku',
'account_id',
'account_name',
'name',
'internal_name',
'description',
'item_order',
'invoice_id',
'invoice_item_id',
'quantity',
'pricing_scheme',
'unit',
'project_id',
'pricebook_id',
'discount_amount',
'discount',
'discount_account_id',
'discount_account_name',
'bcy_rate',
'rate',
'sales_margin',
'tax_id',
'tax_name',
'tax_type',
'tax_percentage',
'tds_tax_id',
'tds_tax_name',
'tds_tax_percentage',
'tds_tax_amount',
'reverse_charge_tax_id',
'gst_treatment_code',
'item_total',
'product_type',
'item_type',
'has_product_type_mismatch',
'has_invalid_hsn',
'hsn_or_sac',
'image_document_id',
'is_credit_only_item',
'created_at',
'updated_at',
];
protected $useTimestamps = true;
protected $createdField = 'created_at';
protected $updatedField = 'updated_at';
/**
* Get items by credit note ID
*/
public function getItemsByCreditNoteId($creditnoteId)
{
return $this->where('creditnote_id', $creditnoteId)->findAll();
}
}