update di penjualan invoice
This commit is contained in:
@@ -57,7 +57,34 @@ class Sales extends MY_Controller
|
||||
public function return_pdf($id){$data=$this->salesservice->returnDetail($id);$this->pdf('sales/return_pdf',$data,'Retur-'.$data['return']->return_no.'.pdf');}
|
||||
public function receipt_pdf($id)
|
||||
{
|
||||
$company=(int)$this->companycontext->id();$data['payment']=$this->db->select('p.*,c.nama customer_name,c.alamat')->from('payments p')->join('customers c','c.id=p.customer_id')->where(array('p.id'=>(int)$id,'p.company_id'=>$company))->get()->row();if(!$data['payment'])show_404();$data['allocations']=$this->db->select('a.*,i.no_invoice')->from('payment_allocations a')->join('invoices i','i.id=a.invoice_id')->where(array('a.payment_id'=>(int)$id,'i.company_id'=>$company))->get()->result();$data['sources']=$this->db->select('s.*,a.kode_akun,a.nama_akun')->from('payment_sources s')->join('accounts a','a.id=s.account_id')->where(array('s.payment_id'=>(int)$id,'s.company_id'=>$company))->get()->result();$this->pdf('sales/receipt_pdf',$data,'Bukti-Penerimaan-'.$data['payment']->payment_no.'.pdf');
|
||||
$company=(int)$this->companycontext->id();
|
||||
$data['payment']=$this->db
|
||||
->select('p.*,c.nama customer_name,c.alamat customer_address,c.telp customer_phone,c.email customer_email,u.nama creator_name')
|
||||
->from('payments p')
|
||||
->join('customers c','c.id=p.customer_id')
|
||||
->join('users u','u.id=p.created_by','left')
|
||||
->where(array('p.id'=>(int)$id,'p.company_id'=>$company))
|
||||
->get()
|
||||
->row();
|
||||
if(!$data['payment'])show_404();
|
||||
$data['allocations']=$this->db
|
||||
->select('a.*,i.no_invoice,i.tanggal invoice_date,i.jatuh_tempo')
|
||||
->from('payment_allocations a')
|
||||
->join('invoices i','i.id=a.invoice_id')
|
||||
->where(array('a.payment_id'=>(int)$id,'i.company_id'=>$company))
|
||||
->order_by('i.tanggal','ASC')
|
||||
->order_by('i.id','ASC')
|
||||
->get()
|
||||
->result();
|
||||
$data['sources']=$this->db
|
||||
->select('s.*,a.kode_akun,a.nama_akun')
|
||||
->from('payment_sources s')
|
||||
->join('accounts a','a.id=s.account_id')
|
||||
->where(array('s.payment_id'=>(int)$id,'s.company_id'=>$company))
|
||||
->order_by('s.id','ASC')
|
||||
->get()
|
||||
->result();
|
||||
$this->pdf('sales/receipt_pdf',$data,'Bukti-Penerimaan-'.$data['payment']->payment_no.'.pdf');
|
||||
}
|
||||
private function decodeRows(){$rows=json_decode((string)$this->input->post('rows'),true);if(!is_array($rows))throw new BusinessException('Detail barang tidak valid.');return$rows;}
|
||||
private function action($fn,$message){if(strtoupper($this->input->method())!=='POST')return json_response(false,'Metode tidak diizinkan.',array(),405);try{return json_response(true,$message,array('result'=>$fn()));}catch(Throwable$e){return business_exception_response($e);}}
|
||||
|
||||
Reference in New Issue
Block a user