From 67f838d52da4a8cc8ce73f4e1deacf6a46f811b7 Mon Sep 17 00:00:00 2001 From: venbatechnologies Date: Tue, 31 Jul 2018 12:58:42 +0530 Subject: [PATCH] bankstatement --- .vscode/settings.json | 3 + application/config/routes.php | 3 +- application/controllers/cashbook.php | 522 ++++-- .../controllers/emergencypurchaseorder.php | 2 +- .../controllers/inwardgateregister.php | 10 +- application/controllers/purchaseorder.php | 6 +- application/models/cashbook_model.php | 350 ++-- .../models/inwardgateregister_model.php | 29 +- application/views/Advancelist.php | 316 ++++ application/views/addnewIncomeExpense.php | 121 +- application/views/bankamountpaid.php | 114 +- application/views/bankamountreceived.php | 2 +- application/views/bankcashnew.php | 1484 +++++++++++------ application/views/bankdebit.php | 564 +++---- application/views/banksettlement.php | 133 +- application/views/editincomeexpenses.php | 169 +- application/views/income_expense_list.php | 2 + application/views/viewIGRDetails.php | 126 +- uploads/files/Payslip-E003-02-2017 | Bin 8803 -> 0 bytes uploads/files/Payslip-E003-02-2017.pdf | Bin 8803 -> 0 bytes 20 files changed, 2645 insertions(+), 1311 deletions(-) create mode 100644 .vscode/settings.json mode change 100755 => 100644 application/controllers/cashbook.php create mode 100644 application/views/Advancelist.php mode change 100755 => 100644 application/views/addnewIncomeExpense.php mode change 100755 => 100644 application/views/editincomeexpenses.php mode change 100755 => 100644 application/views/income_expense_list.php delete mode 100755 uploads/files/Payslip-E003-02-2017 delete mode 100755 uploads/files/Payslip-E003-02-2017.pdf diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..3b664107 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "git.ignoreLimitWarning": true +} \ No newline at end of file diff --git a/application/config/routes.php b/application/config/routes.php index 563f7598..af00fe81 100755 --- a/application/config/routes.php +++ b/application/config/routes.php @@ -249,6 +249,7 @@ $route['ServicePOBilling'] = "servicepurchaseorder/viewServicePOReportForBilling $route['ViewIncomeExpense'] = "cashbook/incomeExpenseList"; //$route['addNewIncomeExpense'] = "cashbook/addNewIncomeExpenseLoad"; $route['addIncomeExpense'] = "cashbook/addIncomeExpense"; +$route['AdvanceList']="cashbook/AdvanceList"; /**-----------Application Bank book Routes------------------**/ @@ -258,7 +259,7 @@ $route['Bankingstatement']= "cashbook/bankdata"; $route['Debitstatement']= "cashbook/bankdebitdata"; $route['Cashstatement']= "cashbook/cashreceipt"; $route['BankingFile']= "cashbook/bankfileupload"; -$route['Filelist']="cashbook/filelist"; +//$route['Filelist']="cashbook/filelist"; //$route['Bankingrecord']= "cashbook/bankdata"; $route['Bankamountpaid']= "cashbook/amountpaid"; $route['Bankamountreceived']= "cashbook/amountreceived"; diff --git a/application/controllers/cashbook.php b/application/controllers/cashbook.php old mode 100755 new mode 100644 index 511c29f0..a554341c --- a/application/controllers/cashbook.php +++ b/application/controllers/cashbook.php @@ -10,7 +10,7 @@ require APPPATH . '/third_party/mpdf/mpdf.php'; * @since : 27 November 2017 */ class cashbook extends BaseController -{ +{ /** * default constructor of the class */ @@ -189,6 +189,7 @@ class cashbook extends BaseController function addNewIncomeExpenseLoad() { $data['dropdownvalues'] = $this->cashbook_model->getAccounTypes(); + $data['getsupplier'] = $this->cashbook_model->getsupplier(); //$this->global['pageTitle'] = 'Resico : Cash Book: Add New Income Expense '; $this->global['pageTitle'] = $this->CompanyName.': Cash Book: Add New Income Expense '; $this->loadViews("addnewIncomeExpense", $this->global, $data , NULL); @@ -312,7 +313,7 @@ class cashbook extends BaseController $balance=$sheet->getCell('H'.$x)->getValue(); // $IsActive=0; - $filedataupload= array('reportdate'=>$Date1,'valuedate'=>$Date2,'chequeNo'=>$cod,'Narration'=>$narration,'Cod'=> $chqno,'Debit'=>$debit,'Credit'=>$credit,'Balance'=>$balance,'Bankname'=>$bank); + $filedataupload= array('reportdate'=>$Date1,'valuedate'=>$Date2,'chequeNo'=>$cod,'Narration'=>$narration,'Cod'=> $chqno,'Debit'=>$debit,'Credit'=>$credit,'cbalancetocleared'=>$credit,'Balance'=>$balance,'Bankname'=>$bank); @@ -339,54 +340,34 @@ class cashbook extends BaseController //function addIncomeExpense() function addReceipt() { - $bankdate = $this->input->post('bankdate'); + $bankid = $this->input->post('bakid'); $remaindebitamount=$this->input->post('remaindebitamount'); $remaincreditamount=$this->input->post('remaincreditamount'); - $amount = $this->input->post('bankamount'); - $amounttype = $this->input->post('type'); + //$amount = $this->input->post('bankamount');//need to ask + $bankamounttype = $this->input->post('type'); $totalbankamount = $this->input->post('totalbankamount'); $alreadypaid=$this->input->post('alreadydebitpaid'); $directamount = $this->input->post('totalamount'); - $debitamount=$this->input->post('debitamount'); + //$debitamount=$this->input->post('debitamount');// need to ask $alreadycreditpaid=$this->input->post('alreadycreditpaid'); $bankorcash=$this->input->post('borc'); $total=$directamount+$alreadypaid; $ctotal=$directamount+$alreadycreditpaid; $updateBalancetocleared= $remaindebitamount-$directamount; $updatecbalancetocleared= $remaincreditamount-$directamount; - if($amounttype==CREDIT) - { - echo "ad"; - $type=RECEIPT; - $bankamounttype=CREDIT; - } - else - { - echo "ad2"; - $type=PAYMENT; - $bankamounttype=DEBIT; - } + - - $accounttype = $this->input->post('myradio'); - //if($accounttype == 1) - //{ - $accounttype = 'RECEIPT'; - //} - //else - //{ - //$accounttype = 'PAYMENT'; - //} - $accountcode = $this->input->post('accode'); - $date = $this->input->post('Date'); - $date = date_create($date);//,'Y-m-d'); - $date = date_format($date,'Y-m-d'); - $towhome = $this->input->post('towhome'); - $supplier = $this->input->post('supplier'); + $accounttype = 'RECEIPT'; + $accountcode = $this->input->post('accode'); + $date = $this->input->post('Date'); + $date = date_create($date);//,'Y-m-d'); + $date = date_format($date,'Y-m-d'); + $towhome = $this->input->post('towhome'); + $supplier = $this->input->post('supplier'); - $gsttoggle = $this->input->post('gsttoggle'); - $invoiceno = null; + $gsttoggle = $this->input->post('gsttoggle'); + $invoiceno = null; $merchantname = null; $mergstno = null; $hsn = null; @@ -407,9 +388,9 @@ class cashbook extends BaseController $igst = $this->input->post('IGST'); } - //$totalamount = $this->input->post('totalamount'); - $cashbookamount=$this->input->post('totalamount1'); - $totalamount=$directamount+$cashbookamount; + $totalamount = $this->input->post('totalamount'); + // $cashbookamount=$this->input->post('totalamount1'); + // $totalamount=$directamount+$cashbookamount; $description = $this->input->post('description'); if(empty($description)){$description = 'NA';} @@ -427,13 +408,13 @@ class cashbook extends BaseController $document = $path.$fs; } - if($bankorcash==Bank) + if($bankorcash=='Bank') { - $option=Bank; + $option='Bank'; } else { - $option=Cash; + $option='Cash'; } $balance=$totalbankamount-$totalamount; $IsActive=1; @@ -459,44 +440,52 @@ class cashbook extends BaseController { $statu='OPEN'; } - $debitbalance=$totalbankamount-$total; - if($debitbalance==0) + // $debitbalance=$totalbankamount-$total; + // if($debitbalance==0) - { - $statu1='CLOSE'; - } - else - { - $statu1='OPEN'; - } - $isactive=1; - //$clearbalance=$totalbankamount- - if($amounttype=='CREDIT') - { - $cashbookstatus1= array('cclearbalance'=>$ctotal,'cbalancetocleared'=>$updatecbalancetocleared,'cstatus'=>$statu,'IsActive'=>$isactive); + // { + // $statu1='CLOSE'; + // } + // else + // { + // $statu1='OPEN'; + // } + // $isactive=1; + // //$clearbalance=$totalbankamount- + // if($amounttype=='CREDIT') + // { + $cashbookstatus1= array('cclearbalance'=>$ctotal,'cbalancetocleared'=>$updatecbalancetocleared,'cstatus'=>$statu); //print_r($cashbookstatus1); //die(); $res1 = $this->cashbook_model->cashcreditupdate($cashbookstatus1,$bankid); - } - else - { - $cashbookstatus = array('Clearbalance'=>$total,'Balancetocleared'=>$updateBalancetocleared,'Status'=>$statu1,'IsActive'=>$isactive); - $res23 = $this->cashbook_model->cashbankupdate($cashbookstatus,$bankid); + // } + // else + // { + // $cashbookstatus = array('Clearbalance'=>$total,'Balancetocleared'=>$updateBalancetocleared,'Status'=>$statu1); + // $res23 = $this->cashbook_model->cashbankupdate($cashbookstatus,$bankid); - } + // } + + $res = $this->cashbook_model->saveIncomeExpense($addincomexpense); - if( $res == 1 ){ - //echo ""; - echo ""; - - if($amounttype == ' ')//Redirct To Listing Screen + if( $res >= 1 ){ + + + if($bankorcash=='Bank')//Redirct To Bank Report Screen { - redirect('ViewIncomeExpense','refresh'); + + + echo ""; + } - else if($amounttype != ' ')//Redirct To Bank Report Screen + else { - redirect('Bankingstatement','refresh'); + + //Redirct To Listing Screen + echo ""; } } @@ -514,6 +503,34 @@ class cashbook extends BaseController */ function addPayment() { + + + $bankid = $this->input->post('hideBankID'); + $remaindebitamount=$this->input->post('hideRemainDebitAmount'); + //$remaincreditamount=$this->input->post('remaincreditamount'); + //$amount = $this->input->post('bankamount');//need to ask + $amounttype = $this->input->post('hideBAtype'); + $totalbankamount = $this->input->post('hideTotalBankAmount'); + $alreadypaid=$this->input->post('hideAlreadyDebitPaid'); + $directamount = $this->input->post('Paymenttotalamount'); + //$debitamount=$this->input->post('debitamount');// need to ask + //$alreadycreditpaid=$this->input->post('alreadycreditpaid'); + $bankorcash=$this->input->post('hideborc'); + $total=$directamount+$alreadypaid; + //$ctotal=$directamount+$alreadycreditpaid; + $updateBalancetocleared= $remaindebitamount-$directamount; + //$updatecbalancetocleared= $remaincreditamount-$directamount; + // if($amounttype==CREDIT) + // { + // $type=RECEIPT; + // $bankamounttype=CREDIT; + // } + // else + // { + $type=PAYMENT; + $bankamounttype=DEBIT; + // } + $count = $this->input->post('hidecounter'); $constantcount = $this->input->post('hideconstant'); @@ -522,36 +539,11 @@ class cashbook extends BaseController $date = date_create($date);//,'Y-m-d'); $date = date_format($date,'Y-m-d'); $paidto = $this->input->post('PaymentPaidto'); - $supplier = $this->input->post('supplier'); + $supplier = $this->input->post('Paymentsupplier'); $vouchercode = $this->input->post('Paymentvouchercode'); - $bankdate = $this->input->post('bankdate'); - $bankid = $this->input->post('bakid'); - $remaindebitamount=$this->input->post('remaindebitamount'); - $remaincreditamount=$this->input->post('remaincreditamount'); - $amount = $this->input->post('bankamount'); - $amounttype = $this->input->post('type'); - $totalbankamount = $this->input->post('totalbankamount'); - $alreadypaid=$this->input->post('alreadydebitpaid'); - $directamount = $this->input->post('totalamount'); - $debitamount=$this->input->post('debitamount'); - $alreadycreditpaid=$this->input->post('alreadycreditpaid'); - $bankorcash=$this->input->post('borc'); - $total=$directamount+$alreadypaid; - $ctotal=$directamount+$alreadycreditpaid; - $updateBalancetocleared= $remaindebitamount-$directamount; - $updatecbalancetocleared= $remaincreditamount-$directamount; - if($amounttype==CREDIT) - { - $type=RECEIPT; - $bankamounttype=CREDIT; - } - else - { - $type=PAYMENT; - $bankamounttype=DEBIT; - } + //echo $count.$consantcount; //$gsttoggle = $this->input->post('gsttoggle'); @@ -572,8 +564,8 @@ class cashbook extends BaseController $cgst = $this->input->post('PaymentCGST'); $igst = $this->input->post('PaymentIGST'); - $cashbookamount=$this->input->post('totalamount1'); - $totalamount=$directamount+$cashbookamount; + // $cashbookamount=$this->input->post('totalamount1'); + // $totalamount=$directamount+$cashbookamount; where its comes from //$totalamount = $this->input->post('Paymenttotalamount'); $description = $this->input->post('Paymentdescription'); @@ -615,8 +607,64 @@ class cashbook extends BaseController } }} - $addPayments = array('type'=>$accounttype,'account_code'=>$Paymentaccode,'date'=>$date,'towhom'=>$paidto,'invoice_no'=>$vouchercode,'merchant'=>$merchantname,'merchant_gst'=>$mergstno,'HSN'=>$hsn ,'value_before_gst'=>$beforegst,'sgst'=>$sgst,'cgst'=>$cgst,'igst'=>$igst,'total'=>$totalamount,'description'=>$description,'document'=>$document,'Created_By'=>$created_by,'paymentsubdesc'=>$subdescription); - $res = $this->cashbook_model->saveIncomeExpense($addPayments); + + if($bankorcash=='Bank') + { $option='Bank'; } + else { $option='Cash'; } + $balance=$totalbankamount-$totalamount; + $IsActive=1; + + $addPayments = array('type'=>$accounttype,'account_code'=>$Paymentaccode,'date'=>$date,'towhom'=>$paidto,'Supplier_id'=>$supplier,'invoice_no'=>$vouchercode,'merchant'=>$merchantname,'merchant_gst'=>$mergstno,'HSN'=>$hsn ,'value_before_gst'=>$beforegst,'sgst'=>$sgst,'cgst'=>$cgst,'igst'=>$igst,'total'=>$directamount,'description'=>$description,'document'=>$document,'Created_By'=>$created_by,'paymentsubdesc'=>$subdescription,'cashtype'=>$option,'bankid'=>$bankid,'totalbankamount'=>$totalbankamount,'balance'=>$balance,'gststatus'=>(!empty($gsttoggle)?'1':'0'),'amounttype'=>$amounttype,'IsActive'=>$IsActive); + $res = $this->cashbook_model->saveIncomeExpense($addPayments); + + if($balance=='0') + { + $stat='CLOSE'; + } + else + { + $stat='OPEN'; + } + // $creditbalance=$totalbankamount-$ctotal; + // //echo $creditbalance; + // //die(); + // if($creditbalance==0) + // { + // $statu='CLOSE'; + // } + // else + // { + // $statu='OPEN'; + // } + $debitbalance=$totalbankamount-$total; + if($debitbalance==0) + + { + $statu1='CLOSE'; + } + else + { + $statu1='OPEN'; + } + $isactive=1; + + // if($amounttype=='CREDIT') + // { +// $cashbookstatus1= array('cclearbalance'=>$ctotal,'cbalancetocleared'=>$updatecbalancetocleared,'cstatus'=>$statu); + //print_r($cashbookstatus1); + //die(); +// $res1 = $this->cashbook_model->cashcreditupdate($cashbookstatus1,$bankid); + // } + // else + // { + $cashbookstatus = array('Clearbalance'=>$total,'Balancetocleared'=>$updateBalancetocleared,'Status'=>$statu1); + $res23 = $this->cashbook_model->cashbankupdate($cashbookstatus,$bankid); + + // } + + + + } else @@ -624,8 +672,63 @@ class cashbook extends BaseController $accountcode = '999'; $subdescription = 'Multiple'; - $addPayments = array('type'=>$accounttype,'account_code'=>$accountcode,'date'=>$date,'towhom'=>$paidto,'invoice_no'=>$vouchercode,'merchant'=>$merchantname,'merchant_gst'=>$mergstno,'HSN'=>$hsn ,'value_before_gst'=>$beforegst,'sgst'=>$sgst,'cgst'=>$cgst,'igst'=>$igst,'total'=>$totalamount,'description'=>$description,'document'=>$document,'Created_By'=>$created_by,'paymentsubdesc'=>$subdescription); + + if($bankorcash=='Bank') + { $option='Bank'; } + else { $option='Cash'; } + $balance=$totalbankamount-$totalamount; + $IsActive=1; + + $addPayments = array('type'=>$accounttype,'account_code'=>$accountcode,'date'=>$date,'towhom'=>$paidto,'Supplier_id'=>$supplier,'invoice_no'=>$vouchercode,'merchant'=>$merchantname,'merchant_gst'=>$mergstno,'HSN'=>$hsn ,'value_before_gst'=>$beforegst,'sgst'=>$sgst,'cgst'=>$cgst,'igst'=>$igst,'total'=>$directamount,'description'=>$description,'document'=>$document,'Created_By'=>$created_by,'paymentsubdesc'=>$subdescription,'cashtype'=>$option,'bankid'=>$bankid,'totalbankamount'=>$totalbankamount,'balance'=>$balance,'gststatus'=>(!empty($gsttoggle)?'1':'0'),'amounttype'=>$amounttype,'IsActive'=>$IsActive); $res = $this->cashbook_model->saveIncomeExpense($addPayments); + + if($balance=='0') + { + $stat='CLOSE'; + } + else + { + $stat='OPEN'; + } + // $creditbalance=$totalbankamount-$ctotal; + // //echo $creditbalance; + // //die(); + // if($creditbalance==0) + // { + // $statu='CLOSE'; + // } + // else + // { + // $statu='OPEN'; + // } + $debitbalance=$totalbankamount-$total; + if($debitbalance==0) + + { + $statu1='CLOSE'; + } + else + { + $statu1='OPEN'; + } + $isactive=1; + + // if($amounttype=='CREDIT') + // { +// $cashbookstatus1= array('cclearbalance'=>$ctotal,'cbalancetocleared'=>$updatecbalancetocleared,'cstatus'=>$statu); + //print_r($cashbookstatus1); + //die(); +// $res1 = $this->cashbook_model->cashcreditupdate($cashbookstatus1,$bankid); + // } + // else + // { + $cashbookstatus = array('Clearbalance'=>$total,'Balancetocleared'=>$updateBalancetocleared,'Status'=>$statu1); + $res23 = $this->cashbook_model->cashbankupdate($cashbookstatus,$bankid); + + // } + + + $Paymentaccode = ''; $subdescription = ''; @@ -682,10 +785,30 @@ class cashbook extends BaseController } }//new else - if( $res >= 1 ){ - echo ""; + // if( $res >= 1 ){ + // echo ""; + // } + if( $res >= 1 ){ + + + if($bankorcash=='Bank')//Redirct To Bank Report Screen + { + + + echo ""; + + } + else + { + + //Redirct To Listing Screen + echo ""; + } } + } @@ -865,7 +988,7 @@ class cashbook extends BaseController $data['data'] = $this->cashbook_model->getAdvanceList($aid); //print_r($data['dropdownvalues']);die(); - $this->global['pageTitle'] = 'Siddharth : Cash Book: View Income Expense '; + $this->global['pageTitle'] = $this->CompanyName.' : Cash Book: View Income Expense '; $this->loadViews("viewIndIncomeExpense", $this->global, $data , NULL); } @@ -875,7 +998,7 @@ class cashbook extends BaseController // $this->global['pageTitle'] = 'Siddharth : Cash Book: Listing'; // $this->loadViews("income_expense_list", $this->global, $data , NULL); - $this->global['pageTitle'] = 'Siddharth : Cash Book: Listing'; + $this->global['pageTitle'] = $this->CompanyName.' : Cash Book: Advance List'; if ($this->input->post('btn_submit')) { @@ -938,8 +1061,10 @@ class cashbook extends BaseController $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $acc_createddt = $dt->format('Y-m-d H:i:s'); - //$cashbookdatas = array('type'=>$acc_type,'code'=>$acc_code,'name'=>$acc_name,'description'=>$acc_desc,'status'=>$acc_status,'created_on'=>$acc_createddt); - $cashbookdatas = array('type'=>$acc_type,'code'=>$acc_code,'name'=>$acc_name,'accountname'=>$acc_pname,'categories'=>$acc_categories,'description'=>$acc_desc,'status'=>$acc_status,'created_on'=>$acc_createddt); + $cashbookdatas = array('type'=>$acc_type,'code'=>$acc_code,'name'=>$acc_name,'description'=>$acc_desc,'status'=>$acc_status,'created_on'=>$acc_createddt); + /** accountname and category fields aree not available so that comment */ + //$cashbookdatas = array('type'=>$acc_type,'code'=>$acc_code,'name'=>$acc_name,'accountname'=>$acc_pname,'categories'=>$acc_categories,'description'=>$acc_desc,'status'=>$acc_status,'created_on'=>$acc_createddt); + $result = $this->cashbook_model->Cashbook($cashbookdatas); } } @@ -947,7 +1072,6 @@ class cashbook extends BaseController echo "Successfully Saved!"; } - /** * For edit cashbook screen */ @@ -1101,7 +1225,7 @@ class cashbook extends BaseController else { $updatedepit=$poamnt+$cashamnt; - $cashbookstatus = array('Clearbalance'=>$updatedepit,'Status'=>$status,'IsActive'=>$isactive); + $cashbookstatus = array('Clearbalance'=>$updatedepit,'Status'=>$status); // print_r($cashbookstatus); //die(); $res = $this->cashbook_model->cashbankupdate($cashbookstatus,$bankid); @@ -1110,8 +1234,12 @@ class cashbook extends BaseController //if( $res == 1 ){ - echo ""; - //} + // echo ""; + //} + + echo ""; } @@ -1128,7 +1256,7 @@ class cashbook extends BaseController $date = date_format($date,'Y-m-d'); $towhome1 = $this->input->post('PaymentPaidto'); - $supplier = $this->input->post('supplier'); + $supplier = $this->input->post('Paymentsupplier'); $Invoiceno1 = $this->input->post('Paymentvouchercode'); $merchant1 = $this->input->post('Paymentmerchant'); $Merchantgst1 = $this->input->post('PaymentMerchantgst'); @@ -1141,6 +1269,11 @@ class cashbook extends BaseController $description1 = $this->input->post('Paymentdescription'); $deleteflag = $this->input->post('deleteflag'); $oldfile = $this->input->post('oldfile'); + $amounttype = $this->input->post('amounttype'); + $bankid=$this->input->post('bankid'); + $normalid=$this->input->post('normalid'); + $bankamount=$this->input->post('bankamount'); + $gsttoggle = $this->input->post('gsttoggle'); $document =null; @@ -1186,9 +1319,53 @@ class cashbook extends BaseController }} - $UpdatePayment = array('type'=>$option,'account_code'=>$Paymentaccode,'date'=>$date,'towhom'=>$towhome1,'invoice_no'=>$Invoiceno1,'merchant'=>$merchant1,'merchant_gst'=>$Merchantgst1,'HSN'=>$hsn1,'value_before_gst'=>$valuebeforegST1,'sgst'=>$SGST1,'cgst'=>$CGST1,'igst'=>$IGST1,'total'=>$totalamount1,'description'=>$description1,'document'=>$document,'paymentsubdesc'=>$subdescription); + $UpdatePayment = array('type'=>$option,'account_code'=>$Paymentaccode,'date'=>$date,'towhom'=>$towhome1,'Supplier_id'=>$supplier,'invoice_no'=>$Invoiceno1,'merchant'=>$merchant1,'merchant_gst'=>$Merchantgst1,'HSN'=>$hsn1,'value_before_gst'=>$valuebeforegST1,'sgst'=>$SGST1,'cgst'=>$CGST1,'igst'=>$IGST1,'total'=>$totalamount1,'description'=>$description1,'document'=>$document,'paymentsubdesc'=>$subdescription,'gststatus'=>(!empty($gsttoggle)?'1':'0'),'description'=>$description1,'document'=>$document); $res = $this->cashbook_model->updatepaymentmaster($UpdatePayment,$id1); - + $cashbookamount=$this->cashbook_model->cashbookamount($bankid); + $invoiceamount=$this->cashbook_model->invoiceamonut($bankid); + $poamount=$this->cashbook_model->poamonut($bankid); + foreach($invoiceamount as $ia) + { + $invam=$ia->amountreceived; + } + foreach($poamount as $pa) + { + $poamnt=$pa->amountpaid; + } + foreach($cashbookamount as $ca) + { + $cashamnt=$ca->total; + } + if($bankamount==$cashamnt) + { + $status='CLOSE'; + } + else + { + $status='OPEN'; + } + //print_r($invoiceamount); + if($amounttype=='CREDIT') + { + $updatecredit=$invam+$cashamnt; + $isactive=0; + $cashbookstatus1= array('cclearbalance'=>$updatecredit,'cstatus'=>$status,'IsActive'=>$isactive); + //print_r($cashbookstatus1); + //die(); + + $res1 = $this->cashbook_model->cashcreditupdate($cashbookstatus1,$bankid); + } + + else + { + $updatedepit=$poamnt+$cashamnt; + $cashbookstatus = array('Clearbalance'=>$updatedepit,'Status'=>$status); + // print_r($cashbookstatus); + //die(); + $res = $this->cashbook_model->cashbankupdate($cashbookstatus,$bankid); + + } + } else @@ -1196,8 +1373,54 @@ class cashbook extends BaseController $accountcode = '999'; $subdescription0 = 'Multiple'; - $UpdatePayment = array('type'=>$option,'account_code'=>$accountcode,'date'=>$date,'towhom'=>$towhome1,'invoice_no'=>$Invoiceno1,'merchant'=>$merchant1,'merchant_gst'=>$Merchantgst1,'HSN'=>$hsn1,'value_before_gst'=>$valuebeforegST1,'sgst'=>$SGST1,'cgst'=>$CGST1,'igst'=>$IGST1,'total'=>$totalamount1,'description'=>$description1,'document'=>$document,'paymentsubdesc'=>$subdescription0); + $UpdatePayment = array('type'=>$option,'account_code'=>$accountcode,'date'=>$date,'towhom'=>$towhome1,'Supplier_id'=>$supplier,'invoice_no'=>$Invoiceno1,'merchant'=>$merchant1,'merchant_gst'=>$Merchantgst1,'HSN'=>$hsn1,'value_before_gst'=>$valuebeforegST1,'sgst'=>$SGST1,'cgst'=>$CGST1,'igst'=>$IGST1,'total'=>$totalamount1,'description'=>$description1,'document'=>$document,'paymentsubdesc'=>$subdescription0,'gststatus'=>(!empty($gsttoggle)?'1':'0'),'description'=>$description1,'document'=>$document); $res = $this->cashbook_model->updatepaymentmaster($UpdatePayment,$id1); + + $cashbookamount=$this->cashbook_model->cashbookamount($bankid); + $invoiceamount=$this->cashbook_model->invoiceamonut($bankid); + $poamount=$this->cashbook_model->poamonut($bankid); + foreach($invoiceamount as $ia) + { + $invam=$ia->amountreceived; + } + foreach($poamount as $pa) + { + $poamnt=$pa->amountpaid; + } + foreach($cashbookamount as $ca) + { + $cashamnt=$ca->total; + } + if($bankamount==$cashamnt) + { + $status='CLOSE'; + } + else + { + $status='OPEN'; + } + //print_r($invoiceamount); + if($amounttype=='CREDIT') + { + $updatecredit=$invam+$cashamnt; + $isactive=0; + $cashbookstatus1= array('cclearbalance'=>$updatecredit,'cstatus'=>$status,'IsActive'=>$isactive); + //print_r($cashbookstatus1); + //die(); + + $res1 = $this->cashbook_model->cashcreditupdate($cashbookstatus1,$bankid); + } + + else + { + $updatedepit=$poamnt+$cashamnt; + $cashbookstatus = array('Clearbalance'=>$updatedepit,'Status'=>$status); + // print_r($cashbookstatus); + //die(); + $res = $this->cashbook_model->cashbankupdate($cashbookstatus,$bankid); + + } + for($i=1;$i<=$constantcount;$i++){ @@ -1287,7 +1510,7 @@ class cashbook extends BaseController echo ""; - +; } public function bankdata() @@ -1311,6 +1534,8 @@ class cashbook extends BaseController $this->loadViews("bankstatement", $this->global, $data,NULL); } + + public function bankdebitdata() { @@ -1346,18 +1571,32 @@ class cashbook extends BaseController $this->loadViews("bankinvoice", $this->global,$data,NULL); } - public function filelist() - { - $pono= $this->input->post('pono'); - $data = $this->cashbook_model->debitimage($pono); - echo json_encode($data); - + function IGRFilelist() + { + $igrno= $this->input->post('igrno'); + $pono =$this->input->post('pono'); + $igrsingle = $this->cashbook_model->igrmastersingle($igrno,$pono); + $igrmultiple =$this->cashbook_model->igrmastermultiple($igrno,$pono); + $data = array_merge($igrsingle,$igrmultiple); + echo json_encode($data); + + + } + public function filelist() + + { + $igrno= $this->input->post('igrno'); + $pono =$this->input->post('pono'); + $data = $this->cashbook_model->debitimage($igrno,$pono); + + echo json_encode($data); + } public function mappingpo() { $this->global['pageTitle'] = $this->CompanyName.' : Bank Report - Debited Settlements'; - $SupplierName = $this->input->post('SupplierName'); + $SupplierName = $this->input->post('SupplierName'); $fdate = $this->input->post('from_date'); $tdate = $this->input->post('to_date'); $bankid= $_GET['d']; @@ -1427,7 +1666,7 @@ class cashbook extends BaseController // $this->global['pageTitle'] = 'Siddharth : mappingcredit'; - $this->global['pageTitle'] = 'Siddharth : Bank Report - Credited Details '; + $this->global['pageTitle'] = $this->CompanyName.' : Bank Report - Credited Details '; $SupplierName = $this->input->post('SupplierName'); $fdate = $this->input->post('from_date'); $tdate = $this->input->post('to_date'); @@ -1436,10 +1675,11 @@ class cashbook extends BaseController $this->loadViews("bankinvoisettle", $this->global,$data,NULL); } - - public function receipt() + + public function receipt() { $this->global['pageTitle'] = $this->CompanyName.' : Bank Report - Store Debited Details'; + $check = $this->input->post('check'); $rw = $this->input->post('rw'); $date = $this->input->post('podate'); @@ -1495,7 +1735,7 @@ class cashbook extends BaseController } $earlypaid = 0; //echo $earlypaid; - $earlypaid = $this->cashbook_model->getearlyamount($pono); + $earlypaid = $this->cashbook_model->getearlyamount($igrlineitem); if(empty($earlypaid)) { $ePay=0; @@ -1520,7 +1760,7 @@ class cashbook extends BaseController $podata = array('Podate'=>$date,'PONO'=>$pono,'IGRNO'=>$igrno,'Suppliername'=>$sname,'Totalpoamount'=>$tot,'Amountpaid'=>$amtpaid,'Balancetopay'=>$balancetopay,'mid'=>$bankid,'IGRLineItemNo'=>$igrlineitem); //die(); - $result3 = $this->cashbook_model->getpono($pono); + $result3 = $this->cashbook_model->getpono($igrlineitem); $resultn = $this->cashbook_model->mappingpo($podata1); if(count($result3)<=0) @@ -1532,7 +1772,7 @@ class cashbook extends BaseController else { //echo "update"; - $result3 = $this->cashbook_model->poupdate($podata,$pono); + $result3 = $this->cashbook_model->poupdate($podata,$igrlineitem); } if($rw == $rowcount) @@ -1558,7 +1798,7 @@ class cashbook extends BaseController public function invoiceamount1() { //$this->global['pageTitle'] = 'Siddharth : Cashbook Listing'; - $this->global['pageTitle'] = 'Siddharth : Bank Report - Store Credited Details'; + $this->global['pageTitle'] = $this->CompanyName.' : Bank Report - Store Credited Details'; $check = $this->input->post('check'); $rw = $this->input->post('rw'); @@ -1598,7 +1838,8 @@ class cashbook extends BaseController } else { - $clearedblnce=-$totalpaidamount-(-$arec); + //$clearedblnce=-$totalpaidamount-(-$arec); + $clearedblnce=$totalpaidamount+$arec; } $balancetoreceived =($bankcreditamount-$totalpaidamount); $check =1; @@ -1617,6 +1858,7 @@ class cashbook extends BaseController $active=1; $bankdata = array('cclearbalance'=>$clearedblnce,'cbalancetocleared'=>$balancetoreceived,'cstatus'=>$status); + if($check == 1) { $res = $this->cashbook_model->bankcreditupdate($bankdata,$bankid); @@ -1683,7 +1925,7 @@ class cashbook extends BaseController { //$this->global['pageTitle'] = 'Siddharth : amountpaid'; - $this->global['pageTitle'] = 'Siddharth : Bank Report - Amount Payment Details'; + $this->global['pageTitle'] = $this->CompanyName.' : Bank Report - Amount Payment Details'; if ($this->input->post('btn_submit')) { $SupplierName = $this->input->post('SupplierName'); @@ -1702,7 +1944,7 @@ class cashbook extends BaseController // $this->load->model('cashbook_model'); //$this->global['pageTitle'] = 'Siddharth : Cashbook Listing'; - $this->global['pageTitle'] = 'Siddharth : Bank Report - Received Amount Details'; + $this->global['pageTitle'] = $this->CompanyName.' : Bank Report - Received Amount Details'; if ($this->input->post('btn_submit')) { $Customer = $this->input->post('Customer'); @@ -1809,6 +2051,7 @@ class cashbook extends BaseController $result= $this->cashbook_model->IgrDetailsStatusUpdate($igrno,$BankStatus); $result1= $this->cashbook_model->deletemapping($Bankid,$updateamount,$updatebalancetoclear); + //for update mapping amount in t_bankmappingpo table// $balancetopay=$_GET['balancetopay']; $totalbalancetopay=$Amount + $balancetopay; @@ -1818,6 +2061,7 @@ class cashbook extends BaseController //for update mapping amount inT_Bankporeport table// $result3= $this->cashbook_model->updateBankporeportpo($igrno,$totalbalancetopay,$updatebankpoamount,$Bankid); + if(count($result2)>0) { redirect('Bankingstatement','refresh'); @@ -1827,7 +2071,7 @@ class cashbook extends BaseController public function deletemappingiv() { - $this->global['pageTitle'] = 'Siddharth : Bank Report - Delete Mapping Invoice'; + $this->global['pageTitle'] = $this->CompanyName.' : Bank Report - Delete Mapping Invoice'; $credit= $this->input->post('credit'); $invoiceno = $this->input->post('invoiceno'); $bankid = $this->input->post('bankid'); @@ -1840,11 +2084,13 @@ class cashbook extends BaseController $updatebalancetoclear=$amountreceived+$bankingbalclear; if($amountreceived<0) { - $updateclearbalance=$bankingclear+$amountreceived; + //$updateclearbalance=$bankingclear+$amountreceived; + $updateclearbalance=$bankingclear-($amountreceived);//450-(-250) } else { - $updateclearbalance=$bankingclear-$amountreceived; + $updateclearbalance=$bankingclear-$amountreceived;//450-650 + //$updateclearbalance=$bankingclear-$amountreceived; } //update Isactive field in T_Bankreport ////// diff --git a/application/controllers/emergencypurchaseorder.php b/application/controllers/emergencypurchaseorder.php index c6d89d2f..5d28b3da 100755 --- a/application/controllers/emergencypurchaseorder.php +++ b/application/controllers/emergencypurchaseorder.php @@ -1301,7 +1301,7 @@ $prefile =array(); { $RevenueTaxList = array('LineItemNo'=>$LineItemNo, 'DiscountType'=>$DiscountType,'DiscountValue'=>$DiscountValue,'AfterDiscount'=>$AfterDiscount,'PackagingType'=>$PackagingType,'PackagingValue'=>$PackagingValue,'PackagingCalulatedOn'=>$PackagingOption,'AfterPackagingValue'=>$AfterPackagingValue,'FreightType'=>$FreightType, 'FreightValue'=>$FreightValue,'AfterFreightValue'=>$AfterFreightValue,'ExciseDuty'=>$ExciseValue,'ExciseDutyCalulatedOn'=>$ExciseOption,'AfterExciseDuty'=>$AfterExciseValue,'Vat'=>$VatValue,'AfterVAT'=>$AfterVatValue,'VatCalulatedOn'=>$VatOption, 'CST'=>$CSTValue,'AfterCST'=>$AfterCSTValue,'CSTCalulatedOn'=>$CSTOption,'GST'=>$GSTValue,'AfterGST'=>$AfterGSTValue,'OtherTaxes'=>$OtherTaxValue,'AfterOtherTaxes'=>$AfterOtherTaxValue,'Insurance'=>$InsuranceValue,'TotalValue'=>$TotalOrderValue, 'CreatedBy'=>$updatedBy,'CreatedDate'=>$updateddt); - $RevenueList = $this->purchaseorder_model->addRevenueTax($RevenueTaxList); + $RevenueList = $this->purchaseorder_model->addRevenueTax($RevenueTaxList); } else diff --git a/application/controllers/inwardgateregister.php b/application/controllers/inwardgateregister.php index a8bbf5bb..d9ca0fbf 100755 --- a/application/controllers/inwardgateregister.php +++ b/application/controllers/inwardgateregister.php @@ -11,7 +11,7 @@ require APPPATH . '/libraries/BaseController.php'; */ class inwardgateregister extends BaseController { - /** + /** * default constructor of the class */ public function __construct() @@ -524,8 +524,12 @@ $prefile =array(); { $IGRNO= $this->input->post('id'); + //echo $IGRNO; + $data = $this->inwardgateregister_model->viewigr($IGRNO); - echo json_encode($data); + + // print_r($data); + echo json_encode($data); } @@ -537,6 +541,8 @@ $prefile =array(); $igrfile = $this->inwardgateregister_model->viewIGRFile($IGRNO); $billfile = $this->inwardgateregister_model->ViewIGRfile1($IGRNO); $data = array_merge($igrfile,$billfile); + +//print_r($data); echo json_encode($data); } diff --git a/application/controllers/purchaseorder.php b/application/controllers/purchaseorder.php index 04a6ff6e..c6abbc49 100755 --- a/application/controllers/purchaseorder.php +++ b/application/controllers/purchaseorder.php @@ -1381,13 +1381,13 @@ class purchaseorder extends BaseController //$PONO = $_GET['PO']; $PoStatus=''; $data['AmendmentPDF'] = $this->purchaseorder_model->amendpdf($PONO); - $data['CompanyDetails'] = $this->purchaseorder_model->getCompanyInformationforPDF(); - $data['GetPoFormat'] = $this->purchaseorder_model->GetPoFormat($PONO); + $data['CompanyDetails'] = $this->purchaseorder_model->getCompanyInformationforPDF(); + $data['GetPoFormat'] = $this->purchaseorder_model->GetPoFormat($PONO); $data['POItem'] = $this->purchaseorder_model->GetRevenuePurchaseOrderDetailsForPDF($PONO); $data['releasedetails'] = $this->purchaseorder_model->GetReleasedDetails($PONO); $data['CurrencySymbol']=$this->purchaseorder_model->GerCurrencyCodeName('INR'); $data['reveuetax']=$this->purchaseorder_model->getRevenueTaxinforforpdf($PONO); - $data['AmendmentPDF'] = $this->purchaseorder_model->amendpdf($PONO); + $data['AmendmentPDF'] = $this->purchaseorder_model->amendpdf($PONO); $Currencycode=''; $TotalOrderValue=$data['POItem'][0]->TotalOrderValue; diff --git a/application/models/cashbook_model.php b/application/models/cashbook_model.php index 736c81aa..0d1adb87 100755 --- a/application/models/cashbook_model.php +++ b/application/models/cashbook_model.php @@ -41,21 +41,7 @@ class cashbook_model extends CI_Model $r = $this->db->get(); return $r->result(); } -// function getIncomeExpenseList($i="",$type) -// { -// $sql="SELECT `t_accountcode`.`name`, `T_Employee_Details`.`FirstName`, -// `T_Employee_Details`.`LastName`, `t_income_expense`.* -// FROM (`t_income_expense`) -// JOIN `t_accountcode` ON `t_income_expense`.`account_code`=`t_accountcode`.`code` or `t_income_expense`.`account_code` = '999' -// JOIN `tbl_users` ON `t_income_expense`.`Created_By`=`tbl_users`.`userId` -// JOIN `T_Employee_Details` ON `tbl_users`.`EmpID`=`T_Employee_Details`.`EmpID` -// WHERE `t_income_expense`.`id` = ".$i." -// and t_income_expense.type = '".$type."' -// group by t_income_expense.id"; -// $query = $this->db->query($sql); -// $result = $query->result(); -// return $result; -// } + /** * To Get Recepit and Payment datas for list @@ -69,9 +55,9 @@ class cashbook_model extends CI_Model JOIN `t_accountcode` ON `t_income_expense`.`account_code`=`t_accountcode`.`code` or `t_income_expense`.`account_code` = '999' JOIN `tbl_users` ON `t_income_expense`.`Created_By`=`tbl_users`.`userId` JOIN `T_Employee_Details` ON `tbl_users`.`EmpID`=`T_Employee_Details`.`EmpID` - group by t_income_expense.id"; + group by t_income_expense.id"; $query = $this->db->query($sql); - return $query->result(); + return $query->result(); } function getIncomeExpense($firstyear,$secondyear,$frmdt,$todt) { @@ -82,6 +68,7 @@ class cashbook_model extends CI_Model $this->db->join('T_Employee_Details','tbl_users.EmpID=T_Employee_Details.EmpID','left'); $this->db->where('t_income_expense.IsActive',1); $this->db->where('t_income_expense.account_code !=','ADV001'); + $this->db->where('t_income_expense.account_code !=','0013'); if ($firstyear and $secondyear != '') { $finyear = "t_income_expense.date >= '".$firstyear."-04-01' and t_income_expense.date <= '".$secondyear."-03-31'"; @@ -108,8 +95,8 @@ class cashbook_model extends CI_Model $this->db->join('tbl_users','t_income_expense.Created_By=tbl_users.userId','left'); $this->db->join('T_Employee_Details','tbl_users.EmpID=T_Employee_Details.EmpID','left'); $this->db->where('t_income_expense.IsActive',1); - $this->db->where('t_income_expense.account_code','ADV001'); - //$this->db->where('t_income_expense.account_code','0013'); + $this->db->where('t_income_expense.account_code','ADV001'); + $this->db->or_where('t_income_expense.account_code','0013'); $this->db->order_by("date","desc"); if(!empty($i)) { @@ -129,33 +116,36 @@ class cashbook_model extends CI_Model $this->db->join('T_Employee_Details','tbl_users.EmpID=T_Employee_Details.EmpID','left'); $this->db->where('t_income_expense.IsActive',1); $this->db->where('t_income_expense.account_code','ADV001'); - if ($firstyear and $secondyear != ''){ - $finyear = "t_income_expense.date >= '".$firstyear."-04-01' and t_income_expense.date <= '".$secondyear."-03-31'"; - $this->db->where($finyear); + $this->db->or_where('t_income_expense.account_code','0013'); + if ($firstyear and $secondyear != '') + { + $finyear = "t_income_expense.date >= '".$firstyear."-04-01' and t_income_expense.date <= '".$secondyear."-03-31'"; + $this->db->where($finyear); } - if ($frmdt and $todt != ''){ - $fromdate= date("Y-m-d",strtotime($frmdt)); - $todate=date("Y-m-d",strtotime($todt)); - $date = "date(t_income_expense.date) >= '".$fromdate."' - and date(t_income_expense.date) <= '".$todate."'"; - $this->db->where($date); + if ($frmdt and $todt != '') + { + $fromdate= date("Y-m-d",strtotime($frmdt)); + $todate=date("Y-m-d",strtotime($todt)); + $date = "date(t_income_expense.date) >= '".$fromdate."' + and date(t_income_expense.date) <= '".$todate."'"; + $this->db->where($date); } $this->db->order_by("date","desc"); $r = $this->db->get(); return $r->result(); } - function finyear(){ + function finyear() + { - - $sql="SELECT - CASE WHEN MONTH(date)>=4 THEN - concat(YEAR(date), '-',YEAR(date)+1) - ELSE concat(YEAR(date)-1,'-', YEAR(date)) END AS financial_year - FROM t_income_expense - GROUP BY financial_year"; - $query = $this->db->query($sql); - return $query->result(); + $sql="SELECT + CASE WHEN MONTH(date)>=4 THEN + concat(YEAR(date), '-',YEAR(date)+1) + ELSE concat(YEAR(date)-1,'-', YEAR(date)) END AS financial_year + FROM t_income_expense + GROUP BY financial_year"; + $query = $this->db->query($sql); + return $query->result(); } @@ -208,16 +198,7 @@ class cashbook_model extends CI_Model return $r->result(); } - // function viewdepartment($sid='') - // { - // $sql="SELECT ie.*,ac.name,date_format(ie.date,'%d-%m-%Y')as date FROM t_income_expense ie - // JOIN t_accountcode ac on ac.code=ie.account_code - // WHERE ie.id = ?"; - // $query = $this->db->query($sql,array($sid)); - // //print_r($this->db->last_query()); - // //echo $sql; - // return $query->result(); - // } + function viewdepartment($sid='') { @@ -244,18 +225,6 @@ class cashbook_model extends CI_Model return $r; } - // function deletefile($cashid,$cashfile) - // { - - // $sql="UPDATE t_income_expense SET document = NULL - // WHERE id = ?"; - // $query = $this->db->query($sql,array($cashid)); - // unlink("uploads/cashbook/".$cashfile);//this deletes the file on particular folder too - // //print_r($this->db->last_query()); - // //echo $sql; - // $r = $this->db->affected_rows(); - // return $r; - // } function updatedepartment($updateaccount,$id1) @@ -345,42 +314,7 @@ class cashbook_model extends CI_Model } - //function addupdatepaymentdetails($PaymentDetails,$hidekey=''){ - - // $paymentid = $PaymentDetails['Payment_id']; - // //$key = $PaymentDetails['ID']; - - // $count=0; - // $this->db->select('count(*) as count'); - // $this->db->from('T_Paymentdetails'); - // $this->db->where('Payment_id',$paymentid); - // $this->db->where('ID',$hidekey); - - // $isExits = $this->db->get(); - // $res = $isExits->result_array(); - - - // if(!empty($res)) - // { - // $count = $res[0]['count']; - // } - - // if($count == 0 )//for insert - // { - // $i = $this->db->insert('T_Paymentdetails',$PaymentDetails); - // return $i; - // } - - // elseif($count == 1)//for update - // { - // $this->db->where('Payment_id', $paymentid); - // $this->db->where('ID', $hidekey); - // $u = $this->db->update('T_Paymentdetails',$PaymentDetails); - // return $u; - // } - - // } /** @@ -416,30 +350,32 @@ class cashbook_model extends CI_Model function getbalancedetails() { + $subquery="SELECT openingbalance,closingbalance FROM T_bankbalance WHERE balance_keyid in (SELECT MAX(balance_keyid) FROM T_bankbalance)"; $query = $this->db->query($subquery); return $query->result(); } - function cleareddebitbalance(){ + function cleareddebitbalance() + { $sql = "SELECT SUM(Balancetocleared) as debit FROM T_bankreport where Clearbalance >'0'"; $query = $this->db->query($sql); return $query->result(); + } + function clearedcreditbalance() + { - } - function clearedcreditbalance(){ + $sql = "SELECT SUM(cbalancetocleared) as credit FROM T_bankreport where cclearbalance >'0'"; - $sql = "SELECT SUM(cbalancetocleared) as credit FROM T_bankreport where cclearbalance >'0'"; - - $query = $this->db->query($sql); - return $query->result(); + $query = $this->db->query($sql); + return $query->result(); - } + } function bankfile($FileDetails) { @@ -458,53 +394,47 @@ class cashbook_model extends CI_Model $this->db->where('Balance',$filedataupload['Balance']); $query = $this->db->get(); - if ($query->num_rows() > 0){ - return true; - + if ($query->num_rows() > 0) + { + return true; + + } + else{ + $this->db->insert('T_bankreport', $filedataupload); + $r = $this->db->affected_rows(); + //print_r($this->db->last_query()); + return $r; + } } - else{ - $this->db->insert('T_bankreport', $filedataupload); - $r = $this->db->affected_rows(); - //print_r($this->db->last_query()); - return $r; - } -} -function balance($balance){ + function balance($balance) + { $this ->db->insert('T_bankbalance',$balance); -} + } + function report_finyear() + { + $sql="SELECT + CASE WHEN MONTH(reportdate)>=4 THEN + concat(YEAR(reportdate), '-',YEAR(reportdate)+1) + ELSE concat(YEAR(reportdate)-1,'-', YEAR(reportdate)) END AS financial_year + FROM T_bankreport + GROUP BY financial_year"; + $query = $this->db->query($sql); + return $query->result(); + } -function report_finyear(){ - - - $sql="SELECT -CASE WHEN MONTH(reportdate)>=4 THEN - concat(YEAR(reportdate), '-',YEAR(reportdate)+1) -ELSE concat(YEAR(reportdate)-1,'-', YEAR(reportdate)) END AS financial_year -FROM T_bankreport -GROUP BY financial_year"; - $query = $this->db->query($sql); - return $query->result(); - - - -} - -function bankstatement($fdate,$tdate,$fa,$aa){ - - - - $sql="SELECT *,date_format(reportdate,'%d-%m-%Y')as date,tie.total,date_format(valuedate,'%d-%m-%Y')as valuedate from T_bankreport as br left join t_income_expense as tie on tie.bankid=br.ID where br.reportdate !=0 "; - - - if ($fa and $aa != ''){ +function bankstatement($fdate,$tdate,$fa,$aa) +{ + $sql="SELECT *,date_format(reportdate,'%d-%m-%Y')as date,tie.total,date_format(valuedate,'%d-%m-%Y')as valuedate from T_bankreport as br left join t_income_expense as tie on tie.bankid=br.ID where br.reportdate !=0 "; + if ($fa and $aa != '') + { $sql.=" and (reportdate >= '".$fa."-04-01' and reportdate<= '".$aa."-03-31')"; - } + } if ($fdate and $tdate != '') { @@ -513,12 +443,12 @@ function bankstatement($fdate,$tdate,$fa,$aa){ $sql.= " and date(reportdate) >= '".$fdate."' and date(reportdate) <= '".$tdate."'"; - } + } - $sql.=" group by(br.ID) "; + $sql.=" group by(br.ID) "; $sql.=" ORDER BY br.ID+0 DESC "; @@ -531,11 +461,9 @@ function bankstatement($fdate,$tdate,$fa,$aa){ function debitbankstatemet($Supplierid,$fdate,$tdate) { $status='ST057'; - //echo $tdate; - //die(); - //$Supplierid; - $this->db->distinct(); - $this->db->select('igr.PONO,igrli.IGRItemNo,igr.IGRNO,supp.SupplierName,igrli.CreatedDate,BR.Balancetopay,BR.Amountpaid,pom.Status,igrli.QuantityAsPerInvoice ,poli.Rate,(igrli.QuantityAsPerInvoice * poli.Rate) as total'); + + $this->db->distinct(); + $this->db->select('igr.PONO,igrli.IGRItemNo,igr.IGRNO,supp.SupplierName,igrli.CreatedDate,BR.Balancetopay,BR.Amountpaid,pom.Status,igrli.QuantityAsPerInvoice ,poli.Rate,(igrli.QuantityAsPerInvoice * poli.Rate) as total'); $this->db->from ('T_IGR_Details igrli'); $this->db->join('T_IGR_Master igr','igrli.IGRNO = igr.IGRNO','left'); $this->db->join('T_PurchaseOrder_LineItem poli','igr.PONO= poli.PONO and igrli.MaterialCode=poli.MaterialCode'); @@ -588,7 +516,7 @@ function debitbankstatemet($Supplierid,$fdate,$tdate) } -function receiptdata() + function receiptdata() { $this->db->distinct(); @@ -599,7 +527,7 @@ function receiptdata() return $query->result(); } - function paymentdata() + function paymentdata() { $this->db->distinct(); @@ -612,49 +540,37 @@ function receiptdata() } -function debitpolist($bankid) - { - $this->db->select('bp.id,bp.mid,igrm.MaterialRcvdDate,bp.PONO,bp.Suppliername,bp.Totalpoamount,br.Debit, - bp.Balancetopay,bp.Amountpaid,bp.IGRNO,bp.IGRLineItemNo,igrm.file,bu.FilePath'); - $this->db->from ('T_Bankmappingpo bp'); - $this->db->join ('T_IGR_Master igrm','bp.IGRNO = igrm.IGRNO','left'); - $this->db->join ('T_PurchaseOrder_BillUpload bu','bu.PONO = bp.PONO','left'); - $this->db->join ('T_bankreport br','br.ID=bp.mid'); - $this->db->where('bp.IsActive',1); - $this->db->where('bp.mid',$bankid); - // $this->db->where('igrde.BankStatus !=','ST072'); - $this->db->group_by('bp.id'); - $query = $this->db->get(); - return $query->result(); - - } - //function for image - function debitimage($pono) + + function debitimage($igrno,$pono) { - $this->db->select('bp.PONO,bp.mid,bu.FilePath,bu.BillNo,bu.IGRNO'); - $this->db->from ('T_Bankmappingpo bp'); - $this->db->join ('T_PurchaseOrder_BillUpload bu','bp.PONO = bu.PONO','left'); - $this->db->where('bp.PONO',$pono); - $this->db->group_by('bu.BillNo'); - $query = $this->db->get(); - return $query->result(); + + $this->db->select('*'); + $this->db->from ('T_PurchaseOrder_BillUpload'); + $this->db->where('IGRNO != "" '); + $this->db->where('IGRNO',$igrno); + $this->db->or_where('PONO',$pono); + $query = $this->db->get(); + $result = $query->result(); + // print_r($result);die; + return $result; - } + } function debitpolistfilter($SupplierName,$fdate,$tdate) { $this->db->select('bm.id,bm.mid,igrm.MaterialRcvdDate,bm.PONO,bm.Suppliername,bm.Totalpoamount, - bm.Balancetopay,bm.Amountpaid,bm.IGRNO,igrm.file,bm.IGRLineItemNo,br.Clearbalance,br.Balancetocleared,bu.FilePath,bu.BillNo'); + bm.Balancetopay,bm.Amountpaid,bm.IGRNO,igrm.file,bm.IGRLineItemNo,br.Clearbalance,br.Balancetocleared,bu.FilePath,bu.BillNo,inward.FilePath as Fpath'); $this->db->from ('T_Bankmappingpo bm'); $this->db->join ('T_IGR_Master igrm','igrm.IGRNO = bm.IGRNO'); //$this->db->join ('T_IGR_Details igrde','igrde.IGRNO=igrm.IGRNO'); $this->db->join ('T_SupplierDetailsN sd','sd.SupplierName = bm.Suppliername'); $this->db->join ('T_bankreport br','br.ID=bm.mid'); - $this->db->join ('T_PurchaseOrder_BillUpload bu','bm.PONO=bu.PONO','left'); + $this->db->join('T_Inwardgateregister_fileupload inward','inward.IGRNO =igrm.IGRNO','left'); + $this->db->join ('T_PurchaseOrder_BillUpload bu','bm.PONO=bu.PONO','left'); if($fdate!='' && $tdate!='') { $this->db->where('bm.Podate BETWEEN "'. date('Y-m-d', strtotime($fdate)). '" and "'. date('Y-m-d', strtotime($tdate)).'"'); @@ -670,7 +586,58 @@ function debitpolist($bankid) return $query->result(); } - + function igrmastersingle($igrno,$pono) + { + $this->db->distinct(); + $this->db->select('IGRNO,file,PONO as pono'); + $this->db->from('T_IGR_Master'); + if(!empty($igrno) && !empty($pono)){ + $this->db->where('PONO',$pono); + $this->db->where('IGRNO',$igrno); + }else if(!empty($pono)){ + $this->db->where('PONO',$pono); + $this->db->where('IGRNO != ""'); + }else{ + $this->db->where('IGRNO',$IGRNO); + } + + $query = $this->db->get(); + return $query->result(); + } + function igrmastermultiple($igrno,$pono) + { + $this->db->distinct(); + $this->db->select('BillNo,IGRNO,FilePath,PONO,Remarks'); + $this->db->from('T_Inwardgateregister_fileupload'); + if(!empty($igrno) && !empty($pono)){ + $this->db->where('PONO',$pono); + $this->db->where('IGRNO',$igrno); + }else if(!empty($pono)){ + $this->db->where('PONO',$pono); + $this->db->where('IGRNO != ""'); + }else{ + $this->db->where('IGRNO',$IGRNO); + } + $query = $this->db->get(); + return $query->result(); + + } + function debitpolist($bankid) + { + $this->db->select('bp.id,bp.mid,igrm.MaterialRcvdDate,bp.PONO,bp.Suppliername,bp.Totalpoamount,br.Debit,bp.Balancetopay,bp.Amountpaid,bp.IGRNO,bp.IGRLineItemNo,igrm.file,bu.FilePath,inward.FilePath as Fpath'); + $this->db->from ('T_Bankmappingpo bp'); + $this->db->join ('T_IGR_Master igrm','bp.IGRNO = igrm.IGRNO','left'); + $this->db->join ('T_PurchaseOrder_BillUpload bu','bu.PONO = bp.PONO','left'); + $this->db->join('T_Inwardgateregister_fileupload inward','inward.IGRNO =igrm.IGRNO','left'); + $this->db->join ('T_bankreport br','br.ID=bp.mid'); + $this->db->where('bp.IsActive',1); + $this->db->where('bp.mid',$bankid); + // $this->db->where('igrde.BankStatus !=','ST072'); + $this->db->group_by('bp.id'); + $query = $this->db->get(); + return $query->result(); + + } function creditinvoicelist($bankid) { $this->db->select('bm.indate,bm.invoiceno,bm.customername,bm.totinvoiceamount,bm.bankid, @@ -854,12 +821,7 @@ function debitpolist($bankid) $r = $this->db->affected_rows(); return $r; } - // function invicedata($invoicedata) - // { - // $this->db->insert('T_Bankinvoicereport',$invoicedata); - // $r = $this->db->affected_rows(); - // return $r; - // } + function mappingpo($podata) { $this->db->insert('T_Bankmappingpo',$podata); @@ -876,11 +838,11 @@ function debitpolist($bankid) } - public function getpono($pono) + public function getpono($igrlineitem) { - $this->db->select('PONO'); + $this->db->select('IGRLineItemNo'); $this->db->from('T_Bankporeport'); - $this->db->where('PONO ',$pono); + $this->db->where('IGRLineItemNo ',$igrlineitem); $query = $this->db->get(); // print_r( $this->db->last_query()); return $query->result(); @@ -934,15 +896,15 @@ function debitpolist($bankid) $this->db->where('ID',$bankid); $this->db->update('T_bankreport',$bankcreditdata); - print_r($this->db->last_query()); - //return TRUE; + //print_r($this->db->last_query()); + return TRUE; } - public function getearlyamount($pono) + public function getearlyamount($igrlineitem) { $this->db->select('Amountpaid'); $this->db->from('T_Bankporeport'); - $this->db->where('PONO ',$pono); + $this->db->where('IGRLineItemNo ',$igrlineitem); $query = $this->db->get(); // print_r( $this->db->last_query()); return $query->result(); @@ -979,10 +941,10 @@ function debitpolist($bankid) } - public function poupdate($podata,$pono) + public function poupdate($podata,$igrlineitem) { - $this->db->where('PONO',$pono); + $this->db->where('IGRLineItemNo',$igrlineitem); $this->db->update('T_Bankporeport',$podata); return TRUE; @@ -1033,7 +995,7 @@ function debitpolist($bankid) return $r; } - function Cashbook($cashbookdatas) + function Cashbook($cashbookdatas) { $code=$cashbookdatas['code']; $type=$cashbookdatas['type']; diff --git a/application/models/inwardgateregister_model.php b/application/models/inwardgateregister_model.php index 542963ce..3617193b 100755 --- a/application/models/inwardgateregister_model.php +++ b/application/models/inwardgateregister_model.php @@ -10,7 +10,7 @@ class inwardgateregister_model extends CI_Model function updatefile($bill,$Picture,$oldfile) { - + // if($oldfile != ''){ // //unlink("uploads/BillFiles/".$oldfile);//this deletes the file on particular folder too // } @@ -288,22 +288,41 @@ class inwardgateregister_model extends CI_Model * @param number $IGRNO : This is IGRNO * @return array $result : result of the query (returns igr details) */ - function viewigr($IGRNO) + // function viewigr($IGRNO) + // { + // $this->db->distinct(); + // $this->db->select('igr.IGRNO,igr.*,igrd.*,MM.MaterialName,MM.UOM,sup.Address,sup.SupplierName,POM.ServiceDescription,POL.Quantity'); + // $this->db->from('T_IGR_Master igr'); + // $this->db->join('T_IGR_Details igrd','igrd.IGRNO = igr.IGRNO'); + // $this->db->join('T_PurchaseOrder_Master POM','igr.PONO = POM.PONO'); + // $this->db->join('T_PurchaseOrder_LineItem POL','igr.PONO = POL.PONO and POL.MaterialCode=igrd.MaterialCode '); + // $this->db->join('T_SupplierDetailsN sup', 'sup.SupplierID = POM.SupplierID'); + // $this->db->join('T_MaterialMaster MM', 'MM.MaterialCode = igrd.MaterialCode'); + // $this->db->where('igrd.IGRItemNo',$IGRNO);//here not a igr no , igrlineitem no + // //$this->db->where('igr.IGRNO',$IGRNO);//this where igno old flow + + + // $query = $this->db->get(); + + // $result = $query->result(); + // return $result; + // } + function viewigr($IGRNO) { $this->db->distinct(); $this->db->select('igr.IGRNO,igr.*,igrd.*,MM.MaterialName,MM.UOM,sup.Address,sup.SupplierName,POM.ServiceDescription,POL.Quantity'); + $this->db->select('igr.IGRNO,igr.*,igrd.*,MM.MaterialName,MM.UOM,sup.Address,sup.SupplierName,POM.ServiceDescription,POL.Quantity'); $this->db->from('T_IGR_Master igr'); $this->db->join('T_IGR_Details igrd','igrd.IGRNO = igr.IGRNO'); $this->db->join('T_PurchaseOrder_Master POM','igr.PONO = POM.PONO'); $this->db->join('T_PurchaseOrder_LineItem POL','igr.PONO = POL.PONO and POL.MaterialCode=igrd.MaterialCode '); $this->db->join('T_SupplierDetailsN sup', 'sup.SupplierID = POM.SupplierID'); $this->db->join('T_MaterialMaster MM', 'MM.MaterialCode = igrd.MaterialCode'); - $this->db->where('igrd.IGRItemNo',$IGRNO);//here not a igr no , igrlineitem no - //$this->db->where('igr.IGRNO',$IGRNO);//this where igno old flow + $this->db->where('igr.IGRNO',$IGRNO); $query = $this->db->get(); - + // print_r( $this->db->last_query()); $result = $query->result(); return $result; } diff --git a/application/views/Advancelist.php b/application/views/Advancelist.php new file mode 100644 index 00000000..4aadc8de --- /dev/null +++ b/application/views/Advancelist.php @@ -0,0 +1,316 @@ + + + + + + +
+ + +
+ +
+ +
+ +

+ +
+ Add New +
+ +
+ +
+ +
+ +
+ + +
+ +
+ +
+ + + + +
+
+ + +
+ +
+ + + + +
+
+ +
+ + + + + + +
+ + +
+
+ + + +
+
+ +
+ +
+ +
+
+ + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Account TypeDATEAccount NameCash TypeAmountDetailsAction
id.'">'.$l->type.'';?>date),'d-m-Y');?>name;?>cashtype;?>total;?>description;?> +     + + +
+ + + +
+
+
+ + + + + + + + + + + + + + + + + + diff --git a/application/views/addnewIncomeExpense.php b/application/views/addnewIncomeExpense.php old mode 100755 new mode 100644 index 454b84ef..41598f75 --- a/application/views/addnewIncomeExpense.php +++ b/application/views/addnewIncomeExpense.php @@ -1,4 +1,4 @@ - + -
@@ -247,6 +252,19 @@
+
+ Select Supplier: *

+ +
+ + + + + +
+
Merchant Name:

@@ -256,11 +274,6 @@ Merchant GST No:

- -
- - -
Voucher Code*

@@ -271,6 +284,10 @@ HSN/SAC Code:

+ +
+ +
Value before GST(₹):

@@ -281,12 +298,8 @@ SGST(₹):

-
- - -
-
+
CGST(₹):

@@ -413,7 +426,7 @@ $('#Recepitaccode').append(options); supp = ; $.each(supp,function(s,supp){ - $("#supplier").append( $('').val(supp.SupplierID).html(supp.SupplierID+' - '+supp.SupplierName)); + $("#supplier,#Paymentsupplier").append( $('').val(supp.SupplierID).html(supp.SupplierID+' - '+supp.SupplierName)); }); @@ -438,6 +451,88 @@ $("#PaymentDate").datepicker({ }); + +$(document).ready(function() +{ + +$("#supplier,#Paymentsupplier").select2(); + +/**** autocomplete ****/ +$('#merchant').autocomplete({ + + onSearchStart: function (query) { + $('#merchant').autocomplete("option", "minLength", 0); + }, + + serviceUrl: "cashbook/autocomplete", + onSelect: function (suggestion) { + + var data = suggestion.SupplierName; + var selectedvalue = $('input[name=merchant]').val(); + if(selectedvalue != ' ' ) + { + + $.ajax({ + data:{id:selectedvalue}, + type:"POST", + url:"cashbook/getSupplierDtls", + success:function(data) { + var supplier_gstno = ''; + if(data != '') + { + + data = JSON.parse(data); + $.each(data,function(i,arr){ + supplier_gstno = arr.GSTNO; + }); + $("#merchantgst").val(supplier_gstno); + } + } + }); + } + } + }); +/**** receipt autocomplete ends here ********/ + + +$('#Paymentmerchant').autocomplete({ + + onSearchStart: function (query) { + $('#Paymentmerchant').autocomplete("option", "minLength", 0); + }, + + serviceUrl: "cashbook/autocomplete", + onSelect: function (suggestion) { + + var data = suggestion.SupplierName; + var selectedvalue = $('input[name=Paymentmerchant]').val(); + if(selectedvalue != ' ' ) + { + + $.ajax({ + data:{id:selectedvalue}, + type:"POST", + url:"cashbook/getSupplierDtls", + success:function(data) { + var supplier_gstno = ''; + if(data != '') + { + + data = JSON.parse(data); + $.each(data,function(i,arr){ + supplier_gstno = arr.GSTNO; + }); + $("#Paymentmerchantgst").val(supplier_gstno); + } + } + }); + } + } + }); + +/**** payment autocomplete ends here ********/ + +}); function readURL(input,id) { //alert(id); diff --git a/application/views/bankamountpaid.php b/application/views/bankamountpaid.php index 4a142cd5..75f1de84 100644 --- a/application/views/bankamountpaid.php +++ b/application/views/bankamountpaid.php @@ -96,7 +96,7 @@ if(!empty($amountpaid))
-

Bank Debit Amount Paid Reports

+

Bank Debit Amount Paid Reports

@@ -203,19 +203,32 @@ if(!empty($amountpaid)) Totalpoamount-$ap->Amountpaid?> Amountpaid?> file=='') - { - ?> - N/A - file !='') { ?> - - + Fpath !='') + { + + + ?> + + + + + N/A + + + + FilePath=='') { ?> @@ -322,14 +335,15 @@ $.ajax( } function pono(i) { + var igrno=$('#igrno'+i).text(); var pono=$('#pono'+i).text(); $("#Fileshow").modal('show'); $.ajax( { - data:{pono:pono}, + data:{igrno:igrno,pono:pono}, type:"POST", - url:"Filelist", + url:"cashbook/filelist", success:function(data) { @@ -418,6 +432,82 @@ $( function() { return date; } } ); + function igrno(i) +{ + var igrno=$('#igrno'+i).text(); + var pono =$('#pono'+i).text(); + $("#Fileshow").modal('show'); + $.ajax( + + { + data:{igrno:igrno,pono:pono}, + type:"POST", + url:"cashbook/IGRFilelist", + success:function(data) + { + + + var trHTML = ''; + var FilePath =''; + var Filename = ''; + var PONO =''; + var BillNO =''; + i=0; + $.each($.parseJSON(data),function (i, item) { + + if(item.file == null) + { + // if(item.Remarks ==null) + // { + //alert() + PONO =item.PONO; + BillNO =item.BillNo; + Filename =item.FilePath; + FilePath = "uploads/Igrfiles/"+item.FilePath; + // } + // else{ + // Filename ="BillDetails"; + // PONO =item.PONO; + // BillNO =item.BillNo; + // FilePath = item.FilePath; + // } + + }else{ + Filename = item.file; + PONO =item.pono; + BillNO = '-'; + + FilePath =item.file; + } + + + if(Filename != null) + { + i=i+1; + i=i-1; + trHTML += '' + + '' + i + '' + + '' + BillNO+ '' + + '' + PONO+ '' + + + ''+ Filename +'' + + + // '' + + ''; + + } + + + + }); + + $("#tbleAppend1").empty(); + $('#Inwardgateregistertable1 > tbody').append(trHTML); +} + }); + +} + diff --git a/application/views/bankamountreceived.php b/application/views/bankamountreceived.php index fc7065d3..9509a27e 100644 --- a/application/views/bankamountreceived.php +++ b/application/views/bankamountreceived.php @@ -65,7 +65,7 @@ foreach($financialyear as $item) -

Bank Credit Amount Received Report

+

Bank Credit Amount Received Report

diff --git a/application/views/bankcashnew.php b/application/views/bankcashnew.php index 2d96d972..62e86da4 100644 --- a/application/views/bankcashnew.php +++ b/application/views/bankcashnew.php @@ -1,42 +1,55 @@ - +
- - -
-
- Back -
-
+
+
+ Back +
+
-

-
Siddharth Industries - Bank Statement(Income and Expenses)
-

-
-
+

+
+
- +
- - - - - - - - - - - - - - - - - - - - - - - -
Payment IDPayment ModePayment TypePayment Amount (₹)Payment date Naration

Bank

-
-
-
-
+ + -
- - - + + +
+
+
+ - -
-
- Select Account type:

- -
- PAYMENT -
+
+ Account Name Select: *

+ +
+
+ Date:

+ +
+
+ Received From:*

+ +
-
- RECEIPT         -
- -
-
- -
-
- Account Name Select: *

- -
-
- -
-
- Date:*

- -
-
-
-
- AAA*

- -
-
- - -
- -
- - -
-
- Select Supplier: *

+
+ Select Supplier: *

-
-
-
-
- Total Amount:*

- - -
-
-
- Description:

- - -
-
- -
- +
+ +
+
- GST + GST
-
- +
@@ -518,34 +501,183 @@ else
-
-
- -
- File Upload: -
- -
-
- - -
- -
-
- - - - - - - - -
+ + + +
+
+
+
+ +
+
+
+ +
+
+

Add New Payment

+
+ +
+
+
+
+
+ Date:*

+ +
+ +
+ Paid To*

+ +
+ +
+ Select Supplier: *

+ +
+ +
+
+
+
+ Merchant Name:

+ +
+ +
+ Merchant GST No:

+ +
+ +
+ Voucher Code*

+ +
+ +
+ HSN/SAC Code:

+ +
+
+
+
+ Value before GST(₹):

+ +
+ +
+ SGST(₹):

+ +
+ + +
+ CGST(₹):

+ +
+ + +
+ IGST(₹):

+ +
-
- - + +
+ +
+
+
+ Account Name Select:* + +
+ +
+ Account Description: + +
+ +
+ Amount(₹):* + +
+ + +
+ + +
+
+
+ +
+ + + + +
+
+ Total Amount(₹): + +
+
+ +
+
+
+ Description: + +
+ +
+ + File Upload: + your image
+ +
+
+
+
+
+ + + + + + + + + + + +
+ + + +
+
+
+
+ +
+
+
+
+ - - - diff --git a/application/views/bankdebit.php b/application/views/bankdebit.php index c0c3e9c0..0470cd0c 100644 --- a/application/views/bankdebit.php +++ b/application/views/bankdebit.php @@ -83,17 +83,7 @@ foreach($financialyear as $item) - - - - - - - - - +
-
+
-
-
+
-
+
-
+
-
+
-
+
- +
-
- -
- - - - - - - - - - - +
- + + +
@@ -295,356 +273,302 @@ foreach($financialyear as $item) var i; $.each(res1, function( index, value ) { - var res2 = value.split('-'); - - var bid=res2[0]; - var bam=res2[1]; - //alert(bid); - //alert(bam); - $('#bankid').val(bid); - document.getElementById("bid").innerHTML='Payment ID:' +bid; - }); - - //alert(res2); - //alert(res[1]); - //var text = $('#debitamount').text(); - - - //alert($data['cash']); - // $('#debitamount').val('10'); - table = $('#req').DataTable( { + var res2 = value.split('-'); + var bid=res2[0]; + var bam=res2[1]; + + $('#bankid').val(bid); + document.getElementById("bid").innerHTML=bid; + });/** foreach closed */ + $.fn.dataTable.moment( 'DD-MM-YYYY' ); + table = $('#req').DataTable( { "dom": "<'row'<'col-md-6'l><'col-md-6'Bf>>" + -"<'row'<'col-md-6'><'col-md-6'>>" + -"<'row'<'col-md-12't>><'row'<'col-md-4'i><'col-md-8'p>>", - buttons: [ - - { + "<'row'<'col-md-6'><'col-md-6'>>" + + "<'row'<'col-md-12't>><'row'<'col-md-4'i><'col-md-8'p>>", + buttons: [ + { extend: 'excelHtml5', footer: 'true', messageTop: $('h3').text(), title: 'cashbook Overall Report', exportOptions: { - columns: ':visible' - + columns: ':visible' } }, 'colvis' ] - } ); -} ); + } );/** datatable closed */ +} );/** ready closed */ + +var temppo=[]; // temppo - This array for PO with its value. +var tempTotal = []; // tempTotal - This array for get value from "temppo" to calculate grandtotal +var intex = 1; +var row = 0; -//alert(pono+'array'); -var temppo=[]; -var tot=0; -var tot1=0; -var intex=1; -var row=0; -var j=1; -var addvalue=0; -var tott=0; -var total=0; function GetPayment(i) { - //alert('check'); - var value=i; + var bankdebitamount=$('#debitamount').val(); var totalvalue=$('#addvalue').val(); var balanceamount=bankdebitamount-totalvalue; - var x = document.getElementById('checkboxcheckbox'+i).checked; + var x = document.getElementById('checkboxcheckbox'+i).checked; - var amount= parseFloat( $('#invoicepaymet'+i).val() == '' ? '0.00' : $('#invoicepaymet'+i).val()) - //alert(amount+'inv'); - var negative=0; - if(amount<0) - { + var amount= parseFloat( $('#invoicepaymet'+i).val() == '' ? '0.00' : $('#invoicepaymet'+i).val()) + + var negative=0; + if(amount<0) + { negative=1; alert('Invalid Amount'); - // $('#invoicepaymet'+i).val(''); - - } - temp=intex; - //alert(temp+'temp');success + } + + temp=intex; + if(x==true) { - //alert(x); - var bankdebitamount=$('#debitamount').val(); - var totalvalue=$('#addvalue').val(); - var balanceamount=bankdebitamount-totalvalue; - - if(bankdebitamount==totalvalue) - { - //alert('you have remaining'+balanceamount); - //alert('your amount is equal to debit amount'); - $(".checkboxcheckbox").prop("disabled", true); - } - - else - { - //document.getElementById('checkboxcheckbox'+i).checked = false; - ('your checkbox is disabled beacause already mapped amount') - } - - row= parseInt(row)+1; + row = parseInt(row)+1; $('#Rowid').val(row); - var date= document.getElementById ( "date"+i ).innerText; - var pono =document.getElementById ( "pono"+i ).innerText; - var poamount =document.getElementById ( "qw"+i ).innerText; - var igrno =document.getElementById ( "igrno"+i ).innerText; + var date= document.getElementById ( "date"+i ).innerText;//value taken from table, col name : date + var pono =document.getElementById ( "pono"+i ).innerText;//value taken from table, col name : purchase order no + var igrno =document.getElementById ( "igrno"+i ).innerText; var igrlineitem=document.getElementById ( "igrlineitem"+i ).innerText; - var tta= $('#totala').val(); - var tempid = "debited"+value; - //var credit=parseFloat(document.getElementById(tempid).innerText); - var t ="totala"+value; - var poamount1 =$(t).val(); - //alert(poamount1+'amt'); - var ponovalue = igrlineitem+','+poamount; - temppo.push(ponovalue); - console.log(temppo); - - - //console.log(temppo); - var supname =document.getElementById ("sn"+i ).innerText; - var totalordervalue =document.getElementById ("tov"+i ).innerText; - var invoicepayment =document.getElementById ( "qw"+i ).innerText; - $('#invoicepaymet'+i).val(invoicepayment); - var RowCount= $('#Rowid').val(); + var supname =document.getElementById ("sn"+i ).innerText;//value taken from table col name : suppliername + var totalordervalue =document.getElementById ("tov"+i ).innerText;//value taken from table col name : total po amount + var invoicepayment =document.getElementById ( "qw"+i ).innerText;//value taken from table col name : Balance to pay + $('#invoicepaymet'+i).val(invoicepayment);//to copy the value from 'balance to pay' to 'amount paid' + $('').attr({ type:'hidden', - name:'date1'+j, - id:'date1'+j, + name:'hidedate'+i, + id:'hidedate'+i, value:date - }).appendTo('#date1'); + }).appendTo('#HideDateDiv'); $('').attr({ type:'hidden', - name:'purchaseono'+j, - id:'purchaseono'+j, + name:'hidepono'+i, + id:'hidepono'+i, value:pono - }).appendTo('#purchaseono'); + }).appendTo('#HidePONODiv'); $('').attr({ type:'hidden', - name:'hideigrno'+j, - id:'hideigrno'+j, + name:'hideigrno'+i, + id:'hideigrno'+i, value:igrno }).appendTo('#HideIGRDiv'); $('').attr({ type:'hidden', - name:'hideigrline'+j, - id:'hideigrline'+j, + name:'hideigrline'+i, + id:'hideigrline'+i, value:igrlineitem - }).appendTo('#hideigrline'); + }).appendTo('#HideIGRLineItem'); $('').attr({ type:'hidden', - name:'supname'+j, - id:'supname'+j, + name:'hidesupname'+i, + id:'hidesupname'+i, value:supname - }).appendTo('#supname'); + }).appendTo('#HideSuppDiv'); $('').attr({ type:'hidden', - name:'totala'+j, - id:'totala'+j, - value:invoicepayment - }).appendTo('#totala'); - - - $('').attr({ - type:'hidden', - name:'ttamnt'+j, - id:'ttamnt'+j, + name:'hidettlPoamt'+i, + id:'hidettlPoamt'+i, value:totalordervalue - }).appendTo('#ttamnt'); + }).appendTo('#HideTtlPoAmtDiv'); - - intex = parseInt(intex)+1; - j=parseInt(j)+1; - //alert(j+'j'); - var to=0; - for(t=1;t').attr({ + type:'hidden', + name:'hideamtpaid'+i, + id:'hideamtpaid'+i, + value:invoicepayment + }).appendTo('#HideAmtPaidDiv'); - - + var poamount = $('#hideamtpaid'+i).val(); + var ponovalue = i+','+igrlineitem+','+poamount; + temppo.push(ponovalue); + //console.log(temppo); + + calculategrandtotal(); - - // GetAmount(i); + intex = parseInt(intex)+1; + + var bankdebitamount=$('#debitamount').val(); + var totalvalue=$('#addvalue').val(); + //var balanceamount=bankdebitamount-totalvalue; + // alert(bankdebitamount); + // alert(totalvalue); + + // if(parseFloat(totalvalue)>=parseFloat(bankdebitamount)) + // { + // alert('your checkbox is disabled beacause already mapped amount'); + // $(".checkboxcheckbox").prop("disabled", true); + // } } else { - //alert(i) - var rr= $('#Rowid').val(); - var ro= parseInt(rr)-1; + + var rr = $('#Rowid').val(); + row = parseInt(rr)-1; - var Payment= parseFloat( $('#invoicepaymet'+i).val() == '' ? '0.00' : $('#invoicepaymet'+i).val()); + var Payment = parseFloat( $('#invoicepaymet'+i).val() == '' ? '0.00' : $('#invoicepaymet'+i).val()); var Inid = document.getElementById ('igrlineitem'+i ).innerText - var ponovalue = Inid+','+Payment; + var ponovalue = i+','+Inid+','+Payment; + + $.each(temppo,function(i,val){ + var a = temppo.indexOf(ponovalue); - //console.log(a); - if(a!=-1) - { + var b = tempTotal.indexOf(Payment); + //console.log(a); + if(a != -1){ + //sconsole.log('if'); temppo.splice(a,1); - console.log(temppo); + //console.log(temppo); } -//alert(Inid) - for(s=1;s<=j;s++) - { - // alert(j+'else'); - var ch= $('#hideigrline'+s).val(); - if(Inid==ch) - { - - var w=s; - //alert(w+'w'); - delamount= $('#totala'+w).val(); - //break; - } + if(b!=-1) + { + tempTotal.splice(ponovalue,1); + //console.log(tempTotal); + } +}); + + calculategrandtotal(); - } - - // //alert(w); - var tote= $('#addvalue').val(); - var afterdeltot= parseFloat(tote)- parseFloat(delamount); - tot=parseFloat(tot)- parseFloat(Payment); $('#invoicepaymet'+i).val(''); - $('#addvalue').val(parseFloat(afterdeltot).toFixed(2)); + - - //alert(ro); - - $('#Rowid').val(ro); - //$('#addvalue').val(''); - //$('#invoicepaymet'+i).val(''); + $('#Rowid').val(row); + + $('#invoicepaymet'+i).val(''); + $('#hidedate'+i).val(''); + $('#hidepono'+i).val(''); + $('#hideigrno'+i).val(''); $('#hideigrline'+i).val(''); - $('#date1'+i).val(''); - $('#purchaseono'+i).val(''); - $('#supname'+i).val(''); - $('#ttamnt'+i).val(''); - $('#totala'+i).val(''); - //$('#aa'+i).val(''); + $('#hidesupname'+i).val(''); + $('#hidettlPoamt'+i).val(''); + $('#hideamtpaid'+i).val(''); + + //$('#invoicepaymet'+i).remove(); + $('#hidedate'+i).remove(); + $('#hidepono'+i).remove(); + $('#hideigrno'+i).remove(); + $('#hideigrline'+i).remove(); + $('#hidesupname'+i).remove(); + $('#hidettlPoamt'+i).remove(); + $('#hideamtpaid'+i).remove(); } } -function GetAmount(i) +function GetAmount(i) { - //alert('text'); - var amount= parseFloat( $('#invoicepaymet'+i).val() == '' ? '0.00' : $('#invoicepaymet'+i).val()) - + //alert("onchnage function getamount"+i); + var amount = parseFloat( $('#invoicepaymet'+i).val() == '' ? '0.00' : $('#invoicepaymet'+i).val()) + var negative=0; if(amount<0) { negative=1; - alert("Invalid Amount") - $('#invoicepaymet'+i).val(''); + alert("Invalid Amount") + $('#invoicepaymet'+i).val(''); } - var x = document.getElementById('checkboxcheckbox'+i).checked; + + var x = document.getElementById('checkboxcheckbox'+i).checked; if(x==true ) { - //alert(x); + var date= document.getElementById ( "date"+i ).innerText; var pono =document.getElementById ( "pono"+i ).innerText; var igr =document.getElementById ( "igrno"+i ).innerText; var igrlineitem=document.getElementById ( "igrlineitem"+i ).innerText; - var supname =document.getElementById ("sn"+i ).innerText; var totalordervalue =document.getElementById ("tov"+i ).innerText; - var balancetopay=document.getElementById ( "qw"+i ).innerText; + var balancetopay =document.getElementById ( "qw"+i ).innerText; - for(k=1;k<=j-1;k++) + for(k=1;k<=i;k++) { - //alert(k) - var idcheck=$('#hideigrline'+k).val(); - // alert(idcheck) + //alert(k); + var idcheck=$('#igrlineitem'+k).val(); - if(igrlineitem==idcheck) + if(igrlineitem == idcheck) { var cid=k; - //alert(cid+'if'); - //die(); break; - } } - if(amount<=totalordervalue) + if(amount<=balancetopay)//amount paid value is less than or equal to total amount paid value means { - //alert(cid+'cid'); - $('#date1').val(date); - $('#hideigrline'+cid).val(igrlineitem); - $('#supname'+cid).val(supname); - $('#ttamnt'+cid).val(totalordervalue); - $('#totala'+cid).val(amount); + + $('#hidedate'+cid).val(date); + $('#hidepono'+cid).val(pono); + $('#hidesupname'+cid).val(supname); + $('#hidettlPoamt'+cid).val(totalordervalue); + $('#hideamtpaid'+cid).val(amount); + $('#hideigrno'+cid).val(igr); + $('#hideigrline'+cid).val(igrlineitem); + var totalvalue=$('#addvalue').val(); var bid=$('#bankid').val(); - //$('#inv_total'+cid).val(invoicepayment); + } - - else - { + else + { alert('You are exceeding the payment get!!'); $('#invoicepaymet'+i).val(amount) - location.reload(); + // location.reload(); - } + } - var tot11=0 - for(l=1;l=parseFloat(totalvalue)) { -//alert(date+'date'); -//die(); - //alert('you have remainining'+balnceamount); - $.ajax( - { - data:{podate:date,pono:pono,igrno:igrno,igrlineitem:igrlineitem,sname:suppliername,tot:totalordervalue,aa:amountpaid,ip:invoicepaymet,rc:rowCount,tpv:totalvalue,bda:bankdebitamount,bi:bid,check:check,rw:rw}, - type:"POST", - url:"cashbook/receipt", - success:function(data) - { - if(data) - { - window.location.href ="Bankingstatement"; - //location.reload(); + + $.ajax( + { + data:{podate:date,pono:pono,igrno:igrno,igrlineitem:igrlineitem,sname:suppliername,tot:totalordervalue,aa:invoicepaymet,rc:rowCount,tpv:totalvalue,bda:bankdebitamount,bi:bid,check:check,rw:rw}, + type:"POST", + url:"cashbook/receipt", + success:function(data) + { - } - } - }); + if(data) + { + //$('#content').loader('hide'); + //alert(data); + window.location.href ="Bankingstatement"; + //location.reload(); + + } + } + }); - } - } - - - + } else{ - alert('You are payment exceeding'); + alert('Your payment exceeding '); location.reload(); } } - } +} + function isNumberKey(evt) { diff --git a/application/views/banksettlement.php b/application/views/banksettlement.php index e329e2c3..2759fc8d 100644 --- a/application/views/banksettlement.php +++ b/application/views/banksettlement.php @@ -279,31 +279,36 @@ Suppliername?> Totalpoamount?> - Totalpoamount-$ap->Amountpaid?> + Balancetopay?> Amountpaid?> file=='') - { - ?> - No File - - - - - - - - file !='') + { + ?> + + + + Fpath !='') + { + + + ?> + + + + + + N/A + + + + FilePath=='') { ?> @@ -317,7 +322,7 @@ ?> -     +     @@ -473,14 +478,15 @@ function pono(i) { + var igrno=$('#igrno'+i).text(); var pono=$('#pono'+i).text(); $("#Fileshow").modal('show'); $.ajax( { - data:{pono:pono}, + data:{igrno:igrno,pono:pono}, type:"POST", - url:"Filelist", + url:"cashbook/filelist", success:function(data) { @@ -531,6 +537,81 @@ function pono(i) ] } ); } ); + +function igrno(i) +{ + var igrno=$('#igrno'+i).text(); + var pono =$('#pono'+i).text(); + $("#Fileshow").modal('show'); + $.ajax( + + { + data:{igrno:igrno,pono:pono}, + type:"POST", + url:"cashbook/IGRFilelist", + success:function(data) + { + + + var trHTML = ''; + var FilePath =''; + var Filename = ''; + var PONO =''; + var BillNO =''; + + $.each($.parseJSON(data),function (i, item) { + + if(item.file == null) + { + // if(item.Remarks ==null) + // { + //alert() + PONO =item.PONO; + BillNO =item.BillNo; + Filename =item.FilePath; + FilePath = "uploads/Igrfiles/"+item.FilePath; + // }else{ + // Filename ="BillDetails"; + // PONO =item.PONO; + // BillNO =item.BillNo; + // FilePath = item.FilePath; + // } + + }else{ + Filename = item.file; + PONO =item.pono; + BillNO = '-'; + + FilePath =item.file; + } + + + if(Filename != null) + { + i=i+1; + i=i-1; + trHTML += '' + + '' + i + '' + + '' + BillNO+ '' + + '' + PONO+ '' + + + ''+ Filename +'' + + + // '' + + ''; + + } + + + + }); + + $("#tbleAppend1").empty(); + $('#Inwardgateregistertable1 > tbody').append(trHTML); +} + }); + +} diff --git a/application/views/editincomeexpenses.php b/application/views/editincomeexpenses.php old mode 100755 new mode 100644 index 4fbf979b..160ab911 --- a/application/views/editincomeexpenses.php +++ b/application/views/editincomeexpenses.php @@ -29,8 +29,17 @@ if(!empty($RecepitPayment)) { $document =$rd->document; $final = base_url().$document; + $bankamount=$rd->totalbankamount; + $bankid=$rd->ID; + $normalid=$rd->id; $accountcode1=$rd->account_code; $id=$rd->id; + $amounttype=$rd->amounttype; + $alreadypaid=$rd->Clearbalance; + $alreadyreceived=$rd->cclearbalance; + //echo $alreadypaid; + //echo $alreadyreceived; + $typeofmap=$rd->cashtype; $type1=$rd->type; $viewdep=$rd->total; $dropdown=$rd->name; @@ -116,6 +125,21 @@ if(!empty($PaymentMultiple))
+ +
+
+
+
+ +

Payment ID:    

+

Total Amount:  Rs

+

Payment Mode:  Bank

+

Remaining Balance:  Rs

+
+
+
+
+
@@ -260,6 +292,20 @@ if(!empty($PaymentMultiple))
-->
+
+
+
+
+ +

Payment ID:    

+

Total Amount:  Rs

+

Payment Mode:  Bank

+

Remaining Balance:  Rs

+
+
+
+
+
@@ -272,6 +318,17 @@ if(!empty($PaymentMultiple)) Paid To:*

+ +
+ Select Supplier: *

+ +
+
+ + +
Merchant Name:

@@ -283,10 +340,7 @@ if(!empty($PaymentMultiple))
-
- -
Voucher Code:*

@@ -297,6 +351,12 @@ if(!empty($PaymentMultiple))
+
+ + + +
+
Value before GST(₹):

@@ -306,11 +366,7 @@ if(!empty($PaymentMultiple)) SGST(₹):*

-
- - -
CGST(₹):*

@@ -488,7 +544,18 @@ if(!empty($PaymentMultiple)) //var drop=$("input[type=radio][name='range']:checked").val() $(document).ready(function(){ - $("#supplier").select2(); + var typeofmap = ""; + //alert(typeofmap+'tom'); + if(typeofmap=='Cash') + + { + $('#detail').hide(); + + } + else + { + $('#detail').show(); + } var type = ""; //alert(type); if(type == "RECEIPT") @@ -503,6 +570,86 @@ $(document).ready(function(){ $('#myradio2').attr('checked','true'); $('#towhom').text('Paid To:'); } + + +$("#supplier,#Paymentsupplier").select2(); + +/**** autocomplete ****/ +$('#merchant').autocomplete({ + + onSearchStart: function (query) { + $('#merchant').autocomplete("option", "minLength", 0); + }, + + serviceUrl: "cashbook/autocomplete", + onSelect: function (suggestion) { + + var data = suggestion.SupplierName; + var selectedvalue = $('input[name=merchant]').val(); + if(selectedvalue != ' ' ) + { + + $.ajax({ + data:{id:selectedvalue}, + type:"POST", + url:"cashbook/getSupplierDtls", + success:function(data) { + var supplier_gstno = ''; + if(data != '') + { + + data = JSON.parse(data); + $.each(data,function(i,arr){ + supplier_gstno = arr.GSTNO; + }); + $("#merchantgst").val(supplier_gstno); + } + } + }); + } + } + }); +/**** receipt autocomplete ends here ********/ + + +$('#Paymentmerchant').autocomplete({ + + onSearchStart: function (query) { + $('#Paymentmerchant').autocomplete("option", "minLength", 0); + }, + + serviceUrl: "cashbook/autocomplete", + onSelect: function (suggestion) { + + var data = suggestion.SupplierName; + var selectedvalue = $('input[name=Paymentmerchant]').val(); + if(selectedvalue != ' ' ) + { + + $.ajax({ + data:{id:selectedvalue}, + type:"POST", + url:"cashbook/getSupplierDtls", + success:function(data) { + var supplier_gstno = ''; + if(data != '') + { + + data = JSON.parse(data); + $.each(data,function(i,arr){ + supplier_gstno = arr.GSTNO; + }); + $("#Paymentmerchantgst").val(supplier_gstno); + } + } + }); + } + } + }); + +/**** payment autocomplete ends here ********/ + + }); @@ -524,10 +671,12 @@ $(function() { supp = ; $.each(supp,function(s,supp){ - $("#supplier").append( $('').val(supp.SupplierID).html(supp.SupplierID+' - '+supp.SupplierName)); + $("#supplier,#Paymentsupplier").append( $('').val(supp.SupplierID).html(supp.SupplierID+' - '+supp.SupplierName)); }); $('#supplier option[value=""]').prop('selected', true); + $('#Paymentsupplier option[value=""]').prop('selected', true); + if('' != '999'){ diff --git a/application/views/income_expense_list.php b/application/views/income_expense_list.php old mode 100755 new mode 100644 index f3077479..19dc04e8 --- a/application/views/income_expense_list.php +++ b/application/views/income_expense_list.php @@ -90,6 +90,7 @@ Account Type DATE Account Name + Cash Type Amount(₹) Details Action @@ -108,6 +109,7 @@ id.'">'.$l->type.'';?> date),'d-m-Y');?> type == 'PAYMENT' && $l->account_code == '999') { echo $l->description; } else {echo $l->name;}?> + cashtype;?> total;?> description;?> diff --git a/application/views/viewIGRDetails.php b/application/views/viewIGRDetails.php index 5f71afd8..12cdb61e 100755 --- a/application/views/viewIGRDetails.php +++ b/application/views/viewIGRDetails.php @@ -80,24 +80,24 @@ { $index = 0; foreach($IGR as $record) { - // print_r($record); + //print_r($record); $index = $index +1; ?> - - IGRItemNo ?>" > IGRNO ?> - + + IGRNO ?> + PONO ?> SupplierName ?> DeliveryChellanOrInvoiceNo ?> DeliveryChellanDate); echo $date->format('d-m-Y'); ?> - + MaterialName ?> QuantityAsPerInvoice ?> - + VehicleNo ?> CourierNo ?> @@ -468,49 +468,17 @@ function filecheck() } $(document).ready(function() { -// // buttons: [ {name: 'copy', extend: 'copy', exportOptions: {columns: ':gt(0)', orthogonal: 'export'}} ] -// table = $('#Inwardgateregistertable').DataTable( { -// "dom": "<'row'<'col-md-6'l><'col-md-6'Bf>>" + -// "<'row'<'col-md-3'><'col-md-6'>>" + -// "<'row'<'col-md-12't>><'row'<'col-md-4'i><'col-md-8'p>>", -// "lengthMenu": [ 25, 50, 75, 100 ], buttons: { -// extend: 'excelHtml5', -// footer: 'true', -// //messageTop: $('h3').text(), -// title: $('h3').text(), -// exportOptions: { -// //columns: ':lt(13)', orthogonal: 'export' -// columns: ':visible'} -// }, - -// ] -// } ); -// } ); -// $(function () { -// $('#Inwardgateregistertable').DataTable({ -// "paging": true, -// "lengthChange": true, -// "searching": true, -// "ordering": true, -// "info": true, -// "autoWidth": true - -// }); -// }); $("#Fileshow").on("shown.bs.modal",function(e) { //var id = $(this).attr('id'); var id = $(e.relatedTarget).data('userid'); - //swal(id); - // SIA/2018-2019/10243.01 - // IGRNO0505 var igr = id.substring(0, 9); - + // alert(igr); var po = id.substring(10, 33); - + //alert(po); $("#hiddenIGRNO").val(igr); $("#hiddenPONO").val(po); @@ -538,14 +506,16 @@ $("#hiddenPONO").val(po); $.each(JSON.parse(file), function (i, item) { if(item.file == null) - { if(item.Remarks ==null) - { + { + // if(item.Remarks ==null) + // { //alert() PONO =item.PONO; BillNO =item.BillNo; Filename =item.FilePath; FilePath = "uploads/Igrfiles/"+item.FilePath; - // }else{ + //} + // else{ // Filename ="BillDetails"; // PONO =item.PONO; // BillNO =item.BillNo; @@ -573,7 +543,7 @@ $("#hiddenPONO").val(po); ''; } - } + }); $("#tblefile").empty(); @@ -593,6 +563,7 @@ $("#hiddenPONO").val(po); + function openbillmodel(i){ // alert(i); @@ -633,14 +604,16 @@ $("#hiddenPONO").val(po); }); }); - +