cashbook_model = new Cashbook_model(); $this->employeedetails_model = new Employeedetails_model(); $this->session = session(); $this->isLoggedIn(); helper(['form', 'url']); } function incomeExpenseList() { $uri = service('uri'); $aid = $uri->getSegment(3); $str = $uri->getSegment(4); if (!empty($aid)) { if (!empty($str)) { //echo "PDF"; $data['company'] = $this->cashbook_model->getCompany(); $data['data'] = $this->cashbook_model->getIncomeExpenseList($aid); //$pic1 = $data['company'][0]->ProfilePic; //echo $pic1; //$pic = base_url().'public/uploads/images'.$pic1; //echo $pic; //die(); $totalamt = $data['data'][0]->total; $data['amtinwords'] = $this->convertNumber($totalamt); $mpdf = new mPDF('utf-8', 'A4-P', 7, 10, 10, 10, 3, 0, 0, 0); $mpdf->SetHTMLHeader($HtmlHeading); $html = view('cashbookpdf', $data, true); $mpdf->SetDisplayMode('fullpage'); $mpdf->setFooter($HTMLFooter . "Page {PAGENO} of {nb}"); $mpdf->list_indent_first_level = 1; $mpdf->setAutoTopMargin = 'stretch'; $mpdf->setAutoBottomMargin = 'stretch'; $mpdf->WriteHTML($html); $filename = "cashbook.pdf"; $mpdf->Output($filename, I); } else { $data['data'] = $this->cashbook_model->getIncomeExpenseList($aid); //print_r($data['dropdownvalues']);die(); $this->global['pageTitle'] = 'Cash Book: View Income Expense '; $this->loadViews("viewIndIncomeExpense", $this->global, $data, NULL); } } else { // $data['list'] = $this->cashbook_model->getIncomeExpenseList(); // $this->global['pageTitle'] = $this->CompanyName.' : Cash Book: Listing'; // $this->loadViews("income_expense_list", $this->global, $data , NULL); $this->global['pageTitle'] = 'Cash Book: Listing'; $data['finyear'] = $this->cashbook_model->finyear(); if ($this->request->getPost('btn_submit')) { $fromdt = $this->request->getPost('from_date'); $todt = $this->request->getPost('to_date'); $ab = $this->request->getPost('financialyear'); $fromyear = substr($ab, 0, -5); $toyear = substr($ab, 5, 5); $data['finyear'] = $this->cashbook_model->finyear(); $data['list'] = $this->cashbook_model->getIncomeExpense($fromyear, $toyear, $fromdt, $todt); } // else{ // if (date('m') <= 3) { // $preyear = (date('Y')-1); // $currentyear = date('Y'); // } else { // $preyear = date('Y') ; // $currentyear = (date('Y') + 1); // } // $data['list'] = $this->cashbook_model->getIncomeExpense($preyear,$currentyear); // $data['finyear']=$this->cashbook_model->finyear(); // } $this->loadViews("income_expense_list", $this->global, $data, NULL); } } function bankreceipt() { $uri = service('uri'); $aid = $uri->getSegment(3); $str = $uri->getSegment(4); if (!empty($aid)) { if (!empty($str)) { $data['company'] = $this->cashbook_model->getCompany(); $data['data'] = $this->cashbook_model->getIncomeExpenseList($aid); $totalamt = $data['data'][0]->total; $data['amtinwords'] = $this->convertNumber($totalamt); $mpdf = new mPDF('utf-8', 'A4-P', 7, 10, 10, 10, 3, 0, 0, 0); $mpdf->SetHTMLHeader($HtmlHeading); $html = view('cashbookpdf', $data, true); $mpdf->SetDisplayMode('fullpage'); $mpdf->setFooter($HTMLFooter . "Page {PAGENO} of {nb}"); $mpdf->list_indent_first_level = 1; $mpdf->setAutoTopMargin = 'stretch'; $mpdf->setAutoBottomMargin = 'stretch'; $mpdf->WriteHTML($html); $filename = "bankreceipt.pdf"; $mpdf->Output($filename, I); } else { $data['data'] = $this->cashbook_model->getIncomeExpenseList($aid); //print_r($data['dropdownvalues']);die(); $this->global['pageTitle'] = 'Cash Book: View Income Expense '; $this->loadViews("viewIndIncomeExpense", $this->global, $data, NULL); } } else { // $data['list'] = $this->cashbook_model->getIncomeExpenseList(); // $this->global['pageTitle'] = $this->CompanyName.' : Cash Book: Listing'; // $this->loadViews("income_expense_list", $this->global, $data , NULL); $this->global['pageTitle'] = 'Cash Book: Listing'; if ($this->request->getPost('btn_submit')) { $fromdt = $this->request->getPost('from_date'); $todt = $this->request->getPost('to_date'); $ab = $this->request->getPost('financialyear'); $fromyear = substr($ab, 0, -5); $toyear = substr($ab, 5, 5); $data['finyear'] = $this->cashbook_model->finyear(); $data['list'] = $this->cashbook_model->getIncomeExpense($fromyear, $toyear, $fromdt, $todt); } else { if (date('m') <= 3) { $preyear = (date('Y') - 1); $currentyear = date('Y'); } else { $preyear = date('Y'); $currentyear = (date('Y') + 1); } $data['list'] = $this->cashbook_model->getIncomeExpense($preyear, $currentyear); $data['finyear'] = $this->cashbook_model->finyear(); } $this->loadViews("income_expense_list", $this->global, $data, NULL); } } function addNewIncomeExpenseLoad() { $data['dropdownvalues'] = $this->cashbook_model->getAccounTypes(); $data['getsupplier'] = $this->cashbook_model->getsupplier(); //print_r($data['dropdownvalues']);die(); $this->global['pageTitle'] = 'Cash Book: Add New Income Expense '; $this->loadViews("addnewIncomeExpense", $this->global, $data, NULL); } function autocomplete() { // $this->model = new cashbook_model(); $mer = $this->request->getGet('query'); $query = $this->cashbook_model->checkMerchant($mer); echo json_encode($query); } function getSupplierDtls() { $s = $this->request->getPost('id'); $supp = $this->cashbook_model->getsupp_dtls($s); echo json_encode($supp); } function bankfileview() { //$data['dropdownvalues'] = $this->cashbook_model->getAccounTypes(); //print_r($data['dropdownvalues']);die(); $data['bankdetails'] = $this->employeedetails_model->getBankDetails(); //$this->global['pageTitle'] = $this->CompanyName.' : Cash Book: Add New Income Expense '; $this->global['pageTitle'] = 'Bank Report - File Upload'; $data['bankbalance'] = $this->cashbook_model->getbalancedetails(); $data['cleareddebitbalance'] = $this->cashbook_model->cleareddebitbalance(); $data['clearedcreditbalance'] = $this->cashbook_model->clearedcreditbalance(); $this->loadViews("bankingfile", $this->global, $data, NULL); } function bankfileupload() { //document => default NULL $document = null; // fs => File Name default 0 $fs = 0; if (!empty($_FILES['userfile']['name'])) { //echo "FILE AVAILABLE"; $config['file_name'] = $_FILES['userfile']['name']; // This Also FileName with format. $myFIle = $config['file_name']; // This Also FileName with format. // xls File destination folder Given Below. $config['upload_path'] = 'public/uploads/banking/'; $path = $config['upload_path']; //Destionation Path => public/uploads/banking. $filename = $config['file_name']; // This Also FileName with format. $document = $path . $filename; $fs = $this->uploadFile1(); // $this->function_alert($fs); $document = $path . $fs; $created_by = $this->session->get('userId'); $openingbalance = 0; $closingbalance = 0; $inputFileName = $_FILES['userfile']['tmp_name']; require_once APPPATH . 'third_party/PHPExcel/IOFactory.php'; $objTpl = PHPExcel_IOFactory::load($inputFileName); $sheet = $objTpl->getActiveSheet(); //->toArray(null, true,true,true); $highestRow = $sheet->getHighestRow(); $highestColumn = $sheet->getHighestColumn(); $highestRow4 = $highestRow - 4; $bank = $this->request->getPost('bankbranchname'); $fileupload = array('Bankname' => $bank, 'document' => $document); $res = $this->cashbook_model->bankfile($fileupload); for ($x = 21; $x <= $highestRow4; $x++) { if ($x == 21) { // $openingbalance=$sheet->getCell('H'.$x)->getValue(); $openingbalance = preg_replace('/\D/', '', $sheet->getCell('H' . $highestRow4)->getValue()); } if ($x == $highestRow4) { // $closingbalance=$sheet->getCell('H'.$highestRow4)->getValue(); $closingbalance = preg_replace('/\D/', '', $sheet->getCell('H' . $highestRow4)->getValue()); } $t = $sheet->getCell('A' . $x)->getValue(); $dat = str_replace('/', '-', $t); if (empty($dat)) { $Date1 = NULL; } else { $Date1 = strtotime($dat); $Date1 = date("Y-m-d ", $Date1); } $s = $sheet->getCell('B' . $x)->getValue(); $dat1 = str_replace('/', '-', $s); if (empty($dat1)) { $Date2 = NULL; } else { $Date2 = format_date($dat1); } $chqno = (($sheet->getCell('C' . $x)->getValue() == '') || ($sheet->getCell('C' . $x)->getValue() == null)) ? $sheet->getCell('C' . $x)->getValue() : "-"; $narration = $sheet->getCell('D' . $x)->getValue(); $cod = (($sheet->getCell('E' . $x)->getValue() == '') || ($sheet->getCell('E' . $x)->getValue() == null)) ? $sheet->getCell('E' . $x)->getValue() : 0; $debit = (($sheet->getCell('F' . $x)->getValue() == '') || ($sheet->getCell('F' . $x)->getValue() == null)) ? $sheet->getCell('F' . $x)->getValue() : 0; $credit = (($sheet->getCell('G' . $x)->getValue() == '') || ($sheet->getCell('G' . $x)->getValue() == null)) ? $sheet->getCell('G' . $x)->getValue() : 0; $balance = (($sheet->getCell('H' . $x)->getValue() == '') || ($sheet->getCell('H' . $x)->getValue() == null)) ? $sheet->getCell('H' . $x)->getValue() : 0; if ($debit == 0) { $Status = ''; } else { $Status = 'OPEN'; } if ($credit == 0) { $cstatus = ''; } else { $cstatus = 'OPEN'; } // $IsActive=0; $filedataupload = array('reportdate' => $Date1, 'valuedate' => $Date2, 'chequeNo' => $cod, 'Narration' => $narration, 'Cod' => $chqno, 'Debit' => $debit, 'Credit' => $credit, 'cbalancetocleared' => $credit, 'Balance' => $balance, 'Bankname' => $bank, 'Status' => $Status, 'cstatus' => $cstatus); // print_r($filedataupload); $res = $this->cashbook_model->bankfiledata($filedataupload); // echo "response ".$res; } // die(); $balance = array('filename' => $config['file_name'], 'created_by' => $created_by, 'openingbalance' => $openingbalance, 'closingbalance' => $closingbalance); $bal = $this->cashbook_model->balance($balance); if ($res == 1) { echo ""; } else { echo ""; } } } function addIncomeExpense() { $bankdate = $this->request->getPost('bankdate'); $bankid = $this->request->getPost('bakid'); $remaindebitamount = $this->request->getPost('remaindebitamount'); $remaincreditamount = $this->request->getPost('remaincreditamount'); $amount = $this->request->getPost('bankamount'); $amounttype = $this->request->getPost('type'); $totalbankamount = $this->request->getPost('totalbankamount'); $alreadypaid = $this->request->getPost('alreadydebitpaid'); $directamount = $this->request->getPost('totalamount'); $debitamount = $this->request->getPost('debitamount'); $alreadycreditpaid = $this->request->getPost('alreadycreditpaid'); $bankorcash = $this->request->getPost('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; } $accounttype = $this->request->getPost('myradio'); //$accounttype1 = $this->request->getPost('myrad'); //echo $accounttype; //echo $accounttype1; if ($accounttype == 1) { $accounttype = 'RECEIPT'; } else { $accounttype = 'PAYMENT'; } $accountcode = $this->request->getPost('accode'); $date = $this->request->getPost('Date'); $date = format_date($date);//3rd $towhome = $this->request->getPost('towhome'); $supplier = $this->request->getPost('supplier'); $gsttoggle = $this->request->getPost('gsttoggle'); $invoiceno = null; $merchantname = null; $mergstno = null; $hsn = null; $beforegst = null; $sgst = null; $cgst = null; $igst = null; if (!empty($gsttoggle)) { $invoiceno = $this->request->getPost('Invoiceno'); $merchantname = $this->request->getPost('merchant'); $mergstno = $this->request->getPost('Merchantgst'); $hsn = $this->request->getPost('hsn'); $beforegst = $this->request->getPost('valuebeforegST'); $sgst = $this->request->getPost('SGST'); $cgst = $this->request->getPost('CGST'); $igst = $this->request->getPost('IGST'); } $cashbookamount = $this->request->getPost('totalamount1'); $totalamount = $directamount + $cashbookamount; $description = $this->request->getPost('description'); if (empty($description)) { $description = 'NA'; } $document = null; $fs = 0; if (!empty($_FILES['myfile']['name'])) { //echo "FILE AVAILABLE"; $config['file_name'] = $_FILES['myfile']['name']; $config['upload_path'] = 'public/uploads/cashbook/'; $path = $config['upload_path']; //$filename = $config['file_name']; $document = $path . $filename; //echo $document; $fs = $this->uploadFile(); $document = $path . $fs; } if ($bankorcash == Bank) { $option = Bank; } else { $option = Cash; } $balance = $totalbankamount - $totalamount; $IsActive = 1; $created_by = $this->session->get('userId'); $addincomexpense = array('type' => $accounttype, 'account_code' => $accountcode, 'date' => $date, 'towhom' => $towhome, 'Supplier_id' => $supplier, 'invoice_no' => $invoiceno, '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, 'cashtype' => $option, 'bankid' => $bankid, 'totalbankamount' => $totalbankamount, 'balance' => $balance, 'gststatus' => (!empty($gsttoggle) ? '1' : '0'), 'amounttype' => $amounttype, 'IsActive' => $IsActive); //print_r($addincomexpense); //die(); 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; //$clearbalance=$totalbankamount- if ($amounttype == 'CREDIT') { $cashbookstatus1 = array('cclearbalance' => $ctotal, 'cbalancetocleared' => $updatecbalancetocleared, 'cstatus' => $statu, 'IsActive' => $isactive); //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); } $res = $this->cashbook_model->saveIncomeExpense($addincomexpense); if ($res == 1) { //echo ""; echo ""; if ($bankorcash == Bank) //Redirct To Listing Screen { redirect('Bankingstatement', 'refresh'); } else if ($bankorcash != ' ') //Redirct To Bank Report Screen { redirect('ViewIncomeExpense', 'refresh'); } } } public function cashpayment() { $bankdate = $this->request->getPost('bankdate'); $bankid = $this->request->getPost('bankid'); $amount = $this->request->getPost('bankamount'); $amounttype = $this->request->getPost('type'); $forstatus = $this->request->getPost('forstatus'); $alreadypaid = $this->request->getPost('alreadypaid'); $alreadycreditpaid = $this->request->getPost('alreadycreditpaid'); $debitamount = $this->request->getPost('debitamount'); $creditamount = $this->request->getPost('creditamount'); $total = $amount + $alreadypaid; $option = Bank; if ($amounttype == 0) { $type = RECEIPT; $bankamounttype = CREDIT; } else { $type = PAYMENT; $bankamounttype = DEBIT; } $bankcash1 = array('cdate' => $bankdate, 'mid' => $bankid, 'btype' => $type, 'amount' => $alreadypaid, 'boption' => $option, 'mappingamount' => $forstatus, 'totalamount' => $amount, 'amounttype' => $bankamounttype, 'alreadycreditpaid' => $alreadycreditpaid); //print_r($bankcash1); //die(); // $res1 = $this->cashbook_model->addcashbook($bankcash1); } function uploadFile() { //echo "INSIDE UPLOAFD"; //$this->load->library('upload') $pathinfo = pathinfo($_FILES['myfile']['name']); $config['upload_path'] = 'public/uploads/cashbook/'; $config['allowed_types'] = 'png|jpg|jpeg|pdf'; $config['file_name'] = $_FILES['myfile']['name']; // $config['overwrite'] = true; //Load upload library and initialize configuration $this->load->library('upload', $config); $this->upload->initialize($config); if ($this->upload->do_upload('myfile')) { $uploadData = $this->upload->data(); $uploadfilename = $uploadData['file_name']; return $uploadfilename; } else { $error = array('error' => $this->upload->display_errors()); $uploadfilename = ''; print_r($error); return 0; } } function uploadFile1() { //$this->load->library('upload') $pathinfo = pathinfo($_FILES['userfile']['name']); $config['upload_path'] = 'public/uploads/banking/'; // $config['allowed_types'] = 'png|jpg|jpeg|xlsx'; $config['allowed_types'] = '*'; $config['file_name'] = $_FILES['userfile']['name']; $config['overwrite'] = true; //Load upload library and initialize configuration $this->load->library('upload', $config); $this->upload->initialize($config); if ($this->upload->do_upload('userfile')) { $uploadData = $this->upload->data(); $uploadfilename = $uploadData['file_name']; return $uploadfilename; } else { $error = array('error' => $this->upload->display_errors()); $uploadfilename = ''; // print_r($error); return 0; } } function viewIE() { $uri = service('uri'); $aid = $uri->getSegment(3); $data['data'] = $this->cashbook_model->getAccounutInfo(); //print_r($data['dropdownvalues']);die(); $this->global['pageTitle'] = 'Cash Book: View Income Expense '; $this->loadViews("viewIndIncomeExpense", $this->global, $data, NULL); } public function index() { //$data['dropdownvalues1'] = $this->cashbook_model->getAccounTypes1(); $this->global['pageTitle'] = 'Cashbook Details'; $this->loadViews("cashbooklisting", $this->global, NULL, NULL); } public function cashbookList() { $this->cashbook_model = new cashbook_model(); $data['dropdownvalues1'] = $this->cashbook_model->getAccounTypes1(); //print_r($data['dropdownvalues1']); $data['cashbook'] = $this->cashbook_model->Selectcash(); $this->global['pageTitle'] = 'Cashbook Listing'; $this->loadViews("cashbooklisting", $this->global, $data, NULL); } //advance list public function AdvanceList() { $uri = service('uri'); $aid = $uri->getSegment(3); $str = $uri->getSegment(4); if (!empty($aid)) { if (!empty($str)) { //echo "PDF"; $data['company'] = $this->cashbook_model->getCompany(); $data['data'] = $this->cashbook_model->getAdvanceList($aid); //$pic1 = $data['company'][0]->ProfilePic; //echo $pic1; //$pic = base_url().'public/uploads/images'.$pic1; //echo $pic; //die(); $totalamt = $data['data'][0]->total; $data['amtinwords'] = $this->convertNumber($totalamt); $mpdf = new mPDF('utf-8', 'A4-P', 7, 10, 10, 10, 3, 0, 0, 0); $mpdf->SetHTMLHeader($HtmlHeading); $html = view('cashbookpdf', $data, true); $mpdf->SetDisplayMode('fullpage'); $mpdf->setFooter($HTMLFooter . "Page {PAGENO} of {nb}"); $mpdf->list_indent_first_level = 1; $mpdf->setAutoTopMargin = 'stretch'; $mpdf->setAutoBottomMargin = 'stretch'; $mpdf->WriteHTML($html); $filename = "cashbook.pdf"; $mpdf->Output($filename, I); } else { $data['data'] = $this->cashbook_model->getAdvanceList($aid); //print_r($data['dropdownvalues']);die(); $this->global['pageTitle'] = 'Cash Book: View Income Expense '; $this->loadViews("viewIndIncomeExpense", $this->global, $data, NULL); } } else { // $data['list'] = $this->cashbook_model->getIncomeExpenseList(); // $this->global['pageTitle'] = $this->CompanyName.' : Cash Book: Listing'; // $this->loadViews("income_expense_list", $this->global, $data , NULL); $this->global['pageTitle'] = 'Cash Book: Listing'; $data['finyear'] = $this->cashbook_model->finyear(); if ($this->request->getPost('btn_submit')) { $fromdt = $this->request->getPost('from_date'); $todt = $this->request->getPost('to_date'); $ab = $this->request->getPost('financialyear'); $fromyear = substr($ab, 0, -5); $toyear = substr($ab, 5, 5); $data['finyear'] = $this->cashbook_model->finyear(); $data['list'] = $this->cashbook_model->getAdvance($fromyear, $toyear, $fromdt, $todt); } // else{ // if (date('m') <= 3) { // $preyear = (date('Y')-1); // $currentyear = date('Y'); // } else { // $preyear = date('Y') ; // $currentyear = (date('Y') + 1); // } // $data['list'] = $this->cashbook_model->getAdvance($preyear,$currentyear); // $data['finyear']=$this->cashbook_model->finyear(); // } $this->loadViews("Advancelist", $this->global, $data, NULL); } } public function cashbookdtl() { $id = $this->request->getPost('id'); $tablevalue = json_decode($id, true); //print_r($tablevalue); foreach ($tablevalue as $tv) { if (!empty($tv['AccountCodeType'])) { $acc_type = $tv['AccountCodeType']; $acc_code = $tv['AccountCode']; $acc_name = $tv['AccountName']; $acc_pname = $tv['ParentAccountName']; $acc_categories = $tv['Categories']; $acc_desc = $tv['Description']; $acc_state = $tv['Status']; if (strtoupper($acc_state) == 'YES') { $acc_status = 1; } else { $acc_status = 0; } $acc_createddt = get_current_date_time(); $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); // print_r($cashbookdatas); $result = $this->cashbook_model->Cashbook($cashbookdatas); } } //redirect('cashbook/cashbookList','refresh'); echo "Successfully Saved!"; } public function editcashbook() { $sid = $this->input->get('sid'); if ($sid == '') { $cash = $_GET['sid']; } else { $cash = $sid; } $this->cashbook_model = new cashbook_model(); $data['DepDetails'] = $this->cashbook_model->viewdepartment($cash); //$data['deletefile'] = $this->cashbook-model->deletefile($cash); $data['dropdownvalues'] = $this->cashbook_model->getAccounTypes(); $data['getsupplier'] = $this->cashbook_model->getsupplier(); //print_r( $data['DepDetails']);die(); $this->global['pageTitle'] = 'Edit Cashbook'; $this->loadViews("editincomeexpenses", $this->global, $data, NULL); } public function deletefile() { $cashfile = $this->request->getPost('id'); $cashid = $this->request->getPost('ide'); //echo 'dsmkjsn'; //echo $cashid; //echo $cashfile; //die(); //$this->cashbook_model = new cashbook_model(); $filedata = $this->cashbook_model->deletefile($cashid); echo $filedata; //$this->global['pageTitle'] = $this->CompanyName.' : Edit Cashbook'; //$this->loadViews("income_expense_list", $this->global,$data, NULL); } function updateExpense() { $id1 = $this->request->getPost('id1'); $myradio1 = $this->request->getPost('myradio'); //$myradio2= $this->request->getPost('myrad'); $option = ''; if ($myradio1 == 1) { $option = RECEIPT; } else { $option = PAYMENT; } //echo $option;die(); $ans1 = $this->request->getPost('ans'); $Date1 = $this->request->getPost('Date'); //echo $Date1; $date = format_date($Date1);//3rd //echo $date; //$Date1 = $this->request->getPost('Date'); $accountcode1 = $this->request->getPost('accode'); //echo $accountcode1;die(); $towhome1 = $this->request->getPost('towhome'); $supplier = $this->request->getPost('supplier'); $Invoiceno1 = $this->request->getPost('Invoiceno'); $merchant1 = $this->request->getPost('merchant'); $Merchantgst1 = $this->request->getPost('Merchantgst'); $hsn1 = $this->request->getPost('hsn'); $valuebeforegST1 = $this->request->getPost('valuebeforegST'); $SGST1 = $this->request->getPost('SGST'); $CGST1 = $this->request->getPost('CGST'); $IGST1 = $this->request->getPost('IGST'); $totalamount1 = $this->request->getPost('totalamount'); $description1 = $this->request->getPost('description'); $deleteflag = $this->request->getPost('deleteflag'); $oldfile = $this->request->getPost('oldfile'); $amounttype = $this->request->getPost('amounttype'); $bankid = $this->request->getPost('bankid'); $normalid = $this->request->getPost('normalid'); $bankamount = $this->request->getPost('bankamount'); $gsttoggle = $this->request->getPost('gsttoggle'); $document = null; //$document1=$this->request->getPost('myfile'); $fs = 0; if (!empty($_FILES['myfile']['name'])) { //echo "FILE AVAILABLE"; $config['file_name'] = $_FILES['myfile']['name']; $config['upload_path'] = 'public/uploads/cashbook/'; $path = $config['upload_path']; //$filename = $config['file_name']; //$document = $path.$filename; //echo $document; $fs = $this->uploadFile(); $document = $path . $fs; } else { if ($deleteflag == 0) { $document = $oldfile; } else if ($deleteflag == 1) { $document = null; } } $updateaccount = array('type' => $option, 'account_code' => $accountcode1, '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, 'gststatus' => (!empty($gsttoggle) ? '1' : '0'), 'description' => $description1, 'document' => $document); $res = $this->cashbook_model->updatedepartment($updateaccount, $id1); //print_r($updateaccount);die(); $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, 'IsActive' => $isactive); // print_r($cashbookstatus); //die(); $res = $this->cashbook_model->cashbankupdate($cashbookstatus, $bankid); } //if( $res == 1 ){ echo ""; //} } public function bankdata() { $this->global['pageTitle'] = 'Bank Statement'; if ($this->request->getPost('btn_submit')) { $this->global['pageTitle'] = 'bankstatement'; $ab = $this->request->getPost('financialyear'); $fa = substr($ab, 0, -5); $aa = substr($ab, 5, 5); $fdate = $this->request->getPost('from_date'); $tdate = $this->request->getPost('to_date'); } $data['finyear'] = $this->cashbook_model->report_finyear(); $data['bankreport'] = $this->cashbook_model->bankstatement($fdate, $tdate, $fa, $aa); $this->loadViews("bankstatement", $this->global, $data, NULL); } public function bankdebitdata() { $this->global['pageTitle'] = 'Bank Debit Report'; if ($this->request->getPost('btn_submit')) { $SupplierName = $this->request->getPost('SupplierName'); $fdate = $this->request->getPost('from_date'); $tdate = $this->request->getPost('to_date'); //$data['cash'] = $_GET['sid']; //$data['bankid'] = $_GET['d']; $data['bankdepitpaid'] = $this->cashbook_model->debitbankstatemet($SupplierName, $fdate, $tdate); // print_r($data['bankdepitpaid']); } $data['getsupplier'] = $this->cashbook_model->getsupplier(); $this->loadViews("bankdebit", $this->global, $data, NULL); //die(); } public function bankinvoice() { $this->global['pageTitle'] = 'Bank Invoice Report'; if ($this->request->getPost('btn_submit')) { $Customer = $this->request->getPost('Customer'); $fdate = $this->request->getPost('from_date'); $tdate = $this->request->getPost('to_date'); $data['bankinvoicedata'] = $this->cashbook_model->bankinvoice($Customer, $fdate, $tdate); // $data['bankreceivedamount']= $this->cashbook_model->receivedamount($Customer,$fdate,$tdate); // print_r($data['bankreceivedamount']); //$data['supplier'] = $this->cashbook_model->getsupplier(); } $data['getcustomer'] = $this->cashbook_model->getcustomer(); $this->loadViews("bankinvoice", $this->global, $data, NULL); } function IGRFilelist() { $igrno = $this->request->getPost('igrno'); $pono = $this->request->getPost('pono'); // $igrsingle = $this->cashbook_model->igrmastersingle($igrno,$pono); $igrmultiple = $this->cashbook_model->igrmastermultiple($igrno, $pono); $data = array_merge($igrmultiple); echo json_encode($data); } /*end*/ public function filelist() { $igrno = $this->request->getPost('igrno'); $pono = $this->request->getPost('pono'); $data = $this->cashbook_model->debitimage($igrno, $pono); echo json_encode($data); } public function mappingpo() { $this->global['pageTitle'] = 'Bank Report - Debited Settlements'; $SupplierName = $this->request->getPost('SupplierName'); $fdate = $this->request->getPost('from_date'); $tdate = $this->request->getPost('to_date'); $bankid = $_GET['d']; $data['clearbalance'] = $_GET['clearbalance']; if ($data['clearbalance'] == 0) { echo ""; redirect('Bankingstatement', 'refresh'); } else { $data['balancetoclear'] = $_GET['balancetoclear']; $data['mappingcashbook'] = $this->cashbook_model->mappingcashbankid($bankid); $data['mapping'] = $this->cashbook_model->debitpolist($bankid); $data['paidcbook'] = $this->cashbook_model->cashbookamount($bankid); $data['paidpoamount'] = $this->cashbook_model->poamonut($bankid); $data['supplier'] = $this->cashbook_model->getsupplier(); $this->loadViews("banksettlement", $this->global, $data, NULL); } } public function mappinginvoice() { //$this->global['pageTitle'] = $this->CompanyName.' : Cashbook Listing'; $this->global['pageTitle'] = 'Bank Report - Credited Settlements'; $SupplierName = $this->request->getPost('SupplierName'); $fdate = $this->request->getPost('from_date'); $tdate = $this->request->getPost('to_date'); $bankid = $_GET['d']; $data['clearbalance'] = $_GET['cb']; $data['balancetoclear'] = $_GET['btc']; $data['mappingiv'] = $this->cashbook_model->creditinvoicelist($bankid); //print_r($data['mappingiv']); $data['invoiceramount'] = $this->cashbook_model->invoiceamonut($bankid); $data['mappingcashbook'] = $this->cashbook_model->mappingcashcreditbankid($bankid); $data['paidcbook'] = $this->cashbook_model->cashbookamount($bankid); $data['supplier'] = $this->cashbook_model->getsupplier(); //redirect('Bankingstatement','refresh'); $this->loadViews("bankinvoicesettlement", $this->global, $data, NULL); } public function mappingdebit() { // $this->global['pageTitle'] = $this->CompanyName.' : mappingdebit'; $this->global['pageTitle'] = 'Bank Report - Debited Details'; $SupplierName = $this->request->getPost('SupplierName'); $fdate = $this->request->getPost('from_date'); $tdate = $this->request->getPost('to_date'); $pono = $_GET['sid']; $data['debitmapping'] = $this->cashbook_model->debitlistpo($pono); $this->loadViews("bankposettlement", $this->global, $data, NULL); } public function mappingcredit() { // $this->global['pageTitle'] = $this->CompanyName.' : mappingcredit'; $this->global['pageTitle'] = 'Bank Report - Credited Details '; $SupplierName = $this->request->getPost('SupplierName'); $fdate = $this->request->getPost('from_date'); $tdate = $this->request->getPost('to_date'); $invno = $_GET['sid']; $data['creditmapping'] = $this->cashbook_model->creditlistinv($invno); $this->loadViews("bankinvoisettle", $this->global, $data, NULL); } public function receipt() { $this->global['pageTitle'] = 'Bank Report - Store Debited Details'; $check = $this->request->getPost('check'); // echo 'check'.$check; $rw = $this->request->getPost('rw'); // echo 'rw'.$rw; $date = $this->request->getPost('podate'); $date = format_date($date);//3rd $bankdate = $this->request->getPost('bankdate'); $bankdate = format_date($bankdate);//3rd $pono = $this->request->getPost('pono'); $igrno = $this->request->getPost('igrno'); $sname = $this->request->getPost('sname'); $sid = $this->request->getPost('sid'); $tot = $this->request->getPost('tot'); //$now = date('Y-m-d H:i:s'); $rowcount = $this->request->getPost('rc'); $totalpaidamount = $this->request->getPost('tpv'); //echo 'totalpaidamount'.$totalpaidamount; $bankdebitamountamount = $this->request->getPost('bda'); //echo 'bankdebitamountamount'.$bankdebitamountamount; $bankid = $this->request->getPost('bi'); $alreadypaid = 0; //echo $earlypaid; $alreadypaid = $this->cashbook_model->getalreadypaid($bankid); if (empty($alreadypaid)) { $aPay = 0; } else { foreach ($alreadypaid as $ap) { $aPay = $ap->Clearbalance; } } // echo 'apay',$apay; if ($check == 1) { $clearedblnce = ($totalpaidamount + $aPay); //echo 'clearbalance'.$clearedblnce; $balancetocleared = ($bankdebitamountamount - $totalpaidamount); $check = 1; } //echo 'Balancetocleared'.$balancetocleared; //die(); if ($balancetocleared > 0) { $status = 'OPEN'; } else { $status = 'CLOSE'; } $active = 1; $bankdata = array('Clearbalance' => $clearedblnce, 'Balancetocleared' => $balancetocleared, 'Status' => $status, 'IsActive' => $active); if ($check == 1) { $res = $this->cashbook_model->bankupdate($bankdata, $bankid); } $earlypaid = 0; //echo $earlypaid; $earlypaid = $this->cashbook_model->getearlyamount($igrno); if (empty($earlypaid)) { $ePay = 0; } else { foreach ($earlypaid as $ep) { $ePay = $ep->Amountpaid; } } //echo 'epay'.$epay; $ip = $this->request->getPost('aa'); $balancetopay = ($tot - ($ip + $ePay)); $amtpaid = ($ip + $ePay); $IsActive = 1; $igrdata1 = array('Podate' => $date, 'PONO' => $pono, 'IGRNO' => $igrno, 'Suppliername' => $sname, 'SupplierID' => $sid, 'Totalpoamount' => $tot, 'Amountpaid' => $ip, 'Balancetopay' => $balancetopay, 'mid' => $bankid, 'IsActive' => $IsActive, 'BankDate' => $bankdate); $resultn = $this->cashbook_model->mappingpo($igrdata1); //print_r($podata1); $igrdata = array('Podate' => $date, 'PONO' => $pono, 'IGRNO' => $igrno, 'Suppliername' => $sname, 'SupplierID' => $sid, 'Totalpoamount' => $tot, 'Amountpaid' => $amtpaid, 'Balancetopay' => $balancetopay, 'mid' => $bankid, 'IsActive' => $IsActive, 'BankDate' => $bankdate); //die(); $result3 = $this->cashbook_model->getigrno($igrno); if (count($result3) <= 0) { $result = $this->cashbook_model->bankporeportdata($igrdata); } else { //echo "update"; $result3 = $this->cashbook_model->bankporeportupdate($igrdata, $igrno); } if ($rw == $rowcount) { echo "Saved Successfully!"; } $now = date('Y-m-d H:i:s'); if ($balancetopay == 0) { $igrpaidstatus = AMOUNT_PAIDIGR; } else { $igrpaidstatus = PARTIALLY_PAIDIGR; } $igrmaster = array('Paymentstatus' => $igrpaidstatus, 'StatusUpdatedDate' => $now); //$podetails=array('Paymentstatus'=>$postatus); //$result1 = $this->cashbook_model->igrdetailstatus($podetails,$pono); $result1 = $this->cashbook_model->igrstatus($igrmaster, $igrno); $this->loadViews("bankstatement", $this->global, $data, NULL); } public function invoiceamount1() { //$this->global['pageTitle'] = $this->CompanyName.' : Cashbook Listing'; $this->global['pageTitle'] = 'Bank Report - Store Credited Details'; $check = $this->request->getPost('check'); $rw = $this->request->getPost('rw'); $date = $this->request->getPost('date'); $date = format_date($date);//3rd $invid = $this->request->getPost('invid'); $cname = $this->request->getPost('cname'); $cid = $this->request->getPost('cid'); $invamount = $this->request->getPost('invamount'); $invoicereceived = $this->request->getPost('ir'); $rowcount = $this->request->getPost('rc'); $totalpaidamount = $this->request->getPost('tpv'); $bankcreditamount = $this->request->getPost('bda'); $invoicetext = $this->request->getPost('invrec'); $bankid = $this->request->getPost('bi'); $bankdate = $this->request->getPost('bankdate'); $bankdate = format_date($bankdate);//3rd $alreadyreceived = 0; //echo $earlypaid; $alreadyreceived = $this->cashbook_model->getalreadyreceived($bankid); if (empty($alreadyreceived)) { $arec = 0; } else { foreach ($alreadyreceived as $ar) { $arec = $ar->cclearbalance; } } if ($check == 1) { //echo $arec; if ($totalpaidamount > 0) { $clearedblnce = ($totalpaidamount + $arec); } else { $clearedblnce = $totalpaidamount + $arec; } $balancetoreceived = ($bankcreditamount - $totalpaidamount); $check = 1; } //echo $balancetocleared; //die(); if ($balancetoreceived > 0) { $status = 'OPEN'; } else { $status = 'CLOSE'; } $active = 1; $bankdata = array('cclearbalance' => $clearedblnce, 'cbalancetocleared' => $balancetoreceived, 'cstatus' => $status, 'IsActive' => $active); if ($check == 1) { $res = $this->cashbook_model->bankcreditupdate($bankdata, $bankid); } $earlyreceived = 0; //echo $earlypaid; $earlyreceived = $this->cashbook_model->getearlyamountcredit($invid); //$earlyreceivedmappingiv = $this->cashbook_model->getearlymappingiv($invid);//new change // if(empty($earlyreceivedmappingiv)) // { // $eRec1=0; // } // else // { // foreach($earlyreceived as $ar) // { // $eRec1 = $ar->amountreceived; // } // $updatenew=($invamount-($eRec1+$invoicetext)); // } // echo $earlyreceivedmappingiv; // die(); if (empty($earlyreceived)) { $eRec = 0; } else { foreach ($earlyreceived as $ec) { $eRec = $ec->amountreceived; } } //echo $eRec; $ip = $this->request->getPost('ar'); $balancetoreceived1 = ($invamount - ($ip + $eRec)); $amtpaid = ($ip + $eRec); $updateamount = ($totalpaidamount + $eRec); $IsActive = 1; $invoicedata1 = array('indate' => $date, 'invoiceno' => $invid, 'customername' => $cname, 'customerid' => $cid, 'totinvoiceamount' => $invamount, 'balancetoreceived' => $balancetoreceived1, 'amountreceived' => $amtpaid, 'bankid' => $bankid, 'IsActive' => $IsActive, 'BankDate' => $bankdate); $invoicedata = array('indate' => $date, 'invoiceno' => $invid, 'customername' => $cname, 'customerid' => $cid, 'totinvoiceamount' => $invamount, 'balancetoreceived' => $balancetoreceived1, 'amountreceived' => $ip, 'bankid' => $bankid, 'IsActive' => $IsActive, 'BankDate' => $bankdate); // //print_r ($invoicedata); // //die(); $result3 = $this->cashbook_model->invoiceupdate($invid); $resultn = $this->cashbook_model->mappinginvoice($invoicedata); if (count($result3) <= 0) { //echo "insert"; $result = $this->cashbook_model->invoicedata($invoicedata1); } else { //echo "update"; $result3 = $this->cashbook_model->invoiceupdate1($invoicedata1, $invid); } $now = date('Y-m-d H:i:s'); if ($balancetoreceived1 == 0) { $status = AMOUNT_RECEIVED; } else { $status = PARTIALLY_RECEIVED; } $invoicemaster = array('receivedstatus' => $status, 'StatusUpdatedDate' => $now); $result1 = $this->cashbook_model->invoiceamountstatus($invoicemaster, $invid); echo ""; } public function amountpaid() { $this->global['pageTitle'] = 'Bank Report - Amount Payment Details'; //$suppliername= $_GET['sid']; if ($this->request->getPost('btn_submit')) { $ab = $this->request->getPost('financialyear'); $fa = substr($ab, 0, -5); $aa = substr($ab, 5, 5); $m = $this->request->getPost('month'); $fdate = $this->request->getPost('from_date'); $tdate = $this->request->getPost('to_date'); $supplierID = $this->request->getPost('supplier'); $data['supplierid'] = $supplierID; $suppliername = $this->request->getPost('suppliername'); $data['suppliername'] = $suppliername; $data['fa'] = $fa; $data['aa'] = $aa; $data['m'] = $m; $data['fdate'] = $fdate; $data['tdate'] = $tdate; $data['suppliername'] = $suppliername; $data['bankdebit'] = $this->cashbook_model->debitpolistfilter($supplierID, $fa, $aa, $m, $fdate, $tdate); //print_r($data['bankdebit']); } else { $fa = $_GET['fa']; $aa = $_GET['aa']; $m = $_GET['m']; $fdate = $_GET['fdate']; $tdate = $_GET['tdate']; $data['fa'] = $fa; $data['aa'] = $aa; $data['m'] = $m; $data['fdate'] = $fdate; $data['tdate'] = $tdate; $supplierid = $_GET['sid']; $data['supplierid'] = $supplierid; $suppliername = $_GET['sn']; $data['suppliername'] = $suppliername; $data['bankdebit'] = $this->cashbook_model->paided($supplierid, $fa, $aa, $m, $fdate, $tdate); } $data['finyear'] = $this->cashbook_model->report_amountpaid(); $this->loadViews("bankamountpaid", $this->global, $data, NULL); } public function amountpaidcashbook() { $this->global['pageTitle'] = 'Bank Report - Amount Payment Details'; //$suppliername= $_GET['sid']; if ($this->request->getPost('btn_submit')) { $ab = $this->request->getPost('financialyear'); $fa = substr($ab, 0, -5); $aa = substr($ab, 5, 5); $m = $this->request->getPost('month'); $fdate = $this->request->getPost('from_date'); $tdate = $this->request->getPost('to_date'); $accountcode = $this->request->getPost('accountcode'); $data['accountcode'] = $accountcode; $accountname = $this->request->getPost('accountname'); $data['accountname'] = $accountname; $data['fa'] = $fa; $data['aa'] = $aa; $data['m'] = $m; $data['fdate'] = $fdate; $data['tdate'] = $tdate; $data['bankmappingcash'] = $this->cashbook_model->mappingcashfilter($accountcode, $fa, $aa, $m, $fdate, $tdate); } else { $fa = $_GET['fa']; $aa = $_GET['aa']; $m = $_GET['m']; $fdate = $_GET['fdate']; $tdate = $_GET['tdate']; $accountcode = $_GET['ac']; $data['accountcode'] = $accountcode; $accountname = $_GET['an']; $data['accountname'] = $accountname; $data['fa'] = $fa; $data['aa'] = $aa; $data['m'] = $m; $data['fdate'] = $fdate; $data['tdate'] = $tdate; $data['bankmappingcash'] = $this->cashbook_model->mappingcash($accountcode, $fa, $aa, $m, $fdate, $tdate); } $data['finyear'] = $this->cashbook_model->report_cashbook(); $this->loadViews("banksettlementcash", $this->global, $data, NULL); } public function amountreceivedcashbook() { $this->global['pageTitle'] = 'Bank Report - Amount Payment Details'; //$suppliername= $_GET['sid']; if ($this->request->getPost('btn_submit')) { $ab = $this->request->getPost('financialyear'); $fa = substr($ab, 0, -5); $aa = substr($ab, 5, 5); $m = $this->request->getPost('month'); $fdate = $this->request->getPost('from_date'); $tdate = $this->request->getPost('to_date'); $accountcode = $this->request->getPost('accountcode'); $data['accountcode'] = $accountcode; $accountname = $this->request->getPost('accountname'); $data['accountname'] = $accountname; $data['fa'] = $fa; $data['aa'] = $aa; $data['m'] = $m; $data['fdate'] = $fdate; $data['tdate'] = $tdate; $data['bankmappingcashreceived'] = $this->cashbook_model->mappingcashreceivedfilter($accountcode, $fa, $aa, $m, $fdate, $tdate); } else { $fa = $_GET['fa']; $aa = $_GET['aa']; $m = $_GET['m']; $fdate = $_GET['fdate']; $tdate = $_GET['tdate']; $accountcode = $_GET['ac']; $data['accountcode'] = $accountcode; $accountname = $_GET['an']; $data['accountname'] = $accountname; $data['fa'] = $fa; $data['aa'] = $aa; $data['m'] = $m; $data['fdate'] = $fdate; $data['tdate'] = $tdate; $data['bankmappingcashreceived'] = $this->cashbook_model->mappingcashreceived($accountcode, $fa, $aa, $m, $fdate, $tdate); } $data['finyear'] = $this->cashbook_model->report_cashbook(); $this->loadViews("banksettlementcredit", $this->global, $data, NULL); } public function amountreceivednew() { //$this->global['pageTitle'] = $this->CompanyName.' : amountpaid'; $this->global['pageTitle'] = 'Bank Report - Amount Payment Details'; if ($this->request->getPost('btn_submit')) { $SupplierName = $this->request->getPost('SupplierName'); $fdate = $this->request->getPost('from_date'); $tdate = $this->request->getPost('to_date'); $data['bankreceivable'] = $this->cashbook_model->creditinvoicewisefilter($SupplierName, $fdate, $tdate); } else { $suppliername = $_GET['sid']; $data['bankreceivable'] = $this->cashbook_model->creditinvoicesupplierwise($suppliername); } $data['supplier'] = $this->cashbook_model->getsupplier(); // $this->loadViews("bankpaidsupp", $this->global,$data, NULL); $this->loadViews("bankamountreceived", $this->global, $data, NULL); } public function amountpaidsupplier() { //$this->global['pageTitle'] = $this->CompanyName.' : amountpaid'; $this->global['pageTitle'] = 'Bank Report - Amount Payment Details'; if ($this->request->getPost('btn_submit')) { $ab = $this->request->getPost('financialyear'); $fa = substr($ab, 0, -5); $aa = substr($ab, 5, 5); $m = $this->request->getPost('month'); $fdate = $this->request->getPost('from_date'); $tdate = $this->request->getPost('to_date'); $data['ab'] = $ab; $data['fa'] = $fa; $data['aa'] = $aa; $data['m'] = $m; $data['fdate'] = $fdate; $data['tdate'] = $tdate; $data['bankdebitsupp'] = $this->cashbook_model->amountpaidsupplierwisefilter($fa, $aa, $m, $fdate, $tdate); $data['amountpaidcashbook'] = $this->cashbook_model->amountpaidcashbookfilter($fa, $aa, $m, $fdate, $tdate); } // else // { // $data['bankdebitsupp'] = $this->cashbook_model->amountpaidsupplierwise(); // $data['amountpaidcashbook']=$this->cashbook_model->amountpaidcashbook(); // } $data['finyear'] = $this->cashbook_model->report_amountpaid(); $data['supplier'] = $this->cashbook_model->getsupplier(); $this->loadViews("bankpaidsupp", $this->global, $data, NULL); //$this->loadViews("bankamountpaid", $this->global,$data, NULL); } // function supplierledger() // { // $this->global['pageTitle'] = $this->CompanyName.' : Bank Report - Amount Payment Details'; // //$suppliername= $_GET['sid']; // if ($this->request->getPost('btn_submit')) // { // $ab=$this->request->getPost('financialyear'); // $fa=substr($ab,0,-5); // $aa=substr($ab,5,5); // $m=$this->request->getPost('month'); // $fdate = $this->request->getPost('from_date'); // $tdate = $this->request->getPost('to_date'); // $supplierID= $this->request->getPost('supplier'); // $data['supplierid']=$supplierID; // $suppliername= $this->request->getPost('suppliername'); // $data['suppliername']=$suppliername; // $data['fa']=$fa; // $data['aa']=$aa; // $data['m']=$m; // $data['fdate']=$fdate; // $data['tdate']=$tdate; // $data['suppliername']= $suppliername; // $data['bankdebit'] = $this->cashbook_model->debitpolistfilter($supplierID,$fa,$aa,$m,$fdate,$tdate); // //print_r($data['bankdebit']); // } // else // { // $fa=$_GET['fa']; // $aa=$_GET['aa']; // $m=$_GET['m']; // $fdate=$_GET['fdate']; // $tdate=$_GET['tdate']; // $data['fa']=$fa; // $data['aa']=$aa; // $data['m']=$m; // $data['fdate']=$fdate; // $data['tdate']=$tdate; // $supplierid= $_GET['sid']; // $data['supplierid']= $supplierid; // $suppliername= $_GET['sn']; // $data['suppliername']=$suppliername; // $data['bankdebit'] = $this->cashbook_model->paided($supplierid,$fa,$aa,$m,$fdate,$tdate); // } // $data['finyear']=$this->cashbook_model->report_amountpaid(); // $this->loadViews("banksupplierledger", $this->global,$data, NULL); // } function supplierledger() { $this->global['pageTitle'] = 'Bank Report - Amount Payment Details'; //$suppliername= $_GET['sid']; if ($this->request->getPost('btn_submit')) { $ab = $this->request->getPost('financialyear'); $fa = substr($ab, 0, -5); $aa = substr($ab, 5, 5); $m = $this->request->getPost('month'); $fdate = $this->request->getPost('from_date'); $tdate = $this->request->getPost('to_date'); $supplierID = $this->request->getPost('supplier'); $data['supplierid'] = $supplierID; $suppliername = $this->request->getPost('SupplierName'); $data['suppliername'] = $suppliername; $data['fa'] = $fa; $data['aa'] = $aa; $data['m'] = $m; $data['fdate'] = $fdate; $data['tdate'] = $tdate; $data['suppliername'] = $suppliername; $data['supplierledger'] = $this->cashbook_model->supplierledger($suppliername, $fdate, $tdate, $fa, $aa, $m); $data['openingbalancesupplier'] = $this->cashbook_model->openingbalancesupplier($customer, $fdate, $tdate, $fa, $aa, $m); //print_r($data['supplierledger']); } $data['finyear'] = $this->cashbook_model->report_amountpaid(); $data['getsupplier'] = $this->cashbook_model->getsupplier(); $this->loadViews("banksupplierledger", $this->global, $data, NULL); } function customerledger() { $this->global['pageTitle'] = 'Bank Report - Amount Payment Details'; //$suppliername= $_GET['sid']; if ($this->request->getPost('btn_submit')) { $ab = $this->request->getPost('financialyear'); $fa = substr($ab, 0, -5); $aa = substr($ab, 5, 5); $m = $this->request->getPost('month'); $fdate = $this->request->getPost('from_date'); $tdate = $this->request->getPost('to_date'); $supplierID = $this->request->getPost('supplier'); $data['supplierid'] = $supplierID; $customer = $this->request->getPost('Customer'); $data['suppliername'] = $suppliername; $data['fa'] = $fa; $data['aa'] = $aa; $data['m'] = $m; $data['fdate'] = $fdate; $data['tdate'] = $tdate; $data['customername'] = $Customer; $data['customerledger'] = $this->cashbook_model->customerledger($customer, $fdate, $tdate, $fa, $aa, $m); $data['openingbalance'] = $this->cashbook_model->openingbalance($customer, $fdate, $tdate, $fa, $aa, $m); } $data['finyear'] = $this->cashbook_model->report_amountpaid(); $data['getcustomer'] = $this->cashbook_model->getcustomer(); $this->loadViews("bankcustomerledger", $this->global, $data, NULL); } public function amountunpaid() { $this->global['pageTitle'] = 'Bank Debit Report'; if ($this->request->getPost('btn_submit')) { $ab = $this->request->getPost('financialyear'); $fa = substr($ab, 0, -5); $aa = substr($ab, 5, 5); $m = $this->request->getPost('month'); $fdate = $this->request->getPost('from_date'); $tdate = $this->request->getPost('to_date'); $data['ab'] = $ab; $data['fa'] = $fa; $data['aa'] = $aa; $data['m'] = $m; $data['fdate'] = $fdate; $data['tdate'] = $tdate; $data['bankunpaid'] = $this->cashbook_model->suppliertotalfilter($fa, $aa, $m, $fdate, $tdate); } $data['finyear'] = $this->cashbook_model->report_finyearunpaid(); $data['getsupplier'] = $this->cashbook_model->getsupplier(); $this->loadViews("bankunpaidsupp", $this->global, $data, NULL); } public function supplierwise() { $this->global['pageTitle'] = 'Bank Debit Report'; //$sd=$this->request->getPost('supplierid'); if ($this->request->getPost('btn_submit')) { $ab = $this->request->getPost('financialyear'); $fa = substr($ab, 0, -5); $aa = substr($ab, 5, 5); $m = $this->request->getPost('month'); $fdate = $this->request->getPost('from_date'); $tdate = $this->request->getPost('to_date'); $sd = $this->request->getPost('supplier'); $data['suppliername'] = $sd; $data['fa'] = $fa; $data['aa'] = $aa; $data['m'] = $m; $data['fdate'] = $fdate; $data['tdate'] = $tdate; $data['bankunpaid'] = $this->cashbook_model->amountunpaidfilter($sd, $fa, $aa, $m, $fdate, $tdate); } else { $supplierid1 = $_GET['sid']; $fa = $_GET['fa']; $aa = $_GET['aa']; $m = $_GET['m']; $fdate = $_GET['fdate']; $tdate = $_GET['tdate']; $data['fa'] = $fa; $data['aa'] = $aa; $data['m'] = $m; $data['fdate'] = $fdate; $data['tdate'] = $tdate; $data['suppliername'] = $supplierid1; $data['bankunpaid'] = $this->cashbook_model->amountunpaid($supplierid1, $fa, $aa, $m, $fdate, $tdate); } $data['finyear'] = $this->cashbook_model->report_finyearunpaid(); // $data['getsupplier'] = $this->cashbook_model->getsupplier(); $this->loadViews("bankamountunpaid", $this->global, $data, NULL); //die(); } public function amountreceived() { // $this->cashbook_model = new cashbook_model(); //$this->global['pageTitle'] = $this->CompanyName.' : Cashbook Listing'; $this->global['pageTitle'] = 'Bank Report - Received Amount Details'; if ($this->request->getPost('btn_submit')) { $ab = $this->request->getPost('financialyear'); $fa = substr($ab, 0, -5); $aa = substr($ab, 5, 5); $m = $this->request->getPost('month'); $fdate = $this->request->getPost('from_date'); $tdate = $this->request->getPost('to_date'); $clientname = $this->request->getPost('customer'); $data['clientname'] = $clientname; $clientid = $this->request->getPost('clientid'); $data['clientid'] = $clientid; $data['fa'] = $fa; $data['aa'] = $aa; $data['m'] = $m; $data['fdate'] = $fdate; $data['tdate'] = $tdate; $data['amountreceived'] = $this->cashbook_model->creditinvoicelistfilter($clientid, $fdate, $tdate, $fa, $aa, $m); } else { $fa = $_GET['fa']; $aa = $_GET['aa']; $m = $_GET['m']; $fdate = $_GET['fdate']; $tdate = $_GET['tdate']; $clientid = $_GET['sid']; $data['clientid'] = $clientid; $cname = $_GET['cname']; $data['clientname'] = $cname; $data['fa'] = $fa; $data['aa'] = $aa; $data['m'] = $m; $data['fdate'] = $fdate; $data['tdate'] = $tdate; $data['amountreceived'] = $this->cashbook_model->received($clientid, $fdate, $tdate, $fa, $aa, $m); } $data['finyear'] = $this->cashbook_model->report_finyearamountreceived(); $data['getcustomer'] = $this->cashbook_model->getcustomer(); $this->loadViews("bankamountreceived", $this->global, $data, NULL); } public function bankreceivedsupp() { $this->global['pageTitle'] = 'Bank Report - Received Amount Details supplierwise'; if ($this->request->getPost('btn_submit')) { $ab = $this->request->getPost('financialyear'); $fa = substr($ab, 0, -5); $aa = substr($ab, 5, 5); $m = $this->request->getPost('month'); //$Customer = $this->request->getPost('CustomerName'); $fdate = $this->request->getPost('from_date'); $tdate = $this->request->getPost('to_date'); $data['fa'] = $fa; $data['aa'] = $aa; $data['m'] = $m; $data['fdate'] = $fdate; $data['tdate'] = $tdate; $data['amountreceivedsupplier'] = $this->cashbook_model->creditinvoicewisefilter($fdate, $tdate, $fa, $aa, $m); $data['amountpaidcashbook'] = $this->cashbook_model->amountreceivedcashbookfilter($fa, $aa, $m, $fdate, $tdate); } else { $data['amountreceivedsupplier'] = $this->cashbook_model->creditinvoicesupplierwise(); $data['amountpaidcashbook'] = $this->cashbook_model->amountreceivedcashbook(); } $data['finyear'] = $this->cashbook_model->report_finyearamountreceived(); $data['getcustomer'] = $this->cashbook_model->getcustomer(); $this->loadViews("bankreceivedsupp", $this->global, $data, NULL); } public function bankunreceivedsupp() { $this->global['pageTitle'] = 'Bank Report - Received Amount Details supplierwise'; if ($this->request->getPost('btn_submit')) { $ab = $this->request->getPost('financialyear'); $fa = substr($ab, 0, -5); $aa = substr($ab, 5, 5); $m = $this->request->getPost('month'); $fdate = $this->request->getPost('from_date'); $tdate = $this->request->getPost('to_date'); $data['fa'] = $fa; $data['aa'] = $aa; $data['m'] = $m; $data['fdate'] = $fdate; $data['tdate'] = $tdate; $data['amountunreceivedsupplier'] = $this->cashbook_model->uncreditinvoicewisefilter($fdate, $tdate, $fa, $aa, $m); } else { $data['amountunreceivedsupplier'] = $this->cashbook_model->unreceivedsupplier(); } $data['finyear'] = $this->cashbook_model->report_finyearamountunreceived(); $data['getcustomer'] = $this->cashbook_model->getcustomer(); $this->loadViews("bankunreceivedsupp", $this->global, $data, NULL); } public function amountunreceived() { // $this->cashbook_model = new cashbook_model(); //$this->global['pageTitle'] = $this->CompanyName.' : Cashbook Listing'; $this->global['pageTitle'] = 'Bank Report - Received Amount Details'; if ($this->request->getPost('btn_submit')) { $ab = $this->request->getPost('financialyear'); $fa = substr($ab, 0, -5); $aa = substr($ab, 5, 5); $m = $this->request->getPost('month'); $fdate = $this->request->getPost('from_date'); $tdate = $this->request->getPost('to_date'); $client = $this->request->getPost('client'); $data['client'] = $client; $data['fa'] = $fa; $data['aa'] = $aa; $data['m'] = $m; $data['fdate'] = $fdate; $data['tdate'] = $tdate; $data['amountunreceived'] = $this->cashbook_model->uncreditinvoicelistfilter($client, $fdate, $tdate, $fa, $aa, $m); } else { $fa = $_GET['fa']; $aa = $_GET['aa']; $m = $_GET['m']; $fdate = $_GET['fdate']; $tdate = $_GET['tdate']; $clientname = $_GET['sid']; $data['client'] = $clientname; $data['fa'] = $fa; $data['aa'] = $aa; $data['m'] = $m; $data['fdate'] = $fdate; $data['tdate'] = $tdate; $data['amountunreceived'] = $this->cashbook_model->unreceived($clientname, $fdate, $tdate, $fa, $aa, $m); } $data['finyear'] = $this->cashbook_model->report_finyearamountunreceived(); $data['getcustomer'] = $this->cashbook_model->getcustomer(); $this->loadViews("bankamountunreceived", $this->global, $data, NULL); } public function cashbanking() { $this->global['pageTitle'] = 'bankcashbook'; $data['dropdownvalues'] = $this->cashbook_model->getAccounTypes(); //$data['cashbanking'] = $this->cashbook_model->newcashbook(); $data['getsupplier'] = $this->cashbook_model->getsupplier(); $this->loadViews("bankcashnew", $this->global, $data, NULL); } public function Deletemappingporeport() { $totalamount = $this->request->getPost('Totalpoamount'); $Amount = $this->request->getPost('paidamount'); $id = $this->request->getPost('mappingid'); $igrno = $this->request->getPost('igrno'); $pono = $this->request->getPost('pono'); $Bankid = $this->request->getPost('bankid'); $balancetoclear = $this->request->getPost('balancetobankingclear'); $clearedbalance = $this->request->getPost('clearbalance'); $updateamount = $clearedbalance - $Amount; $updatebalancetoclear = $Amount + $balancetoclear; $data['$bankmappingamount'] = $this->cashbook_model->gettotalbankmappingpo($id); $amountpaid = $data['$bankmappingamount'][0]->Amountpaid; $data['$bankmappingamountcount'] = $this->cashbook_model->gettotalbankmappingpocount($igrno); $count = $data['$bankmappingamountcount'][0]->countAmountpaid; //$data['$totallineitemamount']=$this->cashbook_model->gettotallineitem($igrno); if ($count == 1) { $PaymentStatus = NO_PAIDIGR; } else { $PaymentStatus = PARTIALLY_PAIDIGR; } $result = $this->cashbook_model->IGRStatusUpdate($igrno, $PaymentStatus); $Status = OPEN; $result1 = $this->cashbook_model->deletemapping($Bankid, $updateamount, $updatebalancetoclear, $Status); //for update mapping amount in t_bankmappingpo table// $balancetopay = $this->request->getPost('balancetopay'); $totalbalancetopay = $Amount + $balancetopay; $updatebankpoamount = $totalamount - $totalbalancetopay; //$updateamount=0; $IsActive = 0; $result2 = $this->cashbook_model->deleteBankmappingpo($id, $IsActive); $data['$poreportamount'] = $this->cashbook_model->gettotalbankpoamount($igrno); $amountpaidpo = $data['$poreportamount'][0]->Amountpaid; $balancetopaypo = $data['$poreportamount'][0]->Balancetopay; $amountpaidupdate = ($amountpaidpo) - ($Amount); $balancetopayupdate = ($balancetopaypo) + ($Amount); if ($amountpaidupdate == 0) { $IsAct = 0; } else { $IsAct = 1; } $result3 = $this->cashbook_model->updateBankporeport($igrno, $balancetopayupdate, $amountpaidupdate, $IsAct); $this->loadViews("bankstatement", $this->global, $data, NULL); } public function Deletemappingpo() { $totalamount = $_GET['totalpoamount']; //totalpoamount $Bankid = $_GET['bankid']; $Amount = $_GET['amount']; //paid amount $igrno = $_GET['igrno']; $balancetoclear = $_GET['balancetoclear']; //for T_Bankreport IsActive// $bankdebit = $_GET['debit']; $mapped = $Amount + $balancetoclear; $id = $_GET['id']; $bankamount = $_GET['bankamount']; $updateamount = $bankamount - $Amount; $updatebalancetoclear = $Amount + $balancetoclear; $data['$bankmappingamount'] = $this->cashbook_model->gettotalbankmappingpo($id); $amountpaid = $data['$bankmappingamount'][0]->Amountpaid; $data['$bankmappingamountcount'] = $this->cashbook_model->gettotalbankmappingpocount($igrno); $count = $data['$bankmappingamountcount'][0]->countAmountpaid; if ($count == 1) { $PaymentStatus = NO_PAIDIGR; } else { $PaymentStatus = PARTIALLY_PAIDIGR; } $result = $this->cashbook_model->IGRStatusUpdate($igrno, $PaymentStatus); $Status = OPEN; $result1 = $this->cashbook_model->deletemapping($Bankid, $updateamount, $updatebalancetoclear, $Status); //for update mapping amount in t_bankreport table// $balancetopay = $_GET['balancetopay']; //balancetopay $totalbalancetopay = $Amount + $balancetopay; $IsActive = 0; $updatebankpoamount = $totalamount - $totalbalancetopay; $result2 = $this->cashbook_model->deleteBankmappingpo($id, $IsActive); //$result3= $this->cashbook_model->updatemappingamount($igrno,$amountpaid); $data['$poreportamount'] = $this->cashbook_model->gettotalbankpoamount($igrno); $amountpaidpo = $data['$poreportamount'][0]->Amountpaid; $balancetopay = $data['$poreportamount'][0]->Balancetopay; $amountpaidupdate = $amountpaidpo - $Amount; $balancetopayupdate = $balancetopay + $Amount; //die(); if ($amountpaidupdate == 0) { $IsAct = 0; } else { $IsAct = 1; } $result3 = $this->cashbook_model->updateBankporeport($igrno, $balancetopayupdate, $amountpaidupdate, $IsAct); if (count($result3) > 0) { redirect('Bankingstatement', 'refresh'); } } public function deletemappingiv() { $this->global['pageTitle'] = 'Bank Report - Delete Mapping Invoice'; $credit = $this->request->getPost('credit'); $invoiceno = $this->request->getPost('invoiceno'); $bankid = $this->request->getPost('bankid'); $mappingid = $this->request->getPost('mappingid'); $amountreceived = $this->request->getPost('amountreceived'); $bankingclear = $this->request->getPost('bankingclear'); $bankingbalclear = $this->request->getPost('bankingbalclear'); $totinvoiceamount = $this->request->getPost('totinvoiceamount'); $balancetoreceived = $this->request->getPost('balancetoreceived'); $updatebalancetoclear = $amountreceived + $bankingbalclear; if ($amountreceived < 0) { $updateclearbalance = $bankingclear - ($amountreceived); //450-(-250) } else { $updateclearbalance = $bankingclear - $amountreceived; //450-650 } //update Isactive field in T_Bankreport ////// $mapped = $balancetoreceived + $amountreceived; // if($credit==$mapped) // { $CStatus = OPEN; // } // else // { // $active=1; // } $bankstatement = array('cbalancetocleared' => $updatebalancetoclear, 'cclearbalance' => $updateclearbalance, 'cstatus' => $CStatus); $result1 = $this->cashbook_model->updatebankreportiv($bankid, $bankstatement); $data['$invoicereportamount'] = $this->cashbook_model->gettotalbankreceivedamount($invoiceno); $amountreceivedinvoice = $data['$invoicereportamount'][0]->amountreceived; $$balancetoreceived = $data['$invoicereportamount'][0]->balancetoreceived; $amountreceivedupdate = $amountreceivedinvoice - $amountreceived; $balancetoreceivedupdate = $balancetoreceived + $amountreceived; if ($amountreceivedupdate == 0) { $IsAct = 0; } else { $IsAct = 1; } // $updatebalancetoreceived=$balancetoreceived+$amountreceived; // $updateamountreceived=$totinvoiceamount-$updatebalancetoreceived; $result3 = $this->cashbook_model->updatebankinvoicereport($invoiceno, $balancetoreceivedupdate, $amountreceivedupdate, $IsAct); $IsActive = 0; if (count($result3) > 0) { $data['$bankreceivedamountcount'] = $this->cashbook_model->gettotalbankmappinginvoicecount($invoiceno); $counting = $data['$bankreceivedamountcount'][0]->countamountreceived; if ($counting == 1) { $receivedstatus = NO_RECEIVED; } else { $receivedstatus = PARTIALLY_RECEIVED; } $result1 = $this->cashbook_model->UpdateIpinvoiceStatus($invoiceno, $receivedstatus); $result2 = $this->cashbook_model->deletemappinginvoice($mappingid, $IsActive); // if(count($result2)>0) // { // $result4= $this->cashbook_model->updatemappinginvoice($invoiceno,$amountreceived); // } } $this->loadViews("bankstatement", $this->global, $data, NULL); // if(count($result2)>0) // { // redirect('Bankingstatement','refresh'); // } } public function Deletemappingcashbook() { $bankamount = $_GET['bankamount']; $Bankid = $_GET['bankid']; $Amount = $_GET['amount']; $accountname = $_GET['accountname']; $id = $_GET['id']; $IsActive = 0; $balancetoclear = $_GET['balancetoclear']; $clearbalance = $bankamount - $Amount; $updatebankamount = $Amount + $balancetoclear; // $data['$accountcode'] = $this->cashbook_model->getaccountcode($accountname); // $accountcode=$data['$accountcode'][0]->code; $result = $this->cashbook_model->deletecashbookdata($Bankid, $updatebankamount, $clearbalance, $IsActive); $result1 = $this->cashbook_model->StatusUpadateCashbook($id, $IsActive); if (count($result1) > 0) { redirect('Bankingstatement', 'refresh'); } } public function Deletemappingcashbookcredit() { $bankamount = $_GET['bankamount']; $Bankid = $_GET['bankid']; $Amount = $_GET['amount']; $accountname = $_GET['accountname']; $id = $_GET['id']; $IsActive = 0; $balancetoclear = $_GET['balancetoclear']; $clearbalance = $_GET['clearbalance']; $updateclearbalance = $clearbalance - $Amount; $updatebalancetoclear = $balancetoclear + $Amount; // $data['$accountcode'] = $this->cashbook_model->getaccountcode($accountname); // $accountcode=$data['$accountcode'][0]->code; $result = $this->cashbook_model->deletecashbookdatacredit($Bankid, $updateclearbalance, $updatebalancetoclear); $result1 = $this->cashbook_model->StatusUpadateCashbook($id, $IsActive); if (count($result1) > 0) { // $this->loadViews("Bankingstatement", $this->global,$result1, NULL); // echo ""; redirect('Bankingstatement', 'refresh'); } } public function convertNumber($amt) { //echo $amt;die(); $ShowPaise = '0'; $totalAmt = explode(".", $amt); $number = $totalAmt[0]; $no = $number; if (!empty($totalAmt[1]) && $totalAmt[1] != 0) { $point = $totalAmt[1]; $ShowPaise = '1'; } else { $point = 0; $ShowPaise = '0'; } $hundred = null; $digits_1 = strlen($no); $i = 0; $str = array(); $words = array( '0' => '', '1' => 'One', '2' => 'Two', '3' => 'three', '4' => 'Four', '5' => 'Five', '6' => 'Six', '7' => 'seven', '8' => 'eight', '9' => 'nine', '10' => 'ten', '11' => 'eleven', '12' => 'twelve', '13' => 'thirteen', '14' => 'fourteen', '15' => 'fifteen', '16' => 'sixteen', '17' => 'seventeen', '18' => 'eighteen', '19' => 'nineteen', '20' => 'twenty', '30' => 'thirty', '40' => 'forty', '50' => 'fifty', '60' => 'sixty', '70' => 'seventy', '80' => 'eighty', '90' => 'ninety', '06' => 'Zero Six', '01' => 'Zero One', '02' => 'Zero Two', '03' => 'Zero Three', '04' => 'Zero Four', '05' => 'Zero Five', '07' => 'Zero Seven', '08' => 'Zero Eight', '09' => 'Zero Nine' ); $words1 = array( '2' => 'twenty', '3' => 'thirty', '4' => 'fourty', '5' => 'fifty', '6' => 'sixty', '7' => 'seventy', '8' => 'eighty', '9' => 'ninty' ); $words12 = array( '11' => 'eleven', '12' => 'twelve', '13' => 'thirteen', '14' => 'fourteen', '15' => 'fifteen', '16' => 'sixteen', '17' => 'seventeen', '18' => 'eighteen', '19' => 'nineteen', '20' => 'twenty', ); $digits = array('', 'hundred', 'thousand', 'lakh', 'crore'); while ($i < $digits_1) { $divider = ($i == 2) ? 10 : 100; $number = floor($no % $divider); $no = floor($no / $divider); $i += ($divider == 10) ? 1 : 2; if ($number) { $plural = (($counter = count($str)) && $number > 1) ? 's' : null; //print_r($plural); $hundred = ($counter == 1 && $str[0]) ? ' and ' : null; //print_r($hundred); $str[] = ($number < 21) ? $words[$number] . " " . $digits[$counter] . $plural . " " . $hundred : $words[floor($number / 10) * 10] . " " . $words[$number % 10] . " " . $digits[$counter] . $plural . " " . $hundred; } else $str[] = null; } $str = array_reverse($str); $result = implode('', $str); if ($point >= 1 && $point <= 10) { $points = ($point) ? " " . $words[$point] : " "; } else if ($point >= 11 && $point <= 20) { $points = ($point) ? " " . $words12[$point] : " "; } else { $points = ($point) ? " " . $words1[$point / 10] . " " . $words[$point = $point % 10] : ''; } if ($ShowPaise == '0') { $amountInWords = "Rupees " . $result . " Only"; } else { $amountInWords = "Rupees " . $result . " Paise " . $points . " Only"; } return $amountInWords; } }