From f0380c03bdf6cd0d38561ecb416c349b967455f2 Mon Sep 17 00:00:00 2001 From: "venbatechnologies@gmail.com" Date: Thu, 20 Sep 2018 12:57:35 +0530 Subject: [PATCH] bank book-bala --- application/config/routes.php | 727 ++-- application/controllers/cashbook.php | 3492 ++++++++-------- application/controllers/cashbook_model.php | 1094 +++++ application/views/bankamountpaid.php | 1026 ++--- application/views/bankamountunpaid.php | 228 ++ application/views/bankdebit.php | 2 +- application/views/bankposettlement.php | 430 +- application/views/includes/header.php | 4268 ++++++++++---------- 8 files changed, 6311 insertions(+), 4956 deletions(-) mode change 100755 => 100644 application/config/routes.php mode change 100755 => 100644 application/controllers/cashbook.php create mode 100644 application/controllers/cashbook_model.php create mode 100644 application/views/bankamountunpaid.php mode change 100755 => 100644 application/views/includes/header.php diff --git a/application/config/routes.php b/application/config/routes.php old mode 100755 new mode 100644 index f6647faf..0239bd34 --- a/application/config/routes.php +++ b/application/config/routes.php @@ -1,363 +1,364 @@ - - -$route['userListing'] = 'user/userListing'; -$route['userListing/(:num)'] = "user/userListing/$1"; -//$route['purchaseorderListing'] = 'purchaseorder/purchaseorderListing'; -//$route['purchaseorderListing/(:num)'] = "purchaseorder/purchaseorderListing/$1"; -$route['supplierListing'] = 'supplier/supplierListing'; -$route['supplierListing/(:num)'] = "supplier/supplierListing/$1"; - -$route['rawmaterialListing'] = 'rawmaterialdetails/rawmaterialListing'; -$route['rawmaterialListing/(:num)'] = "rawmaterialdetails/rawmaterialListing/$1"; - -$route['costListing'] = 'CostCenter/costListing'; -$route['costListing/(:num)'] = "CostCenter/costListing/$1"; - -$route['assetListing'] = 'assetdetails/assetListing'; -$route['assetListing/(:num)'] = "assetdetails/assetListing/$1"; - -$route['employeeListing'] = 'employeedetails/employeeListing'; -$route['employeeListing/(:num)'] = "employeedetails/employeeListing/$1"; - -$route['monthlyListings'] = 'monthlypay/monthlyListing'; -$route['monthlyListings/(:num)'] = "monthlypay/monthlyListing/$1"; - -$route['emppayListings'] = 'emppaydate/emppayListing'; -$route['emppayListings/(:num)'] = 'emppaydate/emppayListing/$1'; - -$route['attendance'] = 'monthlypay/attendanceLoad'; -$route['publicholidays'] = 'monthlypay/loadPublicholidays'; -$route['loanreports'] = 'payslip/loadLoanReport'; -$route['bonusreports'] = 'payslip/Bonusreport'; - - -// permission slip// -$route['permission'] = 'monthlypay/permissionslip'; -$route['permissionlist'] = 'monthlypay/permissionlist'; - - - - -//<-----------Application Add Routes------------> -$route['addNew'] = "user/addNew"; -$route['addNewUser'] = "user/addNewUser"; - -$route['addPO'] = "purchaseorder/addPO"; -$route['addNewPO'] = "purchaseorder/addNewPO"; - -$route['addsupplier'] = "supplier/addsupplier"; -$route['addNewsupplier'] = "supplier/addNewsupplier"; - -$route['addcost'] = "CostCenter/addCost"; -$route['addNewcost'] = "CostCenter/addNewCost"; - -$route['addasset'] = "assetdetails/addasset"; -$route['addNewasset'] = "assetdetails/addNewasset"; - -$route['addemployee'] = "employeedetails/addemployee"; -$route['addNewemployee'] = "employeedetils/addNewemployee"; - -$route['addRawmaterial'] = "rawmaterialdetails/addRawMaterial"; -$route['addNewRawmaterial'] = "rawmaterialdetails/addNewRawMaterial"; - -//<-----------Application Edit Routes------------> - -$route['editOld'] = "user/editOld"; -$route['editOld/(:num)'] = "user/editOld/$1"; -$route['editUser'] = "user/editUser"; -$route['editOldPO'] = "purchaseorder/editOldPO"; -$route['editOldPO/(:num)'] = "purchaseorder/editOldPO/$1"; -//$route['editPO'] = "purchaseorder/editPO"; -$route['editOldsupplier'] = "supplier/editOldsupplier"; -$route['editOldsupplier/(:num)'] = "supplier/editOldsupplier/$1"; -$route['editsupplier'] = "supplier/editsupplier"; - -$route['editOldcost'] = "CostCenter/editOldcost"; -$route['editOldcost/(:num)'] = "CostCenter/editOldcost/$1"; -$route['editcost'] = "CostCenter/editcost"; - -$route['editOldasset'] = "assetdetails/editOldasset"; -$route['editOldasset/(:num)'] = "assetdetails/editOldasset/$1"; -$route['editasset'] = "assetdetails/editasset"; - -$route['editOldemployee'] = "employeedetails/editOldemployee"; -$route['editOldemployee/(:num)'] = "employeedetails/editOldemployee/$1"; -$route['editemployee'] = "employeedetils/editemployee"; - -$route['editOldRawmaterial/(:num)'] = "rawmaterialdetails/editOldRawmaterial/$1"; -$route['editOldRawmaterial'] = "rawmaterialdetails/editOldRawmaterial"; -$route['editrawmaterial'] = "rawmaterialdetails/editemployee"; - -//<-----------Application Delete Routes------------> - -$route['deleteUser'] = "user/deleteUser"; -$route['deletecost'] = "CostCenter/deletecost"; - - -//<-----------Application User Change Password Routes------------> -$route['loadChangePass'] = "user/loadChangePass"; -$route['changePassword'] = "user/changePassword"; - - -//<-----------Application Page Not Found Routes------------> -$route['pageNotFound'] = "user/pageNotFound"; - -//<-----------Application Email & ForgetPassword Routes------------> -$route['checkEmailExists'] = "user/checkEmailExists"; -$route['forgotPassword'] = "login/forgotPassword"; -$route['resetPasswordUser'] = "login/resetPasswordUser";//reset password without OTP -$route['resetPasswordConfirmUser'] = "login/resetPasswordConfirmUser";//reset password with OTP - - -$route['checkEmailExists'] = "user/checkEmailExists"; -$route['forgotPassword'] = "login/forgotPassword"; -$route['monthlypay'] = "payslip/monthlyInputs"; -$route['ExcelUpload2'] = "payslip/viewUpload2"; -$route['FileUpload'] = "payslip/uploadExcel"; -$route['FileUpload2'] = "payslip/uploadExcel2"; -$route['PrintPdf'] = "payslip/PrintPdf"; -$route['ViewPay'] = "payslip/viewGenerator"; -$route['updatepayroll'] = "payslip/updatepayroll"; -$route['BankReport'] = "payslip/loadBankreportScreen"; -$route['PaysilpListing'] = "payslip/payslipLisiting"; - - -//<-----------Application Requistion Flow Routes------------> -$route['Requisition'] = "requisitionform/requisitionlisting"; -$route['RequisitionForm'] = "requisitionform/requisition"; -$route['ApproveRequisition'] = "requisitionform/requisitionlistApproval"; -$route['EditRequisition'] = "requisitionform/EditRequistionForm"; -//<-----------PO Flow------------> -$route['CreatePO'] = "purchaseorder/requisition"; -$route['purchaseOrder'] = "purchaseorder/CreatePurchaseOrder"; -$route['purchaseorderListing'] = "purchaseorder/PurchaseOrderList"; -$route['EditPO'] = "purchaseorder/EditPurchaseOrder"; -$route['EditAmendPO'] = "amendmentpurchaseorder/EditAmendPurchaseOrder"; -$route['EmergencyPO'] = "emergencypurchaseorder/CreateEmergencyPO"; -$route['AdvanceRequest'] = "purchaseorder/advancerequest"; -$route['PORelease'] = "purchaseorder/porelease"; -$route['ViewPO'] = "purchaseorder/viewfullpurchaseorder"; -$route['POApproval'] = "purchaseorder/poapproval"; - - -// -$route['storerequisition']="storerequisitionlist/addstore"; -$route['approvalstorerequisitionslip']="storerequisitionlist/SearchRequistLists"; -$route['storerequisitionlisting']="storerequisitionlist/addstorerequisitionlist"; -$route['EditStoreRequisition'] = "storerequisitionlist/EditStoreRequistion"; - - - -//<-------------IGR page-----------------> -$route['Addigr'] = "inwardgateregister/addinwardgateregister"; - -$route['ViewigrDetails'] = "inwardgateregister/viewIGRDetails"; - -$route['ViewMRIRBilling'] = "MRIRcontroller/viewmrirforbilling"; - - -//<------------OGR Page------------------> -$route['AddOgr'] = "inwardgateregister/addoutwardgateregister"; -$route['ViewOgr'] = "inwardgateregister/ViewOgr"; -$route['EditOGR']="inwardgateregister/EditOGR"; - - -//<-------------MRIR page-----------------> -$route['EditMRIR'] = "MRIRcontroller/editmaterialinspectionreport"; -$route['ViewMRIR'] = "MRIRcontroller/viewmaterialinspectionreport"; -$route['Viewigr'] = "MRIRcontroller/viewinwardgateregister"; -$route['Distribution'] = "MRIRcontroller/viewmMaterialDistributionList"; - -//<-------------Cashbook page-----------------> -$route['ViewIncomeExpense'] = "cashbook/incomeExpenseList"; -$route['EditIncomeExpense'] = "cashbook/editcashbook"; -$route['AdvanceList']="cashbook/AdvanceList"; -$route['addNewIncomeExpense'] = "cashbook/addNewIncomeExpenseLoad"; -$route['addIncomeExpense'] = "cashbook/addIncomeExpense"; -$route['updateExpense'] = "cashbook/updateExpense"; - -//<----------Cashbook page - Bank statement--------------> -$route['Bankingview']= "cashbook/bankfileview"; -$route['Bankfiletostatement']= "cashbook/bankfileupload"; -$route['Bankingstatement']= "cashbook/bankdata"; -$route['Debitstatement']= "cashbook/bankdebitdata"; -$route['Cashstatement']= "cashbook/cashreceipt"; -$route['BankingFile']= "cashbook/bankfileupload"; -//$route['Filelist']="cashbook/filelist"; -//$route['Bankingrecord']= "cashbook/bankdata"; -$route['Bankamountpaid']= "cashbook/amountpaid"; -$route['Bankamountreceived']= "cashbook/amountreceived"; -$route['Receipt']= "cashbook/cashreceipt"; -$route['Payment']= "cashbook/cashpayment"; -$route['Invoice']= "cashbook/bankinvoice"; -$route['Bankcash']= "cashbook/cashbanking"; -$route['DeleteInvoice']="cashbook/deletemappingiv"; -$route['DeletePo']="cashbook/Deletemappingporeport"; -$route['MappingInvoice']="cashbook/mappinginvoice"; -$route['qualityreportlist'] = "quality/reportList"; -$route['qualityreportlistinward'] = "quality/reportListInward"; -//<-------------Store page-----------------> -$route['Stock'] = "storestatus/storeavailability"; -$route['UpdatePOStatus'] = "servicepurchaseorder/UpdateServicePOStatus"; -$route['ServicePOBilling'] = "servicepurchaseorder/viewServicePOReportForBilling"; - - -//<-------------Reports page-----------------> -$route['reportpending'] = "report/pending_report"; -$route['releasedpo'] = "report/releasedPO"; -$route['openOrder'] = "report/openorderPO"; -$route['TotalOrder'] = "report/TotalOrd"; -$route['Report_costcenter'] = "report/ccr"; -$route['Report_Material_Supplier'] = "report/MM_Supplier"; -$route['Report_Material_Item'] = "report/MM_Item"; -$route['Report_Material_ReceiptValue'] = "report/MM_ReceiptValue"; -$route['Report_purchase'] = "report/purchase"; -$route['Report_year_wise'] = "report/year_wise"; -$route['Report_supplier'] = "report/purchase_supplier"; -$route['Report_consolidate'] = "report/consolidate"; -$route['Report_cumulative'] = "report/cumulative"; -$route['Report_purchase_inward'] = "report/ipurchase"; -$route['Report_year_wise_inward'] = "report/iyear_wise"; -$route['Report_supplier_inward'] = "report/ipurchase_supplier"; -$route['Report_consolidate_inward'] = "report/iconsolidate"; -$route['Report_cumulative_inward'] = "report/icumulative"; -$route['Report_cumulative_raw'] = "report/rawi_cumulative"; -$route['Report_consolidate_category'] = "report/rawi_consolidate"; -$route['Report_pending_purchase'] = "report/pending_purchase"; -$route['Report_purchase_attach'] = "report/iattach"; -$route['cashbookreport']="report/cashbook"; -$route['cashbookmonthlyexpenses']="report/monthexpenses"; -$route['cashbookyearlyexpenses']="report/yearexpenses"; -$route['Empperform']="report/per"; -$route['cashbookcumulativereport']="report/cashbook_cumulative_report"; -$route['cashbookcumulativemonthreport']="report/cashbook_month_cumulative_report"; -$route['Report_monthly_gst'] = "report/monthly_gst"; - -// Company Information -$route['companyview'] = 'companycontroller/companyview'; -$route['Updatecompany']='companycontroller/Updatecompany'; - - -// Config Master -$route['addconfig'] = "configurationctrl/addconfig"; -$route['addNewconfig'] = "configurationctrl/addNewconfig"; - - - -$route['configlisting']='configurationctrl/configlisting'; -$route['configedit']='configurationctrl/configedit'; - -// Department Master - -$route['departmentListing'] = 'department/departmentListing'; -$route['departmentListing/(:num)'] = "department/departmentListing/$1"; - -$route['adddepartment'] = "department/adddepartment"; -$route['addNewdepartment'] = "department/addNewdepartment"; - -$route['editOlddepartment'] = "department/viewdepartment"; -$route['editOlddepartment/(:num)'] = "department/viewdepartment/$1"; -$route['editdepartment'] = "department/editdepartment"; - -//<-------------Reports page-----------------> -$route['normalinprocess'] = "inprocess/addNewInprocessInspection"; -$route['nissaninprocess'] = "inprocess/addNewNissanInprocessInspection"; - -$route['resinbatchcardlisting'] = "resinbatchcard/resinBatchCardLisitng"; -$route['addNewResinbatchcard'] = "resinbatchcard/addNewResinBatchCard"; - - -//this route path productionsalary details -$route['productionsalary']="monthlypay/productionsalary"; - -//Customer Enquiry - - -$route['Editenquiry'] = "purchaseorder/Editenquiry"; -$route['enquirylisting'] = "purchaseorder/enquirylist"; -$route['AddComplaint'] = "purchaseorder/AddComplaint"; -$route['EditComplaint'] = "purchaseorder/EditComplaint"; -$route['Addaction'] = "purchaseorder/Nonconfirmative"; -$route['ncrlist'] = "purchaseorder/Nonconfirmativelist"; -/* End of file routes.php */ -/* Location: ./application/config/routes.php */ - - -$route['DeliveryPerformance']="user/deliver_perform"; - -//this function ues to ponoreset values - -$route['poresetview']="purchaseorder/poresetview"; - - -//stock - -$route['FinalProduct'] = "batchcard/FinalProductCalculation"; - -$route['FinalProductHistory'] = "batchcard/FinalProductHistory"; - -$route['FinalProductlisting'] = "batchcard/FinalProductlisting"; - -$route['MaterailAdjustment'] = "batchcard/MaterailAdjustment"; - -$route['MaterailAdjustmentlist'] = "batchcard/MaterailAdjustmentlist"; - -$route['EditMaterialAdjustment'] = "batchcard/EditMaterialAdjustment"; - -$route['MaterialHistory'] = "batchcard/material_history"; - -$route['EditFinalProduct'] = "batchcard/EditFinalProduct"; - - -$route['shortagematerialListing'] = 'rawmaterialdetails/shortagematerialListing'; - + + +$route['userListing'] = 'user/userListing'; +$route['userListing/(:num)'] = "user/userListing/$1"; +//$route['purchaseorderListing'] = 'purchaseorder/purchaseorderListing'; +//$route['purchaseorderListing/(:num)'] = "purchaseorder/purchaseorderListing/$1"; +$route['supplierListing'] = 'supplier/supplierListing'; +$route['supplierListing/(:num)'] = "supplier/supplierListing/$1"; + +$route['rawmaterialListing'] = 'rawmaterialdetails/rawmaterialListing'; +$route['rawmaterialListing/(:num)'] = "rawmaterialdetails/rawmaterialListing/$1"; + +$route['costListing'] = 'CostCenter/costListing'; +$route['costListing/(:num)'] = "CostCenter/costListing/$1"; + +$route['assetListing'] = 'assetdetails/assetListing'; +$route['assetListing/(:num)'] = "assetdetails/assetListing/$1"; + +$route['employeeListing'] = 'employeedetails/employeeListing'; +$route['employeeListing/(:num)'] = "employeedetails/employeeListing/$1"; + +$route['monthlyListings'] = 'monthlypay/monthlyListing'; +$route['monthlyListings/(:num)'] = "monthlypay/monthlyListing/$1"; + +$route['emppayListings'] = 'emppaydate/emppayListing'; +$route['emppayListings/(:num)'] = 'emppaydate/emppayListing/$1'; + +$route['attendance'] = 'monthlypay/attendanceLoad'; +$route['publicholidays'] = 'monthlypay/loadPublicholidays'; +$route['loanreports'] = 'payslip/loadLoanReport'; +$route['bonusreports'] = 'payslip/Bonusreport'; + + +// permission slip// +$route['permission'] = 'monthlypay/permissionslip'; +$route['permissionlist'] = 'monthlypay/permissionlist'; + + + + +//<-----------Application Add Routes------------> +$route['addNew'] = "user/addNew"; +$route['addNewUser'] = "user/addNewUser"; + +$route['addPO'] = "purchaseorder/addPO"; +$route['addNewPO'] = "purchaseorder/addNewPO"; + +$route['addsupplier'] = "supplier/addsupplier"; +$route['addNewsupplier'] = "supplier/addNewsupplier"; + +$route['addcost'] = "CostCenter/addCost"; +$route['addNewcost'] = "CostCenter/addNewCost"; + +$route['addasset'] = "assetdetails/addasset"; +$route['addNewasset'] = "assetdetails/addNewasset"; + +$route['addemployee'] = "employeedetails/addemployee"; +$route['addNewemployee'] = "employeedetils/addNewemployee"; + +$route['addRawmaterial'] = "rawmaterialdetails/addRawMaterial"; +$route['addNewRawmaterial'] = "rawmaterialdetails/addNewRawMaterial"; + +//<-----------Application Edit Routes------------> + +$route['editOld'] = "user/editOld"; +$route['editOld/(:num)'] = "user/editOld/$1"; +$route['editUser'] = "user/editUser"; +$route['editOldPO'] = "purchaseorder/editOldPO"; +$route['editOldPO/(:num)'] = "purchaseorder/editOldPO/$1"; +//$route['editPO'] = "purchaseorder/editPO"; +$route['editOldsupplier'] = "supplier/editOldsupplier"; +$route['editOldsupplier/(:num)'] = "supplier/editOldsupplier/$1"; +$route['editsupplier'] = "supplier/editsupplier"; + +$route['editOldcost'] = "CostCenter/editOldcost"; +$route['editOldcost/(:num)'] = "CostCenter/editOldcost/$1"; +$route['editcost'] = "CostCenter/editcost"; + +$route['editOldasset'] = "assetdetails/editOldasset"; +$route['editOldasset/(:num)'] = "assetdetails/editOldasset/$1"; +$route['editasset'] = "assetdetails/editasset"; + +$route['editOldemployee'] = "employeedetails/editOldemployee"; +$route['editOldemployee/(:num)'] = "employeedetails/editOldemployee/$1"; +$route['editemployee'] = "employeedetils/editemployee"; + +$route['editOldRawmaterial/(:num)'] = "rawmaterialdetails/editOldRawmaterial/$1"; +$route['editOldRawmaterial'] = "rawmaterialdetails/editOldRawmaterial"; +$route['editrawmaterial'] = "rawmaterialdetails/editemployee"; + +//<-----------Application Delete Routes------------> + +$route['deleteUser'] = "user/deleteUser"; +$route['deletecost'] = "CostCenter/deletecost"; + + +//<-----------Application User Change Password Routes------------> +$route['loadChangePass'] = "user/loadChangePass"; +$route['changePassword'] = "user/changePassword"; + + +//<-----------Application Page Not Found Routes------------> +$route['pageNotFound'] = "user/pageNotFound"; + +//<-----------Application Email & ForgetPassword Routes------------> +$route['checkEmailExists'] = "user/checkEmailExists"; +$route['forgotPassword'] = "login/forgotPassword"; +$route['resetPasswordUser'] = "login/resetPasswordUser";//reset password without OTP +$route['resetPasswordConfirmUser'] = "login/resetPasswordConfirmUser";//reset password with OTP + + +$route['checkEmailExists'] = "user/checkEmailExists"; +$route['forgotPassword'] = "login/forgotPassword"; +$route['monthlypay'] = "payslip/monthlyInputs"; +$route['ExcelUpload2'] = "payslip/viewUpload2"; +$route['FileUpload'] = "payslip/uploadExcel"; +$route['FileUpload2'] = "payslip/uploadExcel2"; +$route['PrintPdf'] = "payslip/PrintPdf"; +$route['ViewPay'] = "payslip/viewGenerator"; +$route['updatepayroll'] = "payslip/updatepayroll"; +$route['BankReport'] = "payslip/loadBankreportScreen"; +$route['PaysilpListing'] = "payslip/payslipLisiting"; + + +//<-----------Application Requistion Flow Routes------------> +$route['Requisition'] = "requisitionform/requisitionlisting"; +$route['RequisitionForm'] = "requisitionform/requisition"; +$route['ApproveRequisition'] = "requisitionform/requisitionlistApproval"; +$route['EditRequisition'] = "requisitionform/EditRequistionForm"; +//<-----------PO Flow------------> +$route['CreatePO'] = "purchaseorder/requisition"; +$route['purchaseOrder'] = "purchaseorder/CreatePurchaseOrder"; +$route['purchaseorderListing'] = "purchaseorder/PurchaseOrderList"; +$route['EditPO'] = "purchaseorder/EditPurchaseOrder"; +$route['EditAmendPO'] = "amendmentpurchaseorder/EditAmendPurchaseOrder"; +$route['EmergencyPO'] = "emergencypurchaseorder/CreateEmergencyPO"; +$route['AdvanceRequest'] = "purchaseorder/advancerequest"; +$route['PORelease'] = "purchaseorder/porelease"; +$route['ViewPO'] = "purchaseorder/viewfullpurchaseorder"; +$route['POApproval'] = "purchaseorder/poapproval"; + + +// +$route['storerequisition']="storerequisitionlist/addstore"; +$route['approvalstorerequisitionslip']="storerequisitionlist/SearchRequistLists"; +$route['storerequisitionlisting']="storerequisitionlist/addstorerequisitionlist"; +$route['EditStoreRequisition'] = "storerequisitionlist/EditStoreRequistion"; + + + +//<-------------IGR page-----------------> +$route['Addigr'] = "inwardgateregister/addinwardgateregister"; + +$route['ViewigrDetails'] = "inwardgateregister/viewIGRDetails"; + +$route['ViewMRIRBilling'] = "MRIRcontroller/viewmrirforbilling"; + + +//<------------OGR Page------------------> +$route['AddOgr'] = "inwardgateregister/addoutwardgateregister"; +$route['ViewOgr'] = "inwardgateregister/ViewOgr"; +$route['EditOGR']="inwardgateregister/EditOGR"; + + +//<-------------MRIR page-----------------> +$route['EditMRIR'] = "MRIRcontroller/editmaterialinspectionreport"; +$route['ViewMRIR'] = "MRIRcontroller/viewmaterialinspectionreport"; +$route['Viewigr'] = "MRIRcontroller/viewinwardgateregister"; +$route['Distribution'] = "MRIRcontroller/viewmMaterialDistributionList"; + +//<-------------Cashbook page-----------------> +$route['ViewIncomeExpense'] = "cashbook/incomeExpenseList"; +$route['EditIncomeExpense'] = "cashbook/editcashbook"; +$route['AdvanceList']="cashbook/AdvanceList"; +$route['addNewIncomeExpense'] = "cashbook/addNewIncomeExpenseLoad"; +$route['addIncomeExpense'] = "cashbook/addIncomeExpense"; +$route['updateExpense'] = "cashbook/updateExpense"; + +//<----------Cashbook page - Bank statement--------------> +$route['Bankingview']= "cashbook/bankfileview"; +$route['Bankfiletostatement']= "cashbook/bankfileupload"; +$route['Bankingstatement']= "cashbook/bankdata"; +$route['Debitstatement']= "cashbook/bankdebitdata"; +$route['Cashstatement']= "cashbook/cashreceipt"; +$route['BankingFile']= "cashbook/bankfileupload"; +//$route['Filelist']="cashbook/filelist"; +//$route['Bankingrecord']= "cashbook/bankdata"; +$route['Bankamountpaid']= "cashbook/amountpaid"; +$route['Bankamountunpaid']= "cashbook/amountunpaid"; +$route['Bankamountreceived']= "cashbook/amountreceived"; +$route['Receipt']= "cashbook/cashreceipt"; +$route['Payment']= "cashbook/cashpayment"; +$route['Invoice']= "cashbook/bankinvoice"; +$route['Bankcash']= "cashbook/cashbanking"; +$route['DeleteInvoice']="cashbook/deletemappingiv"; +$route['DeletePo']="cashbook/Deletemappingporeport"; +$route['MappingInvoice']="cashbook/mappinginvoice"; +$route['qualityreportlist'] = "quality/reportList"; +$route['qualityreportlistinward'] = "quality/reportListInward"; +//<-------------Store page-----------------> +$route['Stock'] = "storestatus/storeavailability"; +$route['UpdatePOStatus'] = "servicepurchaseorder/UpdateServicePOStatus"; +$route['ServicePOBilling'] = "servicepurchaseorder/viewServicePOReportForBilling"; + + +//<-------------Reports page-----------------> +$route['reportpending'] = "report/pending_report"; +$route['releasedpo'] = "report/releasedPO"; +$route['openOrder'] = "report/openorderPO"; +$route['TotalOrder'] = "report/TotalOrd"; +$route['Report_costcenter'] = "report/ccr"; +$route['Report_Material_Supplier'] = "report/MM_Supplier"; +$route['Report_Material_Item'] = "report/MM_Item"; +$route['Report_Material_ReceiptValue'] = "report/MM_ReceiptValue"; +$route['Report_purchase'] = "report/purchase"; +$route['Report_year_wise'] = "report/year_wise"; +$route['Report_supplier'] = "report/purchase_supplier"; +$route['Report_consolidate'] = "report/consolidate"; +$route['Report_cumulative'] = "report/cumulative"; +$route['Report_purchase_inward'] = "report/ipurchase"; +$route['Report_year_wise_inward'] = "report/iyear_wise"; +$route['Report_supplier_inward'] = "report/ipurchase_supplier"; +$route['Report_consolidate_inward'] = "report/iconsolidate"; +$route['Report_cumulative_inward'] = "report/icumulative"; +$route['Report_cumulative_raw'] = "report/rawi_cumulative"; +$route['Report_consolidate_category'] = "report/rawi_consolidate"; +$route['Report_pending_purchase'] = "report/pending_purchase"; +$route['Report_purchase_attach'] = "report/iattach"; +$route['cashbookreport']="report/cashbook"; +$route['cashbookmonthlyexpenses']="report/monthexpenses"; +$route['cashbookyearlyexpenses']="report/yearexpenses"; +$route['Empperform']="report/per"; +$route['cashbookcumulativereport']="report/cashbook_cumulative_report"; +$route['cashbookcumulativemonthreport']="report/cashbook_month_cumulative_report"; +$route['Report_monthly_gst'] = "report/monthly_gst"; + +// Company Information +$route['companyview'] = 'companycontroller/companyview'; +$route['Updatecompany']='companycontroller/Updatecompany'; + + +// Config Master +$route['addconfig'] = "configurationctrl/addconfig"; +$route['addNewconfig'] = "configurationctrl/addNewconfig"; + + + +$route['configlisting']='configurationctrl/configlisting'; +$route['configedit']='configurationctrl/configedit'; + +// Department Master + +$route['departmentListing'] = 'department/departmentListing'; +$route['departmentListing/(:num)'] = "department/departmentListing/$1"; + +$route['adddepartment'] = "department/adddepartment"; +$route['addNewdepartment'] = "department/addNewdepartment"; + +$route['editOlddepartment'] = "department/viewdepartment"; +$route['editOlddepartment/(:num)'] = "department/viewdepartment/$1"; +$route['editdepartment'] = "department/editdepartment"; + +//<-------------Reports page-----------------> +$route['normalinprocess'] = "inprocess/addNewInprocessInspection"; +$route['nissaninprocess'] = "inprocess/addNewNissanInprocessInspection"; + +$route['resinbatchcardlisting'] = "resinbatchcard/resinBatchCardLisitng"; +$route['addNewResinbatchcard'] = "resinbatchcard/addNewResinBatchCard"; + + +//this route path productionsalary details +$route['productionsalary']="monthlypay/productionsalary"; + +//Customer Enquiry + + +$route['Editenquiry'] = "purchaseorder/Editenquiry"; +$route['enquirylisting'] = "purchaseorder/enquirylist"; +$route['AddComplaint'] = "purchaseorder/AddComplaint"; +$route['EditComplaint'] = "purchaseorder/EditComplaint"; +$route['Addaction'] = "purchaseorder/Nonconfirmative"; +$route['ncrlist'] = "purchaseorder/Nonconfirmativelist"; +/* End of file routes.php */ +/* Location: ./application/config/routes.php */ + + +$route['DeliveryPerformance']="user/deliver_perform"; + +//this function ues to ponoreset values + +$route['poresetview']="purchaseorder/poresetview"; + + +//stock + +$route['FinalProduct'] = "batchcard/FinalProductCalculation"; + +$route['FinalProductHistory'] = "batchcard/FinalProductHistory"; + +$route['FinalProductlisting'] = "batchcard/FinalProductlisting"; + +$route['MaterailAdjustment'] = "batchcard/MaterailAdjustment"; + +$route['MaterailAdjustmentlist'] = "batchcard/MaterailAdjustmentlist"; + +$route['EditMaterialAdjustment'] = "batchcard/EditMaterialAdjustment"; + +$route['MaterialHistory'] = "batchcard/material_history"; + +$route['EditFinalProduct'] = "batchcard/EditFinalProduct"; + + +$route['shortagematerialListing'] = 'rawmaterialdetails/shortagematerialListing'; + diff --git a/application/controllers/cashbook.php b/application/controllers/cashbook.php old mode 100755 new mode 100644 index c28dd107..77ce2fab --- a/application/controllers/cashbook.php +++ b/application/controllers/cashbook.php @@ -1,1737 +1,1757 @@ -load->model('cashbook_model'); - $this->load->model('employeedetails_model'); - $this->isLoggedIn(); - $this->load->helper(array('form','url')); - $this->load->library('upload'); - - } - - function incomeExpenseList() - { - - $aid = $this->uri->segment(3); - $str = $this->uri->segment(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().'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 = $this->load->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'] = 'Siddharth : Cash Book: View Income Expense '; - $this->loadViews("viewIndIncomeExpense", $this->global, $data , NULL); - - } - - }else{ - // $data['list'] = $this->cashbook_model->getIncomeExpenseList(); - // $this->global['pageTitle'] = 'Siddharth : Cash Book: Listing'; - - // $this->loadViews("income_expense_list", $this->global, $data , NULL); - $this->global['pageTitle'] = 'Siddharth : Cash Book: Listing'; - - if ($this->input->post('btn_submit')) { - - $fromdt = $this->input->post('from_date'); - $todt = $this->input->post('to_date'); - $ab=$this->input->post('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() - { - - $aid = $this->uri->segment(3); - $str = $this->uri->segment(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 = $this->load->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'] = 'Siddharth : Cash Book: View Income Expense '; - $this->loadViews("viewIndIncomeExpense", $this->global, $data , NULL); - - } - - }else{ - // $data['list'] = $this->cashbook_model->getIncomeExpenseList(); - // $this->global['pageTitle'] = 'Siddharth : Cash Book: Listing'; - - // $this->loadViews("income_expense_list", $this->global, $data , NULL); - $this->global['pageTitle'] = 'Siddharth : Cash Book: Listing'; - - if ($this->input->post('btn_submit')) { - - $fromdt = $this->input->post('from_date'); - $todt = $this->input->post('to_date'); - $ab=$this->input->post('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'] = 'Siddharth : Cash Book: Add New Income Expense '; - $this->loadViews("addnewIncomeExpense", $this->global, $data , NULL); - } - - function autocomplete() - { - //$this->load->model('model','cashbook_model'); - $mer = $this->input->get('query'); - $query= $this->cashbook_model->checkMerchant($mer); - echo json_encode($query); - - } - - function getSupplierDtls() - { - $s = $this->input->post('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'] = 'Siddharth : Cash Book: Add New Income Expense '; - $this->global['pageTitle'] = 'Siddharth : 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 = null; - - $fs = 0; - if(!empty($_FILES['userfile']['name'])) - { - //echo "FILE AVAILABLE"; - $config['file_name'] = $_FILES['userfile']['name']; - $myFIle = $config['file_name']; - - $config['upload_path'] = 'uploads/banking/'; - $path = $config['upload_path']; - //$filename = $config['file_name']; - $document = $path.$filename; - //echo $document; - $fs = $this->uploadFile1(); - $document = $path.$fs; - $created_by = $this->session->userdata('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->input->post('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(); - - } - if($x == $highestRow4){ - - $closingbalance=$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 = date('Y-m-d',strtotime($dat1)); - - } - - - $chqno = $sheet->getCell('C'.$x)->getValue(); - $narration = $sheet->getCell('D'.$x)->getValue(); - $cod =$sheet->getCell('E'.$x)->getValue(); - $debit =$sheet->getCell('F'.$x)->getValue(); - $credit=$sheet->getCell('G'.$x)->getValue(); - $balance=$sheet->getCell('H'.$x)->getValue(); - - // $IsActive=0; - $filedataupload= array('reportdate'=>$Date1,'valuedate'=>$Date2,'chequeNo'=>$cod,'Narration'=>$narration,'Cod'=> $chqno,'Debit'=>$debit,'Credit'=>$credit,'cbalancetocleared'=>$credit,'Balance'=>$balance,'Bankname'=>$bank,'IsActive'=> $IsActive); - - - - $res = $this->cashbook_model->bankfiledata($filedataupload); - } - $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->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; - } - - - - - $accounttype = $this->input->post('myradio'); - //$accounttype1 = $this->input->post('myrad'); - //echo $accounttype; - //echo $accounttype1; - 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'); - - $gsttoggle = $this->input->post('gsttoggle'); - $invoiceno = null; - $merchantname = null; - $mergstno = null; - $hsn = null; - $beforegst = null; - $sgst = null; - $cgst = null; - $igst = null; - if(!empty($gsttoggle)) - { - $invoiceno = $this->input->post('Invoiceno'); - $merchantname = $this->input->post('merchant'); - $mergstno = $this->input->post('Merchantgst'); - $hsn = $this->input->post('hsn'); - $beforegst = $this->input->post('valuebeforegST'); - $sgst = $this->input->post('SGST'); - $cgst = $this->input->post('CGST'); - $igst = $this->input->post('IGST'); - - } - - - $cashbookamount=$this->input->post('totalamount1'); - $totalamount=$directamount+$cashbookamount; - $description = $this->input->post('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'] = '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->userdata('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->input->post('bankdate'); - $bankid = $this->input->post('bankid'); - $amount = $this->input->post('bankamount'); - $amounttype = $this->input->post('type'); - $forstatus = $this->input->post('forstatus'); - $alreadypaid=$this->input->post('alreadypaid'); - $alreadycreditpaid=$this->input->post('alreadycreditpaid'); - $debitamount=$this->input->post('debitamount'); - $creditamount=$this->input->post('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'] = '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() - { - - //echo "INSIDE UPLOAFD"; - - //$this->load->library('upload') - $pathinfo = pathinfo($_FILES['userfile']['name']); - $config['upload_path'] = 'uploads/banking/'; - $config['allowed_types'] = 'png|jpg|jpeg|xlsx'; - $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() - { - - $aid = $this->uri->segment(3); - - $data['data'] = $this->cashbook_model->getAccounutInfo(); - //print_r($data['dropdownvalues']);die(); - $this->global['pageTitle'] = 'Siddharth : Cash Book: View Income Expense '; - $this->loadViews("viewIndIncomeExpense", $this->global, $data , NULL); - - } - - public function index() - { - //$data['dropdownvalues1'] = $this->cashbook_model->getAccounTypes1(); - - $this->global['pageTitle'] = 'Siddharth : Cashbook Details'; - $this->loadViews("cashbooklisting", $this->global, NULL , NULL); - - } - - - - public function cashbookList() - { - - - $this->load->model('cashbook_model'); - $data['dropdownvalues1'] = $this->cashbook_model->getAccounTypes1(); - //print_r($data['dropdownvalues1']); - $data['cashbook'] = $this->cashbook_model->Selectcash(); - - $this->global['pageTitle'] = 'Siddharth : Cashbook Listing'; - - $this->loadViews("cashbooklisting", $this->global, $data, NULL); - - } - - - //advance list - public function AdvanceList() - { - - $aid = $this->uri->segment(3); - $str = $this->uri->segment(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().'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 = $this->load->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'] = 'Siddharth : Cash Book: View Income Expense '; - $this->loadViews("viewIndIncomeExpense", $this->global, $data , NULL); - - } - - }else{ - // $data['list'] = $this->cashbook_model->getIncomeExpenseList(); - // $this->global['pageTitle'] = 'Siddharth : Cash Book: Listing'; - - // $this->loadViews("income_expense_list", $this->global, $data , NULL); - $this->global['pageTitle'] = 'Siddharth : Cash Book: Listing'; - - if ($this->input->post('btn_submit')) { - - $fromdt = $this->input->post('from_date'); - $todt = $this->input->post('to_date'); - $ab=$this->input->post('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->input->post('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; - } - - - $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,'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) - { - - if($sid == '') - { - $cash = $_GET['sid']; - } - else - { - $cash = $sid; - } - - - $this->load->model('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'] = 'Siddharth : Edit Cashbook'; - $this->loadViews("editincomeexpenses", $this->global,$data, NULL); - - } - public function deletefile() - { - $cashfile = $this->input->post('id'); - $cashid = $this->input->post('ide'); - //echo 'dsmkjsn'; - //echo $cashid; - - //echo $cashfile; - //die(); - //$this->load->model('cashbook_model'); - $filedata= $this->cashbook_model->deletefile($cashid); - echo $filedata; - //$this->global['pageTitle'] = 'Siddharth : Edit Cashbook'; - //$this->loadViews("income_expense_list", $this->global,$data, NULL); - - } - function updateExpense() - { - $id1=$this->input->post('id1'); - $myradio1= $this->input->post('myradio'); - //$myradio2= $this->input->post('myrad'); - $option=''; - if($myradio1==1) - { - $option=RECEIPT; - } - else - { - $option=PAYMENT; - } - //echo $option;die(); - $ans1 = $this->input->post('ans'); - $Date1 = $this->input->post('Date'); - //echo $Date1; - $date = date_create($Date1);//,'Y-m-d'); - $date = date_format($date,'Y-m-d'); - //echo $date; - //$Date1 = $this->input->post('Date'); - $accountcode1 = $this->input->post('accode'); - //echo $accountcode1;die(); - $towhome1 = $this->input->post('towhome'); - $supplier = $this->input->post('supplier'); - $Invoiceno1 = $this->input->post('Invoiceno'); - $merchant1 = $this->input->post('merchant'); - $Merchantgst1 = $this->input->post('Merchantgst'); - $hsn1 = $this->input->post('hsn'); - $valuebeforegST1 = $this->input->post('valuebeforegST'); - $SGST1 = $this->input->post('SGST'); - $CGST1 = $this->input->post('CGST'); - $IGST1 = $this->input->post('IGST'); - $totalamount1 = $this->input->post('totalamount'); - $description1 = $this->input->post('description'); - $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; - - //$document1=$this->input->post('myfile'); - $fs = 0; - if(!empty($_FILES['myfile']['name'])) - { - //echo "FILE AVAILABLE"; - $config['file_name'] = $_FILES['myfile']['name']; - $config['upload_path'] = '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'] = 'Siddharth : Bank Statement'; - if ($this->input->post('btn_submit')) - { - $this->global['pageTitle'] = 'Siddharth : bankstatement'; - $ab=$this->input->post('financialyear'); - - $fa=substr($ab,0,-5); - $aa=substr($ab,5,5); - - - $fdate = $this->input->post('from_date'); - $tdate = $this->input->post('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'] = 'Siddharth : Bank Debit Report'; - if ($this->input->post('btn_submit')) - { - $Supplierid = $this->input->post('SupplierName'); - $fdate = $this->input->post('from_date'); - $tdate = $this->input->post('to_date'); - //$data['cash'] = $_GET['sid']; - //$data['bankid'] = $_GET['d']; - $data['bankdepit'] = $this->cashbook_model->debitbankstatemet($Supplierid,$fdate,$tdate); - } - -// print_r($data['bankdepit']); - $data['getsupplier'] = $this->cashbook_model->getsupplier(); - $this->loadViews("bankdebit",$this->global,$data,NULL); - //die(); - - } - public function bankinvoice() - { - $this->global['pageTitle'] = 'Siddharth : Bank Invoice Report'; - if ($this->input->post('btn_submit')) - { - $Customer = $this->input->post('Customer'); - $fdate = $this->input->post('from_date'); - $tdate = $this->input->post('to_date'); - $data['bankinvoicedata'] = $this->cashbook_model->bankinvoice($Customer,$fdate,$tdate); - //$data['supplier'] = $this->cashbook_model->getsupplier(); - } - $data['getcustomer'] = $this->cashbook_model->getcustomer(); - - $this->loadViews("bankinvoice", $this->global,$data,NULL); - - } - - - 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); - // print_r($data); - echo json_encode($data); - - - } - /*end*/ - - 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'] = 'Siddharth : Bank Report - Debited Settlements'; - $SupplierName = $this->input->post('SupplierName'); - $fdate = $this->input->post('from_date'); - $tdate = $this->input->post('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->mappingcash($SupplierName,$fdate,$tdate,$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'] = 'Siddharth : Cashbook Listing'; - $this->global['pageTitle'] = 'Siddharth : Bank Report - Credited Settlements'; - $SupplierName = $this->input->post('SupplierName'); - $fdate = $this->input->post('from_date'); - $tdate = $this->input->post('to_date'); - $bankid= $_GET['d']; - $data['clearbalance']=$_GET['cb']; - // if($data['clearbalance']==0) - // { - // echo ""; - // redirect('Bankingstatement','refresh'); - // } - // else - // { - $data['balancetoclear']=$_GET['btc']; - $data['mappingcashbook']=$this->cashbook_model->mappingcash($SupplierName,$fdate,$tdate,$bankid); - $data['mappingiv'] = $this->cashbook_model->creditinvoicelist($bankid); - $data['paidcbook'] = $this->cashbook_model->cashbookamount($bankid); - $data['invoiceramount'] = $this->cashbook_model->invoiceamonut($bankid); - $data['supplier'] = $this->cashbook_model->getsupplier(); - //redirect('Bankingstatement','refresh'); - $this->loadViews("bankinvoicesettlement", $this->global,$data,NULL); - //} - } - public function mappingdebit() - { - - - // $this->global['pageTitle'] = 'Siddharth : mappingdebit'; - $this->global['pageTitle'] = 'Siddharth : Bank Report - Debited Details'; - $SupplierName = $this->input->post('SupplierName'); - $fdate = $this->input->post('from_date'); - $tdate = $this->input->post('to_date'); - $pono= $_GET['sid']; - $data['debitmapping'] = $this->cashbook_model->debitlistpo($SupplierName,$fdate,$tdate,$pono); - $this->loadViews("bankposettlement", $this->global,$data,NULL); - - } - public function mappingcredit() - { - - - // $this->global['pageTitle'] = 'Siddharth : mappingcredit'; - $this->global['pageTitle'] = 'Siddharth : Bank Report - Credited Details '; - $SupplierName = $this->input->post('SupplierName'); - $fdate = $this->input->post('from_date'); - $tdate = $this->input->post('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'] = 'Siddharth : Bank Report - Store Debited Details'; - $check = $this->input->post('check'); - // echo 'check'.$check; - $rw = $this->input->post('rw'); - // echo 'rw'.$rw; - $date = $this->input->post('podate'); - $date = date_create($date); - $date = date_format($date,'Y-m-d'); - $pono = $this->input->post('pono'); - $igrno=$this->input->post('igrno'); - $igrlineitem=$this->input->post('igrlineitem'); - - $sname = $this->input->post('sname'); - $tot = $this->input->post('tot'); - // echo'tot'.$tot; - - $rowcount = $this->input->post('rc'); - - $totalpaidamount= $this->input->post('tpv'); - //echo 'totalpaidamount'.$totalpaidamount; - - $bankdebitamountamount= $this->input->post('bda'); - //echo 'bankdebitamountamount'.$bankdebitamountamount; - $bankid =$this->input->post('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($igrlineitem); - if(empty($earlypaid)) - { - $ePay=0; - } - else - { - foreach($earlypaid as $ep) - { - $ePay = $ep->Amountpaid; - } - } - //echo 'epay'.$epay; - - $ip=$this->input->post('aa'); - $balancetopay=($tot-($ip+$ePay)); - - - $amtpaid= ($ip+$ePay); - $IsActive=1; - - $podata1 = array('Podate'=>$date,'PONO'=>$pono,'IGRNO'=>$igrno,'Suppliername'=>$sname,'Totalpoamount'=>$tot,'Amountpaid'=>$ip,'Balancetopay'=>$balancetopay,'mid'=>$bankid,'IGRLineItemNo'=>$igrlineitem,'IsActive'=>$IsActive); - - $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($igrlineitem); - - $resultn = $this->cashbook_model->mappingpo($podata1); - if(count($result3)<=0) - { - - $result = $this->cashbook_model->podata($podata); - - } - else - { - //echo "update"; - $result3 = $this->cashbook_model->poupdate($podata,$igrlineitem); - - } - if($rw == $rowcount) - { - echo "Saved Successfully!"; - } - - - - if($balancetopay==0) - { - $igrstatus=AMOUNT_PAIDIGR; - } - else - { - $igrstatus=PARTIALLY_PAIDIGR; - } - $igrdetails=array('BankStatus'=>$igrstatus); - $result1 = $this->cashbook_model->igrdetailstatus($igrdetails,$igrlineitem); - //$result1 = $this->cashbook_model->poamountstatus($pomaster,$pono); - $this->loadViews("bankstatement", $this->global,$data, NULL); - } - public function invoiceamount1() - { - //$this->global['pageTitle'] = 'Siddharth : Cashbook Listing'; - $this->global['pageTitle'] = 'Siddharth : Bank Report - Store Credited Details'; - $check = $this->input->post('check'); - $rw = $this->input->post('rw'); - - $date = $this->input->post('date'); - $date = date_create($date);//,'Y-m-d'); - $date = date_format($date,'Y-m-d'); - $invid = $this->input->post('invid'); - $cname = $this->input->post('cname'); - $invamount = $this->input->post('invamount'); - $invoicereceived = $this->input->post('ir'); - $rowcount = $this->input->post('rc'); - $totalpaidamount= $this->input->post('tpv'); - $bankcreditamount= $this->input->post('bda'); - $invoicetext=$this->input->post('invrec'); - $bankid =$this->input->post('bi'); - $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); - if(empty($earlyreceived)) - { - $eRec=0; - } - else - { - foreach($earlyreceived as $ec) - { - $eRec = $ec->amountreceived; - } - } - //echo $eRec; - $ip=$this->input->post('ar'); - $balancetoreceived1=($invamount-($ip+$eRec)); - $amtpaid= ($ip+$eRec); - - $updateamount=($totalpaidamount+$eRec); - $IsActive=1; - $invoicedata1 = array('indate'=>$date,'invoiceno'=>$invid,'customername'=>$cname,'totinvoiceamount'=>$invamount,'balancetoreceived'=>$balancetoreceived1,'amountreceived'=>$amtpaid,'bankid'=>$bankid); - - $invoicedata = array('indate'=>$date,'invoiceno'=>$invid,'customername'=>$cname,'totinvoiceamount'=>$invamount,'balancetoreceived'=>$balancetoreceived1,'amountreceived'=>$ip,'bankid'=>$bankid,'IsActive'=>$IsActive); - - // //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); - - } - if($balancetoreceived1==0) - { - $status=AMOUNT_RECEIVED; - - } - else - { - $status=PARTIALLY_RECEIVED; - } - $invoicemaster= array('receivedstatus'=>$status); - - $result1 = $this->cashbook_model->invoiceamountstatus($invoicemaster,$invid); - - echo ""; - - } - public function amountpaid() - { - - //$this->global['pageTitle'] = 'Siddharth : amountpaid'; - $this->global['pageTitle'] = 'Siddharth : Bank Report - Amount Payment Details'; - if ($this->input->post('btn_submit')) - { - $SupplierName = $this->input->post('SupplierName'); - $fdate = $this->input->post('from_date'); - $tdate = $this->input->post('to_date'); - $data['bankdebit'] = $this->cashbook_model->debitpolistfilter($SupplierName,$fdate,$tdate); - } - $data['amountpaid'] = $this->cashbook_model->paided(); - $data['supplier'] = $this->cashbook_model->getsupplier(); - $this->loadViews("bankamountpaid", $this->global,$data, NULL); - - } - public function amountreceived() - { - - - // $this->load->model('cashbook_model'); - //$this->global['pageTitle'] = 'Siddharth : Cashbook Listing'; - $this->global['pageTitle'] = 'Siddharth : Bank Report - Received Amount Details'; - if ($this->input->post('btn_submit')) - { - $Customer = $this->input->post('Customer'); - $fdate = $this->input->post('from_date'); - $tdate = $this->input->post('to_date'); - - $data['bankcredit'] = $this->cashbook_model->creditinvoicelistfilter($Customer,$fdate,$tdate); - } - $data['getcustomer'] = $this->cashbook_model->getcustomer(); - $data['amountreceived'] = $this->cashbook_model->received(); - $this->loadViews("bankamountreceived", $this->global,$data, NULL); - - } - public function cashbanking() - { - $this->global['pageTitle'] ='Siddharth :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->input->post('Totalpoamount'); - $Amount = $this->input->post('paidamount'); - $id=$this->input->post('mappingid'); - $igrno = $this->input->post('IGRItemNo'); - $Bankid = $this->input->post('bankid'); - $balancetoclear=$this->input->post('balancetobankingclear'); - $clearedbalance=$this->input->post('clearbalance'); - $updateamount=$clearedbalance-$Amount; - $updatebalancetoclear=$Amount+$balancetoclear; - $data['$bankmappingamount'] = $this->cashbook_model->gettotalbankmappingpo($igrno); - $amountpaid=$data['$bankmappingamount'][0]->Amountpaid; - //$data['$totallineitemamount']=$this->cashbook_model->gettotallineitem($igrno); - - if($amountpaid==$totalamount) - { - $BankStatus=NO_PAIDIGR; - } - else - { - $BankStatus=PARTIALLY_PAIDIGR; - } - - $result= $this->cashbook_model->IgrDetailsStatusUpdate($igrno,$BankStatus); - $result1= $this->cashbook_model->deletemapping($Bankid,$updateamount,$updatebalancetoclear); - //for update mapping amount in t_bankmappingpo table// - $balancetopay=$this->input->post('balancetopay'); - $totalbalancetopay=$Amount+$balancetopay; - $updatebankpoamount=$totalamount-$totalbalancetopay; - //$updateamount=0; - $IsActive=0; - $result2= $this->cashbook_model->deleteBankmappingpo($id,$IsActive); - //for update mapping amount inT_Bankporeport table// - //die(); - $result3= $this->cashbook_model->updateBankporeportpo($igrno,$totalbalancetopay,$updatebankpoamount,$Bankid); - $this->loadViews("bankstatement", $this->global,$data, NULL); - } - public function Deletemappingpo() - { - $totalamount = $_GET['totalpoamount']; - $Bankid = $_GET['bankid']; - $Amount = $_GET['amount']; - $igrno = $_GET['igrno']; - $balancetoclear=$_GET['balancetoclear']; - //for T_Bankreport IsActive// - $bankdebit=$_GET['debit']; - $mapped= $Amount+$balancetoclear; - if( $bankdebit==$mapped) - { - $active=0; - } - else - { - $active=1; - } - - ///////////////// - - $id=$_GET['id']; - - $bankamount=$_GET['bankamount']; - $updateamount=$bankamount-$Amount; - $updatebalancetoclear=$Amount+$balancetoclear; - $data['$bankmappingamount'] = $this->cashbook_model->gettotalbankmappingpo($igrno); - $amountpaid=$data['$bankmappingamount'][0]->Amountpaid; - //if($Amount==) - - //$data['$totallineitemamount']=$this->cashbook_model->gettotallineitem($igrno); - - - if($amountpaid==$totalamount) - { - $BankStatus=NO_PAIDIGR; - } - else - { - $BankStatus=PARTIALLY_PAIDIGR; - } - - $result= $this->cashbook_model->IgrDetailsStatusUpdate($igrno,$BankStatus); - $result1= $this->cashbook_model->deletemapping($Bankid,$updateamount,$updatebalancetoclear,$active); - //for update mapping amount in t_bankmappingpo table// - $balancetopay=$_GET['balancetopay']; - $totalbalancetopay=$Amount + $balancetopay; - $IsActive=0; - $updatebankpoamount=$totalamount-$totalbalancetopay; - $result2= $this->cashbook_model->deleteBankmappingpo($id,$IsActive); - //for update mapping amount inT_Bankporeport table// - $result3= $this->cashbook_model->updateBankporeportpo($igrno,$totalbalancetopay,$updatebankpoamount,$Bankid,$active); - - if(count($result2)>0) - { - redirect('Bankingstatement','refresh'); - } - - } - public function deletemappingiv() - { - - $this->global['pageTitle'] = 'Siddharth : Bank Report - Delete Mapping Invoice'; - $credit= $this->input->post('credit'); - $invoiceno = $this->input->post('invoiceno'); - $bankid = $this->input->post('bankid'); - $mappingid=$this->input->post('mappingid'); - $amountreceived = $this->input->post('amountreceived'); - $bankingclear = $this->input->post('bankingclear'); - $bankingbalclear = $this->input->post('bankingbalclear'); - $totinvoiceamount = $this->input->post('totinvoiceamount'); - $balancetoreceived = $this->input->post('balancetoreceived'); - $updatebalancetoclear=$amountreceived+$bankingbalclear; - if($amountreceived<0) - { - $updateclearbalance=$bankingclear-($amountreceived);//450-(-250) - } - else - { - $updateclearbalance=$bankingclear-$amountreceived;//450-650 - } - - // if($amountreceived<0) - // { - // $updatebalancetoclear=$amountreceived+$bankingbalclear; - // $updateclearbalance=$amountreceived+$bankingclear; - // } - // else - // { - // $updatebalancetoclear=$bankingbalclear+$amountreceived; - // $updateclearbalance=$bankingclear+$amountreceived; - // } - - //update Isactive field in T_Bankreport ////// - $mapped=$balancetoreceived+$amountreceived; - if($credit==$mapped) - { - $active=0; - } - else - { - $active=1; - } - $bankstatement=array('cbalancetocleared'=>$updatebalancetoclear,'cclearbalance'=>$updateclearbalance,'IsActive'=>$active); - $result1= $this->cashbook_model->updatebankreportiv($bankid,$bankstatement); - if($totinvoiceamount==$amountreceived) - { - $receivedstatus=NO_RECEIVED; - } - else - { - $receivedstatus=PARTIALLY_RECEIVED; - } - $IsActive=0; - //$data['$latestamount'] = $this->cashbook_model->getlatestamount($invoiceno); - //print_r($data['$latestamount']); - //die(); - //$balancetoreceived1=$data['$latestamount'][0]->balancetoreceived; - $updatebalancetoreceived=$balancetoreceived+$amountreceived; - $updateamountreceived=$totinvoiceamount-$updatebalancetoreceived; - $result3= $this->cashbook_model->updatebankinvoicereport($invoiceno,$bankid,$updatebalancetoreceived,$updateamountreceived); - if(count($result3)>0) - { - $result1=$this->cashbook_model->UpdateIpinvoiceStatus($invoiceno,$receivedstatus); - $result2= $this->cashbook_model->deletemappinginvoice($mappingid,$IsActive); - } - $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; - } - -} +load->model('cashbook_model'); + $this->load->model('employeedetails_model'); + $this->isLoggedIn(); + $this->load->helper(array('form','url')); + $this->load->library('upload'); + + } + + function incomeExpenseList() + { + + $aid = $this->uri->segment(3); + $str = $this->uri->segment(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().'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 = $this->load->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'] = 'Siddharth : Cash Book: View Income Expense '; + $this->loadViews("viewIndIncomeExpense", $this->global, $data , NULL); + + } + + }else{ + // $data['list'] = $this->cashbook_model->getIncomeExpenseList(); + // $this->global['pageTitle'] = 'Siddharth : Cash Book: Listing'; + + // $this->loadViews("income_expense_list", $this->global, $data , NULL); + $this->global['pageTitle'] = 'Siddharth : Cash Book: Listing'; + + if ($this->input->post('btn_submit')) { + + $fromdt = $this->input->post('from_date'); + $todt = $this->input->post('to_date'); + $ab=$this->input->post('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() + { + + $aid = $this->uri->segment(3); + $str = $this->uri->segment(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 = $this->load->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'] = 'Siddharth : Cash Book: View Income Expense '; + $this->loadViews("viewIndIncomeExpense", $this->global, $data , NULL); + + } + + }else{ + // $data['list'] = $this->cashbook_model->getIncomeExpenseList(); + // $this->global['pageTitle'] = 'Siddharth : Cash Book: Listing'; + + // $this->loadViews("income_expense_list", $this->global, $data , NULL); + $this->global['pageTitle'] = 'Siddharth : Cash Book: Listing'; + + if ($this->input->post('btn_submit')) { + + $fromdt = $this->input->post('from_date'); + $todt = $this->input->post('to_date'); + $ab=$this->input->post('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'] = 'Siddharth : Cash Book: Add New Income Expense '; + $this->loadViews("addnewIncomeExpense", $this->global, $data , NULL); + } + + function autocomplete() + { + //$this->load->model('model','cashbook_model'); + $mer = $this->input->get('query'); + $query= $this->cashbook_model->checkMerchant($mer); + echo json_encode($query); + + } + + function getSupplierDtls() + { + $s = $this->input->post('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'] = 'Siddharth : Cash Book: Add New Income Expense '; + $this->global['pageTitle'] = 'Siddharth : 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 = null; + + $fs = 0; + if(!empty($_FILES['userfile']['name'])) + { + //echo "FILE AVAILABLE"; + $config['file_name'] = $_FILES['userfile']['name']; + $myFIle = $config['file_name']; + + $config['upload_path'] = 'uploads/banking/'; + $path = $config['upload_path']; + //$filename = $config['file_name']; + $document = $path.$filename; + //echo $document; + $fs = $this->uploadFile1(); + $document = $path.$fs; + $created_by = $this->session->userdata('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->input->post('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(); + + } + if($x == $highestRow4){ + + $closingbalance=$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 = date('Y-m-d',strtotime($dat1)); + + } + + + $chqno = $sheet->getCell('C'.$x)->getValue(); + $narration = $sheet->getCell('D'.$x)->getValue(); + $cod =$sheet->getCell('E'.$x)->getValue(); + $debit =$sheet->getCell('F'.$x)->getValue(); + $credit=$sheet->getCell('G'.$x)->getValue(); + $balance=$sheet->getCell('H'.$x)->getValue(); + + // $IsActive=0; + $filedataupload= array('reportdate'=>$Date1,'valuedate'=>$Date2,'chequeNo'=>$cod,'Narration'=>$narration,'Cod'=> $chqno,'Debit'=>$debit,'Credit'=>$credit,'cbalancetocleared'=>$credit,'Balance'=>$balance,'Bankname'=>$bank,'IsActive'=> $IsActive); + + + + $res = $this->cashbook_model->bankfiledata($filedataupload); + } + $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->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; + } + + + + + $accounttype = $this->input->post('myradio'); + //$accounttype1 = $this->input->post('myrad'); + //echo $accounttype; + //echo $accounttype1; + 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'); + + $gsttoggle = $this->input->post('gsttoggle'); + $invoiceno = null; + $merchantname = null; + $mergstno = null; + $hsn = null; + $beforegst = null; + $sgst = null; + $cgst = null; + $igst = null; + if(!empty($gsttoggle)) + { + $invoiceno = $this->input->post('Invoiceno'); + $merchantname = $this->input->post('merchant'); + $mergstno = $this->input->post('Merchantgst'); + $hsn = $this->input->post('hsn'); + $beforegst = $this->input->post('valuebeforegST'); + $sgst = $this->input->post('SGST'); + $cgst = $this->input->post('CGST'); + $igst = $this->input->post('IGST'); + + } + + + $cashbookamount=$this->input->post('totalamount1'); + $totalamount=$directamount+$cashbookamount; + $description = $this->input->post('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'] = '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->userdata('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->input->post('bankdate'); + $bankid = $this->input->post('bankid'); + $amount = $this->input->post('bankamount'); + $amounttype = $this->input->post('type'); + $forstatus = $this->input->post('forstatus'); + $alreadypaid=$this->input->post('alreadypaid'); + $alreadycreditpaid=$this->input->post('alreadycreditpaid'); + $debitamount=$this->input->post('debitamount'); + $creditamount=$this->input->post('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'] = '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() + { + + //echo "INSIDE UPLOAFD"; + + //$this->load->library('upload') + $pathinfo = pathinfo($_FILES['userfile']['name']); + $config['upload_path'] = 'uploads/banking/'; + $config['allowed_types'] = 'png|jpg|jpeg|xlsx'; + $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() + { + + $aid = $this->uri->segment(3); + + $data['data'] = $this->cashbook_model->getAccounutInfo(); + //print_r($data['dropdownvalues']);die(); + $this->global['pageTitle'] = 'Siddharth : Cash Book: View Income Expense '; + $this->loadViews("viewIndIncomeExpense", $this->global, $data , NULL); + + } + + public function index() + { + //$data['dropdownvalues1'] = $this->cashbook_model->getAccounTypes1(); + + $this->global['pageTitle'] = 'Siddharth : Cashbook Details'; + $this->loadViews("cashbooklisting", $this->global, NULL , NULL); + + } + + + + public function cashbookList() + { + + + $this->load->model('cashbook_model'); + $data['dropdownvalues1'] = $this->cashbook_model->getAccounTypes1(); + //print_r($data['dropdownvalues1']); + $data['cashbook'] = $this->cashbook_model->Selectcash(); + + $this->global['pageTitle'] = 'Siddharth : Cashbook Listing'; + + $this->loadViews("cashbooklisting", $this->global, $data, NULL); + + } + + + //advance list + public function AdvanceList() + { + + $aid = $this->uri->segment(3); + $str = $this->uri->segment(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().'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 = $this->load->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'] = 'Siddharth : Cash Book: View Income Expense '; + $this->loadViews("viewIndIncomeExpense", $this->global, $data , NULL); + + } + + }else{ + // $data['list'] = $this->cashbook_model->getIncomeExpenseList(); + // $this->global['pageTitle'] = 'Siddharth : Cash Book: Listing'; + + // $this->loadViews("income_expense_list", $this->global, $data , NULL); + $this->global['pageTitle'] = 'Siddharth : Cash Book: Listing'; + + if ($this->input->post('btn_submit')) { + + $fromdt = $this->input->post('from_date'); + $todt = $this->input->post('to_date'); + $ab=$this->input->post('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->input->post('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; + } + + + $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,'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) + { + + if($sid == '') + { + $cash = $_GET['sid']; + } + else + { + $cash = $sid; + } + + + $this->load->model('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'] = 'Siddharth : Edit Cashbook'; + $this->loadViews("editincomeexpenses", $this->global,$data, NULL); + + } + public function deletefile() + { + $cashfile = $this->input->post('id'); + $cashid = $this->input->post('ide'); + //echo 'dsmkjsn'; + //echo $cashid; + + //echo $cashfile; + //die(); + //$this->load->model('cashbook_model'); + $filedata= $this->cashbook_model->deletefile($cashid); + echo $filedata; + //$this->global['pageTitle'] = 'Siddharth : Edit Cashbook'; + //$this->loadViews("income_expense_list", $this->global,$data, NULL); + + } + function updateExpense() + { + $id1=$this->input->post('id1'); + $myradio1= $this->input->post('myradio'); + //$myradio2= $this->input->post('myrad'); + $option=''; + if($myradio1==1) + { + $option=RECEIPT; + } + else + { + $option=PAYMENT; + } + //echo $option;die(); + $ans1 = $this->input->post('ans'); + $Date1 = $this->input->post('Date'); + //echo $Date1; + $date = date_create($Date1);//,'Y-m-d'); + $date = date_format($date,'Y-m-d'); + //echo $date; + //$Date1 = $this->input->post('Date'); + $accountcode1 = $this->input->post('accode'); + //echo $accountcode1;die(); + $towhome1 = $this->input->post('towhome'); + $supplier = $this->input->post('supplier'); + $Invoiceno1 = $this->input->post('Invoiceno'); + $merchant1 = $this->input->post('merchant'); + $Merchantgst1 = $this->input->post('Merchantgst'); + $hsn1 = $this->input->post('hsn'); + $valuebeforegST1 = $this->input->post('valuebeforegST'); + $SGST1 = $this->input->post('SGST'); + $CGST1 = $this->input->post('CGST'); + $IGST1 = $this->input->post('IGST'); + $totalamount1 = $this->input->post('totalamount'); + $description1 = $this->input->post('description'); + $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; + + //$document1=$this->input->post('myfile'); + $fs = 0; + if(!empty($_FILES['myfile']['name'])) + { + //echo "FILE AVAILABLE"; + $config['file_name'] = $_FILES['myfile']['name']; + $config['upload_path'] = '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'] = 'Siddharth : Bank Statement'; + if ($this->input->post('btn_submit')) + { + $this->global['pageTitle'] = 'Siddharth : bankstatement'; + $ab=$this->input->post('financialyear'); + + $fa=substr($ab,0,-5); + $aa=substr($ab,5,5); + + + $fdate = $this->input->post('from_date'); + $tdate = $this->input->post('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'] = 'Siddharth : Bank Debit Report'; + if ($this->input->post('btn_submit')) + { + $Supplierid = $this->input->post('SupplierName'); + $fdate = $this->input->post('from_date'); + $tdate = $this->input->post('to_date'); + //$data['cash'] = $_GET['sid']; + //$data['bankid'] = $_GET['d']; + $data['bankdepit'] = $this->cashbook_model->debitbankstatemet($Supplierid,$fdate,$tdate); + } + +// print_r($data['bankdepit']); + $data['getsupplier'] = $this->cashbook_model->getsupplier(); + $this->loadViews("bankdebit",$this->global,$data,NULL); + //die(); + + } + public function bankinvoice() + { + $this->global['pageTitle'] = 'Siddharth : Bank Invoice Report'; + if ($this->input->post('btn_submit')) + { + $Customer = $this->input->post('Customer'); + $fdate = $this->input->post('from_date'); + $tdate = $this->input->post('to_date'); + $data['bankinvoicedata'] = $this->cashbook_model->bankinvoice($Customer,$fdate,$tdate); + //$data['supplier'] = $this->cashbook_model->getsupplier(); + } + $data['getcustomer'] = $this->cashbook_model->getcustomer(); + + $this->loadViews("bankinvoice", $this->global,$data,NULL); + + } + + + 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); + // print_r($data); + echo json_encode($data); + + + } + /*end*/ + + 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'] = 'Siddharth : Bank Report - Debited Settlements'; + $SupplierName = $this->input->post('SupplierName'); + $fdate = $this->input->post('from_date'); + $tdate = $this->input->post('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->mappingcash($SupplierName,$fdate,$tdate,$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'] = 'Siddharth : Cashbook Listing'; + $this->global['pageTitle'] = 'Siddharth : Bank Report - Credited Settlements'; + $SupplierName = $this->input->post('SupplierName'); + $fdate = $this->input->post('from_date'); + $tdate = $this->input->post('to_date'); + $bankid= $_GET['d']; + $data['clearbalance']=$_GET['cb']; + // if($data['clearbalance']==0) + // { + // echo ""; + // redirect('Bankingstatement','refresh'); + // } + // else + // { + $data['balancetoclear']=$_GET['btc']; + $data['mappingcashbook']=$this->cashbook_model->mappingcash($SupplierName,$fdate,$tdate,$bankid); + $data['mappingiv'] = $this->cashbook_model->creditinvoicelist($bankid); + $data['paidcbook'] = $this->cashbook_model->cashbookamount($bankid); + $data['invoiceramount'] = $this->cashbook_model->invoiceamonut($bankid); + $data['supplier'] = $this->cashbook_model->getsupplier(); + //redirect('Bankingstatement','refresh'); + $this->loadViews("bankinvoicesettlement", $this->global,$data,NULL); + //} + } + public function mappingdebit() + { + + + // $this->global['pageTitle'] = 'Siddharth : mappingdebit'; + $this->global['pageTitle'] = 'Siddharth : Bank Report - Debited Details'; + $SupplierName = $this->input->post('SupplierName'); + $fdate = $this->input->post('from_date'); + $tdate = $this->input->post('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'] = 'Siddharth : mappingcredit'; + $this->global['pageTitle'] = 'Siddharth : Bank Report - Credited Details '; + $SupplierName = $this->input->post('SupplierName'); + $fdate = $this->input->post('from_date'); + $tdate = $this->input->post('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'] = 'Siddharth : Bank Report - Store Debited Details'; + $check = $this->input->post('check'); + // echo 'check'.$check; + $rw = $this->input->post('rw'); + // echo 'rw'.$rw; + $date = $this->input->post('podate'); + $date = date_create($date); + $date = date_format($date,'Y-m-d'); + $pono = $this->input->post('pono'); + $igrno=$this->input->post('igrno'); + $igrlineitem=$this->input->post('igrlineitem'); + + $sname = $this->input->post('sname'); + $tot = $this->input->post('tot'); + // echo'tot'.$tot; + + $rowcount = $this->input->post('rc'); + + $totalpaidamount= $this->input->post('tpv'); + //echo 'totalpaidamount'.$totalpaidamount; + + $bankdebitamountamount= $this->input->post('bda'); + //echo 'bankdebitamountamount'.$bankdebitamountamount; + $bankid =$this->input->post('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($igrlineitem); + if(empty($earlypaid)) + { + $ePay=0; + } + else + { + foreach($earlypaid as $ep) + { + $ePay = $ep->Amountpaid; + } + } + //echo 'epay'.$epay; + + $ip=$this->input->post('aa'); + $balancetopay=($tot-($ip+$ePay)); + + + $amtpaid= ($ip+$ePay); + $IsActive=1; + + $podata1 = array('Podate'=>$date,'PONO'=>$pono,'IGRNO'=>$igrno,'Suppliername'=>$sname,'Totalpoamount'=>$tot,'Amountpaid'=>$ip,'Balancetopay'=>$balancetopay,'mid'=>$bankid,'IGRLineItemNo'=>$igrlineitem,'IsActive'=>$IsActive); + + $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($igrlineitem); + + $resultn = $this->cashbook_model->mappingpo($podata1); + if(count($result3)<=0) + { + + $result = $this->cashbook_model->podata($podata); + + } + else + { + //echo "update"; + $result3 = $this->cashbook_model->poupdate($podata,$igrlineitem); + + } + if($rw == $rowcount) + { + echo "Saved Successfully!"; + } + + + + if($balancetopay==0) + { + $igrstatus=AMOUNT_PAIDIGR; + } + else + { + $igrstatus=PARTIALLY_PAIDIGR; + } + $igrdetails=array('BankStatus'=>$igrstatus); + $result1 = $this->cashbook_model->igrdetailstatus($igrdetails,$igrlineitem); + //$result1 = $this->cashbook_model->poamountstatus($pomaster,$pono); + $this->loadViews("bankstatement", $this->global,$data, NULL); + } + public function invoiceamount1() + { + //$this->global['pageTitle'] = 'Siddharth : Cashbook Listing'; + $this->global['pageTitle'] = 'Siddharth : Bank Report - Store Credited Details'; + $check = $this->input->post('check'); + $rw = $this->input->post('rw'); + + $date = $this->input->post('date'); + $date = date_create($date);//,'Y-m-d'); + $date = date_format($date,'Y-m-d'); + $invid = $this->input->post('invid'); + $cname = $this->input->post('cname'); + $invamount = $this->input->post('invamount'); + $invoicereceived = $this->input->post('ir'); + $rowcount = $this->input->post('rc'); + $totalpaidamount= $this->input->post('tpv'); + $bankcreditamount= $this->input->post('bda'); + $invoicetext=$this->input->post('invrec'); + $bankid =$this->input->post('bi'); + $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); + if(empty($earlyreceived)) + { + $eRec=0; + } + else + { + foreach($earlyreceived as $ec) + { + $eRec = $ec->amountreceived; + } + } + //echo $eRec; + $ip=$this->input->post('ar'); + $balancetoreceived1=($invamount-($ip+$eRec)); + $amtpaid= ($ip+$eRec); + + $updateamount=($totalpaidamount+$eRec); + $IsActive=1; + $invoicedata1 = array('indate'=>$date,'invoiceno'=>$invid,'customername'=>$cname,'totinvoiceamount'=>$invamount,'balancetoreceived'=>$balancetoreceived1,'amountreceived'=>$amtpaid,'bankid'=>$bankid); + + $invoicedata = array('indate'=>$date,'invoiceno'=>$invid,'customername'=>$cname,'totinvoiceamount'=>$invamount,'balancetoreceived'=>$balancetoreceived1,'amountreceived'=>$ip,'bankid'=>$bankid,'IsActive'=>$IsActive); + + // //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); + + } + if($balancetoreceived1==0) + { + $status=AMOUNT_RECEIVED; + + } + else + { + $status=PARTIALLY_RECEIVED; + } + $invoicemaster= array('receivedstatus'=>$status); + + $result1 = $this->cashbook_model->invoiceamountstatus($invoicemaster,$invid); + + echo ""; + + } + public function amountpaid() + { + + //$this->global['pageTitle'] = 'Siddharth : amountpaid'; + $this->global['pageTitle'] = 'Siddharth : Bank Report - Amount Payment Details'; + if ($this->input->post('btn_submit')) + { + $SupplierName = $this->input->post('SupplierName'); + $fdate = $this->input->post('from_date'); + $tdate = $this->input->post('to_date'); + $data['bankdebit'] = $this->cashbook_model->debitpolistfilter($SupplierName,$fdate,$tdate); + } + $data['amountpaid'] = $this->cashbook_model->paided(); + $data['supplier'] = $this->cashbook_model->getsupplier(); + $this->loadViews("bankamountpaid", $this->global,$data, NULL); + + } + public function amountunpaid() + { + + $this->global['pageTitle'] = 'Siddharth : Bank Debit Report'; + if ($this->input->post('btn_submit')) + { + $Supplierid = $this->input->post('SupplierName'); + $fdate = $this->input->post('from_date'); + $tdate = $this->input->post('to_date'); + //$data['cash'] = $_GET['sid']; + //$data['bankid'] = $_GET['d']; + $data['bankdepit'] = $this->cashbook_model->debitbankstatemet($Supplierid,$fdate,$tdate); + } + + + $data['getsupplier'] = $this->cashbook_model->getsupplier(); + $this->loadViews("bankamountunpaid",$this->global,$data,NULL); + //die(); + + } + public function amountreceived() + { + + + // $this->load->model('cashbook_model'); + //$this->global['pageTitle'] = 'Siddharth : Cashbook Listing'; + $this->global['pageTitle'] = 'Siddharth : Bank Report - Received Amount Details'; + if ($this->input->post('btn_submit')) + { + $Customer = $this->input->post('Customer'); + $fdate = $this->input->post('from_date'); + $tdate = $this->input->post('to_date'); + + $data['bankcredit'] = $this->cashbook_model->creditinvoicelistfilter($Customer,$fdate,$tdate); + } + $data['getcustomer'] = $this->cashbook_model->getcustomer(); + $data['amountreceived'] = $this->cashbook_model->received(); + $this->loadViews("bankamountreceived", $this->global,$data, NULL); + + } + public function cashbanking() + { + $this->global['pageTitle'] ='Siddharth :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->input->post('Totalpoamount'); + $Amount = $this->input->post('paidamount'); + $id=$this->input->post('mappingid'); + $igrno = $this->input->post('IGRItemNo'); + $Bankid = $this->input->post('bankid'); + $balancetoclear=$this->input->post('balancetobankingclear'); + $clearedbalance=$this->input->post('clearbalance'); + $updateamount=$clearedbalance-$Amount; + $updatebalancetoclear=$Amount+$balancetoclear; + $data['$bankmappingamount'] = $this->cashbook_model->gettotalbankmappingpo($igrno); + $amountpaid=$data['$bankmappingamount'][0]->Amountpaid; + //$data['$totallineitemamount']=$this->cashbook_model->gettotallineitem($igrno); + + if($amountpaid==$totalamount) + { + $BankStatus=NO_PAIDIGR; + } + else + { + $BankStatus=PARTIALLY_PAIDIGR; + } + + $result= $this->cashbook_model->IgrDetailsStatusUpdate($igrno,$BankStatus); + $result1= $this->cashbook_model->deletemapping($Bankid,$updateamount,$updatebalancetoclear); + //for update mapping amount in t_bankmappingpo table// + $balancetopay=$this->input->post('balancetopay'); + $totalbalancetopay=$Amount+$balancetopay; + $updatebankpoamount=$totalamount-$totalbalancetopay; + //$updateamount=0; + $IsActive=0; + $result2= $this->cashbook_model->deleteBankmappingpo($id,$IsActive); + //for update mapping amount inT_Bankporeport table// + //die(); + $result3= $this->cashbook_model->updateBankporeportpo($igrno,$totalbalancetopay,$updatebankpoamount,$Bankid); + $this->loadViews("bankstatement", $this->global,$data, NULL); + } + public function Deletemappingpo() + { + $totalamount = $_GET['totalpoamount']; + $Bankid = $_GET['bankid']; + $Amount = $_GET['amount']; + $igrno = $_GET['igrno']; + $balancetoclear=$_GET['balancetoclear']; + //for T_Bankreport IsActive// + $bankdebit=$_GET['debit']; + $mapped= $Amount+$balancetoclear; + if( $bankdebit==$mapped) + { + $active=0; + } + else + { + $active=1; + } + + ///////////////// + + $id=$_GET['id']; + + $bankamount=$_GET['bankamount']; + $updateamount=$bankamount-$Amount; + $updatebalancetoclear=$Amount+$balancetoclear; + $data['$bankmappingamount'] = $this->cashbook_model->gettotalbankmappingpo($igrno); + $amountpaid=$data['$bankmappingamount'][0]->Amountpaid; + //if($Amount==) + + //$data['$totallineitemamount']=$this->cashbook_model->gettotallineitem($igrno); + + + if($amountpaid==$totalamount) + { + $BankStatus=NO_PAIDIGR; + } + else + { + $BankStatus=PARTIALLY_PAIDIGR; + } + + $result= $this->cashbook_model->IgrDetailsStatusUpdate($igrno,$BankStatus); + $result1= $this->cashbook_model->deletemapping($Bankid,$updateamount,$updatebalancetoclear,$active); + //for update mapping amount in t_bankmappingpo table// + $balancetopay=$_GET['balancetopay']; + $totalbalancetopay=$Amount + $balancetopay; + $IsActive=0; + $updatebankpoamount=$totalamount-$totalbalancetopay; + $result2= $this->cashbook_model->deleteBankmappingpo($id,$IsActive); + //for update mapping amount inT_Bankporeport table// + $result3= $this->cashbook_model->updateBankporeportpo($igrno,$totalbalancetopay,$updatebankpoamount,$Bankid,$active); + + if(count($result2)>0) + { + redirect('Bankingstatement','refresh'); + } + + } + public function deletemappingiv() + { + + $this->global['pageTitle'] = 'Siddharth : Bank Report - Delete Mapping Invoice'; + $credit= $this->input->post('credit'); + $invoiceno = $this->input->post('invoiceno'); + $bankid = $this->input->post('bankid'); + $mappingid=$this->input->post('mappingid'); + $amountreceived = $this->input->post('amountreceived'); + $bankingclear = $this->input->post('bankingclear'); + $bankingbalclear = $this->input->post('bankingbalclear'); + $totinvoiceamount = $this->input->post('totinvoiceamount'); + $balancetoreceived = $this->input->post('balancetoreceived'); + $updatebalancetoclear=$amountreceived+$bankingbalclear; + if($amountreceived<0) + { + $updateclearbalance=$bankingclear-($amountreceived);//450-(-250) + } + else + { + $updateclearbalance=$bankingclear-$amountreceived;//450-650 + } + + // if($amountreceived<0) + // { + // $updatebalancetoclear=$amountreceived+$bankingbalclear; + // $updateclearbalance=$amountreceived+$bankingclear; + // } + // else + // { + // $updatebalancetoclear=$bankingbalclear+$amountreceived; + // $updateclearbalance=$bankingclear+$amountreceived; + // } + + //update Isactive field in T_Bankreport ////// + $mapped=$balancetoreceived+$amountreceived; + if($credit==$mapped) + { + $active=0; + } + else + { + $active=1; + } + $bankstatement=array('cbalancetocleared'=>$updatebalancetoclear,'cclearbalance'=>$updateclearbalance,'IsActive'=>$active); + $result1= $this->cashbook_model->updatebankreportiv($bankid,$bankstatement); + if($totinvoiceamount==$amountreceived) + { + $receivedstatus=NO_RECEIVED; + } + else + { + $receivedstatus=PARTIALLY_RECEIVED; + } + $IsActive=0; + //$data['$latestamount'] = $this->cashbook_model->getlatestamount($invoiceno); + //print_r($data['$latestamount']); + //die(); + //$balancetoreceived1=$data['$latestamount'][0]->balancetoreceived; + $updatebalancetoreceived=$balancetoreceived+$amountreceived; + $updateamountreceived=$totinvoiceamount-$updatebalancetoreceived; + $result3= $this->cashbook_model->updatebankinvoicereport($invoiceno,$bankid,$updatebalancetoreceived,$updateamountreceived); + if(count($result3)>0) + { + $result1=$this->cashbook_model->UpdateIpinvoiceStatus($invoiceno,$receivedstatus); + $result2= $this->cashbook_model->deletemappinginvoice($mappingid,$IsActive); + } + $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; + } + +} ?> \ No newline at end of file diff --git a/application/controllers/cashbook_model.php b/application/controllers/cashbook_model.php new file mode 100644 index 00000000..5cc5536d --- /dev/null +++ b/application/controllers/cashbook_model.php @@ -0,0 +1,1094 @@ +db->where('status',1); + $r = $this->db->get('t_accountcode'); + return $r->result(); + + } + function getAccountpay() + { + $this->db->where('type',PAYMENT); + $r = $this->db->get('t_accountcode'); + return $r->result(); + + } + function getAccounTypes1() + { + $this->db->select('name,type'); + $r = $this->db->get('t_accountcode'); + return $r->result(); + + } + + function saveIncomeExpense($data) + { + $this->db->insert('t_income_expense',$data); + $r = $this->db->affected_rows(); + return $r; + } + // function addcashbook($bankcash1) + // { + // $this->db->insert('T_Bankmappingcashbook',$bankcash1); + // $r = $this->db->affected_rows(); + // return $r; + // } + + function getIncomeExpenseList($i="") + { + // echo $i; + $this->db->select('t_accountcode.name,cashtype,T_Employee_Details.FirstName,T_Employee_Details.LastName,t_income_expense.*'); + $this->db->from('t_income_expense'); + $this->db->join('t_accountcode','t_income_expense.account_code=t_accountcode.code','left'); + $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->order_by("date","desc"); + if(!empty($i)) + { + $this->db->where('t_income_expense.id',$i); + + } + $r = $this->db->get(); + return $r->result(); + } + + function getIncomeExpense($firstyear,$secondyear,$frmdt,$todt) + { + $this->db->select('t_accountcode.name,cashtype,T_Employee_Details.FirstName,T_Employee_Details.LastName,t_income_expense.*'); + $this->db->from('t_income_expense'); + $this->db->join('t_accountcode','t_income_expense.account_code=t_accountcode.code','left'); + $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'); + 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); + } + $this->db->order_by("date","desc"); + $r = $this->db->get(); + return $r->result(); + } + + function getAdvanceList($i="") + { + // echo $i; + $this->db->select('t_accountcode.name,cashtype,T_Employee_Details.FirstName,T_Employee_Details.LastName,t_income_expense.*'); + $this->db->from('t_income_expense'); + $this->db->join('t_accountcode','t_income_expense.account_code=t_accountcode.code','left'); + $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->or_where('t_income_expense.account_code','0013'); + $this->db->order_by("date","desc"); + if(!empty($i)) + { + $this->db->where('t_income_expense.id',$i); + + } + $r = $this->db->get(); + return $r->result(); + } + + function getAdvance($firstyear,$secondyear,$frmdt,$todt) + { + $this->db->select('t_accountcode.name,cashtype,T_Employee_Details.FirstName,T_Employee_Details.LastName,t_income_expense.*'); + $this->db->from('t_income_expense'); + $this->db->join('t_accountcode','t_income_expense.account_code=t_accountcode.code','left'); + $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->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); + } + $this->db->order_by("date","desc"); + $r = $this->db->get(); + return $r->result(); + } + +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(); + + } + function getCompany() + { + $r = $this->db->get('T_Company_Details'); + return $r->result(); + + + } + + function getAccounutInfo($i) + { + $this->db->select('t_accountcode.name,t_income_expense.*'); + $this->db->from('t_income_expense'); + $this->db->join('t_accountcode','t_income_expense.account_code=t_accountcode.code'); + $this->db->order_by("date", "desc"); + //$this->db->where('t_income_expense.id') + $r = $this->db->get(); + return $r->result(); + + } + + function Selectcash() + { + $this->db->select('*'); + $this->db->from('t_accountcode'); + $query = $this->db->get(); + $result = $query->result(); + return $result; + + } + + + function Selectadvance($i="") + { + // echo $i; + $this->db->select('T_SupplierDetailsN.SupplierName,t_accountcode.name,cashtype,T_Employee_Details.FirstName,T_Employee_Details.LastName,t_income_expense.*'); + $this->db->from('t_income_expense'); + $this->db->join('t_accountcode','t_income_expense.account_code=t_accountcode.code','left'); + $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->join('T_SupplierDetailsN','T_SupplierDetailsN.SupplierID=t_income_expense.Supplier_id' ); + $this->db->order_by("date","desc"); + $this->db->where_in('t_accountcode.code',[AReceipt,Apayment]); + if(!empty($i)) + { + $this->db->where('t_income_expense.id',$i); + + } + $r = $this->db->get(); + return $r->result(); + } + + + function viewdepartment($sid='') + { + $sql="SELECT ie.*,br.*,br.ID,ie.totalbankamount,ac.name,ie.id,date_format(ie.date,'%d-%m-%Y')as date FROM t_income_expense ie + left join t_accountcode ac on ac.code=ie.account_code + left join T_bankreport br on br.ID=ie.bankid + WHERE ie.id = ?"; + $query = $this->db->query($sql,array($sid)); + //print_r($this->db->last_query()); + //echo $sql; + return $query->result(); + } + function deletefile($cashid) + { + + //echo $cashid; + $sql="UPDATE t_income_expense SET document = NULL + WHERE id = ?"; + $query = $this->db->query($sql,array($cashid)); + //print_r($this->db->last_query()); + //echo $sql; + $r = $this->db->affected_rows(); + return $r; + } + + + function updatedepartment($updateaccount,$id1) + { + $this->db->where('id', $id1); + $this->db->update('t_income_expense',$updateaccount); + $r = $this->db->affected_rows(); + return $r; + + } + function bankfile($FileDetails) + { + $this->db->insert('T_bankingfile',$FileDetails); + $r = $this->db->affected_rows(); + return $r; + } + function bankfiledata($filedataupload) + { + + + $this->db->select('reportdate,Narration,Balance'); + $this->db->from('T_bankreport'); + $this->db->where('reportdate',$filedataupload['reportdate']); + $this->db->where('Narration',$filedataupload['Narration']); + $this->db->where('Balance',$filedataupload['Balance']); + + $query = $this->db->get(); + 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; + } +} + +function balance($balance){ + + + $this ->db->insert('T_bankbalance',$balance); +} + +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 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 != ''){ + + $sql.=" and (reportdate >= '".$fa."-04-01' and reportdate<= '".$aa."-03-31')"; + + } + if ($fdate and $tdate != '') + { + + $fdate= date("Y-m-d",strtotime($fdate)); + $tdate=date("Y-m-d",strtotime($tdate)); + + $sql.= " and date(reportdate) >= '".$fdate."' + and date(reportdate) <= '".$tdate."'"; + } + + + + + $sql.=" group by(br.ID) "; + $sql.=" ORDER BY br.ID+0 DESC "; + + + $query = $this->db->query($sql); + return $query->result(); + + + +} +function cleareddebitbalance(){ + + $sql = "SELECT SUM(Balancetocleared) as debit FROM T_bankreport where Clearbalance >'0'"; + + $query = $this->db->query($sql); + return $query->result(); + + +} +function clearedcreditbalance(){ + + $sql = "SELECT SUM(cbalancetocleared) as credit FROM T_bankreport where cclearbalance >'0'"; + + $query = $this->db->query($sql); + return $query->result(); + + +} + + + function debitbankstatemet($Supplierid,$fdate,$tdate) + { + $status='ST057'; + //echo $tdate; + //die(); + // +rt.SGST/100+rt.IGST/100)) + //$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,(igrli.QuantityAsPerInvoice * poli.Rate)+(igrli.QuantityAsPerInvoice * poli.Rate)*(rt.CGST/100)+(igrli.QuantityAsPerInvoice * poli.Rate)*(rt.SGST/100)+(igrli.QuantityAsPerInvoice * poli.Rate)*(rt.IGST/100) as finalamount'); + $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'); + $this->db->join('T_PurchaseOrder_Master pom','poli.PONO =pom.PONO'); + $this->db->join('T_SupplierDetailsN supp','pom.SupplierID =supp.SupplierID'); + $this->db->join('T_Revenue_Tax rt','poli.LineItemNo=rt.LineItemNo'); + $this->db->join ('T_Bankporeport BR','igrli.IGRItemNo = BR.IGRLineItemNo','left'); + if ($fdate and $tdate != ''){ + $fromdate= date("Y-m-d",strtotime($fdate)); + $todate=date("Y-m-d",strtotime($tdate)); + $date = "date(igr.CreatedDate) >= '".$fromdate."' + and date(igr.CreatedDate) <= '".$todate."'"; + $this->db->where($date); + } + if ($Supplierid != ''){ + $this->db->where('supp.SupplierID',$Supplierid); + } + $this->db->where_in('igr.IGRStatus','ST027'); + //$this->db->where_in('pom.Status',[ST044,ST056]); + $this->db->where('igrli.BankStatus','ST072'); + $query = $this->db->get(); + return $query->result(); + + } + function bankinvoice($Customer,$fdate,$tdate) + { + // $status='ST065'; + $this->db->distinct(); + $this->db->select('iva.invoice_id,iva.invoice_total,iv.invoice_date_created,iv.invoice_number,iva.invoice_paid,ic.client_name,BI.balancetoreceived,BI.amountreceived'); + $this->db->from ('ip_invoice_amounts iva'); + $this->db->join ('ip_invoices iv','iva.invoice_id = iv.invoice_id'); + $this->db->join ('ip_clients ic','iv.client_id = ic.client_id','left'); + $this->db->join ('T_Bankinvoicereport BI',' iv.invoice_number =BI.invoiceno','left'); + //$this->db->where('iva.receivedstatus !=','ST065'); + $this->db->where('iv.invoice_status_id','2'); + $this->db->where('iv.receivedstatus !=','ST065'); + if ($fdate and $tdate != ''){ + $fromdate= date("Y-m-d",strtotime($fdate)); + $todate=date("Y-m-d",strtotime($tdate)); + $date = "date(iv.invoice_date_created) >= '".$fromdate."' + and date(iv.invoice_date_created) <= '".$todate."'"; + $this->db->where($date); + } + if ($Customer != ''){ + $this->db->where('ic.client_id',$Customer); + } + $this->db->group_by('iva.invoice_id'); + //$this->db->where('inc.type','PAYMENT'); + $query = $this->db->get(); + return $query->result(); + + } + +function receiptdata() + { + + $this->db->distinct(); + $this->db->select('inc.type,inc.date,inc.account_code,inc.towhom,inc.total'); + $this->db->from ('t_income_expense inc'); + $this->db->where('inc.type','RECEIPT'); + $query = $this->db->get(); + return $query->result(); + + } + function paymentdata() + { + + $this->db->distinct(); + $this->db->select('inc.type,inc.date,inc.account_code,inc.towhom,inc.total'); + $this->db->from ('t_income_expense inc'); + //$this->db->group_by('inc.account_code'); + //$this->db->where('inc.type','PAYMENT'); + $query = $this->db->get(); + return $query->result(); + + } + + + + function debitimage($igrno,$pono) + { + + $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,inward.FilePath as Fpath'); + $this->db->from ('T_Bankporeport bm'); + $this->db->join ('T_IGR_Master igrm','igrm.PONO = bm.PONO or igrm.IGRNO = bm.IGRNO ','left'); + //$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_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)).'"'); + } + if($SupplierName!='') + { + $this->db->where('sd.SupplierID',$SupplierName); + } + + + $this->db->group_by('bm.id'); + $query = $this->db->get(); + 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, + bm.balancetoreceived,bm.amountreceived,bm.ID,br.Credit'); + $this->db->from ('T_Bankmappingiv bm'); + $this->db->join('T_bankreport br','br.ID=bm.bankid'); + $this->db->where('bm.bankid',$bankid); + $this->db->where('bm.IsActive',1); + //$this->db->group_by('invoiceno'); + $query = $this->db->get(); + return $query->result(); + + } + function creditinvoicelistfilter($Customer,$fdate,$tdate) + { + $this->db->select('bm.ID,bm.indate,bm.invoiceno,bm.customername,bm.totinvoiceamount,bm.bankid, + bm.balancetoreceived,bm.amountreceived,br.cclearbalance,br.cbalancetocleared'); + $this->db->from ('T_Bankmappingiv bm'); + $this->db->where('bm.IsActive',1); + $this->db->join ('ip_clients ic','ic.client_name = bm.customername','left'); + $this->db->join('T_bankreport br','br.ID = bm.bankid'); + if($fdate!='' && $tdate!='') + { + $this->db->where('bm.indate BETWEEN "'. date('Y-m-d', strtotime($fdate)). '" and "'. date('Y-m-d', strtotime($tdate)).'"'); + } + if($Customer!='') + { + $this->db->where('ic.client_id',$Customer); + } + //$this->db->group_by('invoiceno'); + + $query = $this->db->get(); + return $query->result(); + + } + //for cashbook edit screen and update bankreport// + function invoiceamonut($bankid) + { + $this->db->select('sum(amountreceived)as amountreceived'); + $this->db->from ('T_Bankmappingiv'); + $this->db->where('bankid',$bankid); + $this->db->where('IsActive',1); + //$this->db->group_by('invoiceno'); + $query = $this->db->get(); + return $query->result(); + + } + //for cashbook edit screen and update bankreport// + function poamonut($bankid) + { + $this->db->select('sum(Amountpaid)as amountpaid'); + $this->db->from ('T_Bankmappingpo'); + $this->db->where('mid',$bankid); + $this->db->where('IsActive',1); + //$this->db->group_by('invoiceno'); + $query = $this->db->get(); + return $query->result(); + + } + function cashbookamount($bankid) + { + $this->db->select('sum(total)as total'); + $this->db->from ('t_income_expense'); + $this->db->where('bankid',$bankid); + $this->db->where('IsActive',1); + //$this->db->group_by('invoiceno'); + $query = $this->db->get(); + return $query->result(); + + } + + function mappingcash($SupplierName,$fdate,$tdate,$bankid) + { + $this->db->select('ie.id,ie.date,ie.bankid,ie.cashtype,ie.amounttype,ie.total,ac.name,totalbankamount,ie.id'); + $this->db->from ('t_income_expense as ie'); + $this->db->join ('t_accountcode ac ','ac.code = ie.account_code','left'); + $this->db->where('bankid',$bankid); + $this->db->where('IsActive',1); + //$this->db->group_by('mid'); + $query = $this->db->get(); + return $query->result(); + + } + function newcashbook() + { + $this->db->select('cdate,mid,btype,amount,boption,mappingamount,totalamount,amounttype,alreadycreditpaid'); + $this->db->from ('T_Bankmappingcashbook'); + //$this->db->where('mid',$bankid); + + //$this->db->group_by('mid'); + $query = $this->db->get(); + return $query->result(); + + } + + function debitlistpo($pono) + { + $this->db->select('bmp.mid,bmp.PONO,bmp.IGRLineItemNo,bmp.Amountpaid'); + $this->db->from ('T_Bankmappingpo as bmp'); + // $this->db->join('T_bankreport br','br.ID = bmp.mid'); + $this->db->where('bmp.PONO',$pono); + $this->db->where('bmp.IsActive',1); + $query = $this->db->get(); + return $query->result(); + + } + + function creditlistinv($invno) + { + $this->db->select('bmp.bankid,bmp.invoiceno,bmp.amountreceived,br.Narration'); + $this->db->from ('T_Bankmappingiv as bmp'); + $this->db->join('T_bankreport br','br.ID = bmp.bankid'); + $this->db->where('invoiceno',$invno); + $this->db->where('bmp.IsActive',1); + //$this->db->group_by('invoiceno'); + $query = $this->db->get(); + return $query->result(); + + } + + function getsupplier() + { + $this->db->select('SupplierName,SupplierID'); + $this->db->from('T_SupplierDetailsN'); + //$this->db->join('t_accountcode','t_income_expense.account_code=t_accountcode.code'); + //$this->db->where('t_income_expense.id') + $r = $this->db->get(); + return $r->result(); + + } + + function checkMerchant($mer){ + + $temp[] = '' ; + $this->db->distinct(); + $this->db->select('SupplierID,SupplierName'); + $this->db->from('T_SupplierDetailsN'); + $this->db->like('SupplierName',$mer); + $query = $this->db->get(); + + $temparr[] = '' ; + foreach($query->result() as $arr){ + $temparr[] = $arr->SupplierName; + } + $temp['suggestions'] = $temparr; + + return $temp; + } + + function getsupp_dtls($s){ + $this->db->select('GSTNO'); + $this->db->from('T_SupplierDetailsN'); + $this->db->where('SupplierName',$s); + $r = $this->db->get(); + return $r->result(); + } + + function getcustomer() + { + $this->db->select('client_name,client_id'); + $this->db->from('ip_clients'); + //$this->db->join('t_accountcode','t_income_expense.account_code=t_accountcode.code'); + //$this->db->where('t_income_expense.id') + $r = $this->db->get(); + return $r->result(); + + } + function invoicedata($invoicedata) + { + $this->db->insert('T_Bankinvoicereport',$invoicedata); + // $this->db->where('PONO',$pono); + $r = $this->db->affected_rows(); + return $r; + } + function podata($podata) + { + $this->db->insert('T_Bankporeport',$podata); + // $this->db->where('PONO',$pono); + $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); + // $this->db->where('PONO',$pono); + $r = $this->db->affected_rows(); + return $r; + } + function mappinginvoice($invoicedata) + { + $this->db->insert('T_Bankmappingiv',$invoicedata); + // $this->db->where('PONO',$pono); + $r = $this->db->affected_rows(); + return $r; + } + + + public function getpono($igrlineitem) + { + $this->db->select('IGRLineItemNo'); + $this->db->from('T_Bankporeport'); + $this->db->where('IGRLineItemNo ',$igrlineitem); + $query = $this->db->get(); + // print_r( $this->db->last_query()); + return $query->result(); + + } + public function invoiceupdate($invid) + { + $this->db->select('invoiceno'); + $this->db->from('T_Bankinvoicereport'); + $this->db->where('invoiceno',$invid); + $query = $this->db->get(); + // print_r( $this->db->last_query()); + return $query->result(); + + } + public function bankid($pono) + { + $this->db->select('PONO'); + $this->db->from('T_Bankporeport'); + $this->db->where('PONO ',$pono); + $query = $this->db->get(); + // print_r( $this->db->last_query()); + return $query->result(); + + } + public function cashbankupdate($cashbookstatus,$bankid) + { + // echo $bankid; + $this->db->where('ID',$bankid); + $this->db->update('T_bankreport',$cashbookstatus); + return TRUE; + + } + function cashcreditupdate($cashbookstatus1,$bankid) + { + + $this->db->where('ID',$bankid); + $this->db->update('T_bankreport',$cashbookstatus1); + return TRUE; + } + public function bankupdate($bankdata,$bankid) + { + $this->db->where('ID ',$bankid); + $this->db->update('T_bankreport',$bankdata); + return TRUE; + + } + public function bankcreditupdate($bankcreditdata,$bankid) + { + + + $this->db->where('ID ',$bankid); + $this->db->update('T_bankreport',$bankcreditdata); + + // print_r( $this->db->last_query()); + return TRUE; + + } + public function getearlyamount($igrlineitem) + { + $this->db->select('Amountpaid'); + $this->db->from('T_Bankporeport'); + $this->db->where('IGRLineItemNo ',$igrlineitem); + $query = $this->db->get(); + // print_r( $this->db->last_query()); + return $query->result(); + + } + public function getearlyamountcredit($invid) + { + $this->db->select('amountreceived'); + $this->db->from('T_Bankinvoicereport'); + $this->db->where('invoiceno ',$invid); + $query = $this->db->get(); + // print_r( $this->db->last_query()); + return $query->result(); + + } + public function getalreadypaid($bankid) + { + $this->db->select('Clearbalance'); + $this->db->from('T_bankreport'); + $this->db->where('ID ',$bankid); + $query = $this->db->get(); + // print_r( $this->db->last_query()); + return $query->result(); + + } + public function getalreadyreceived($bankid) + { + $this->db->select('cclearbalance'); + $this->db->from('T_bankreport'); + $this->db->where('ID ',$bankid); + $query = $this->db->get(); + // print_r( $this->db->last_query()); + return $query->result(); + + } + + public function poupdate($podata,$igrlineitem) + { + + $this->db->where('IGRLineItemNo',$igrlineitem); + $this->db->update('T_Bankporeport',$podata); + + return TRUE; + } + public function invoiceupdate1($invoicedata,$invid) + { + //print_r($invoicedata); + //print_r($invid); + $this->db->where('invoiceno',$invid); + $this->db->update('T_Bankinvoicereport',$invoicedata); + + return TRUE; + } + function paided() + { + $this->db->select('*'); + $this->db->from('T_Bankmappingpo'); + $query = $this->db->get(); + $result = $query->result(); + return $result; + + } + // function unpaided() + // { + // // $this->db->select('igd.IGRNO,igd.IGRItemNo,pom.PONO,sm.SupplierName'); + // // $this->db->from('T_IGR_Details igd'); + // // $this->db->join('T_IGR_Master igm','igm.IGRNO=igd.IGRNO'); + // // $this->db->join('T_PurchaseOrder_LineItem poli','igm.PONO= poli.PONO and igd.MaterialCode=poli.MaterialCode'); + // // $this->db->join('T_PurchaseOrder_Master pom','pom.PONO=poli.PONO'); + // // $this->db->join('T_SupplierDetailsN sm','sm.SupplierID=pom.SupplierID'); + // // $this->db->where('igd.BankStatus','ST072'); + // // $query = $this->db->get(); + // // $result = $query->result(); + // // return $result; + + // } + function received() + { + $this->db->select('*'); + $this->db->from('T_Bankmappingiv'); + $query = $this->db->get(); + $result = $query->result(); + return $result; + + } + + + function igrdetailstatus($igrdetails,$igrlineitem) + { + $this->db->where('IGRItemNo',$igrlineitem); + $this->db->update('T_IGR_Details',$igrdetails); + $r = $this->db->affected_rows(); + return $r; + + } + function invoiceamountstatus($invoicemaster,$invid) + { + + $this->db->where('invoice_number',$invid); + $this->db->update('ip_invoices',$invoicemaster); + $r = $this->db->affected_rows(); + return $r; + + } + // function poamountstatus1($pomaster1,$pono) + // { + // $this->db->where('PONO', $pono); + // $this->db->update('T_PurchaseOrder_Master',$pomaster1); + // $r = $this->db->affected_rows(); + // return $r; + + // } + + function Cashbook($cashbookdatas) + { + $code=$cashbookdatas['code']; + $type=$cashbookdatas['type']; + + $count=0; + + $this->db->select('count(*) as count'); + $this->db->from('t_accountcode'); + $this->db->where('type',$type); + $this->db->where('code',$code); + + $isExits = $this->db->get(); + $res = $isExits->result_array(); + + + if(!empty($res)) + { + $count = $res[0]['count']; + } + + + if($count == 0 )//for cashbook_insert + { + $cbi = $this->db->insert('t_accountcode', $cashbookdatas); + return $cbi; + } + elseif($count == 1)//for cashbook_update + { + $this->db->where('code',$code); + $cbu = $this->db->update('t_accountcode',$cashbookdatas); + return $cbu; + } + + } + function deletemapping($Bankid,$updateamount,$updatebalancetoclear,$active) + { + $this->db->set('Clearbalance',$updateamount); + $this->db->set('Balancetocleared',$updatebalancetoclear); + $this->db->set('IsActive',$active); + $this->db->where('ID',$Bankid); + $this->db->update('T_bankreport'); + $r = $this->db->affected_rows(); + return $r; + } + function updatebankreportiv($bankid,$bankstatement) + { + $this->db->where('ID',$bankid); + $this->db->update('T_bankreport',$bankstatement); + $r = $this->db->affected_rows(); + return $r; + + } + function IgrDetailsStatusUpdate($igrno,$BankStatus) + { + + $this->db->set('BankStatus',$BankStatus); + $this->db->where('IGRItemNo',$igrno); + $this->db->update('T_IGR_Details'); + $r = $this->db->affected_rows(); + return $r; + } + function deleteBankmappingpo($id,$IsActive) + { + $this->db->set('IsActive',$IsActive); + $this->db->where('id',$id); + $this->db->update('T_Bankmappingpo'); + $r = $this->db->affected_rows(); + return $r; + } + function UpdateIpinvoiceStatus($invoiceno,$receivedstatus) + { + $this->db->set('receivedstatus',$receivedstatus); + $this->db->where('invoice_number',$invoiceno); + $this->db->update('ip_invoices'); + $r = $this->db->affected_rows(); + return $r; + } + + function deletemappinginvoice($mappingid,$IsActive) + { + $this->db->set('IsActive',$IsActive); + $this->db->where('ID',$mappingid); + $this->db->update('T_Bankmappingiv'); + $r = $this->db->affected_rows(); + return $r; + } + function updateBankporeportpo($igrno,$totalbalancetopay,$updatebankpoamount,$Bankid) + { + $this->db->set('Balancetopay',$totalbalancetopay); + $this->db->set('Amountpaid',$updatebankpoamount); + $this->db->where('IGRLineItemNo',$igrno); + $this->db->where('mid',$Bankid); + $this->db->update('T_Bankporeport'); + $r = $this->db->affected_rows(); + return $r; + + } + function updatebankinvoicereport($invoiceno,$bankid,$updatebalancetoreceived,$updateamountreceived) + { + $this->db->set('balancetoreceived',$updatebalancetoreceived); + $this->db->set('amountreceived',$updateamountreceived); + $this->db->where('invoiceno',$invoiceno); + $this->db->where('bankid',$bankid); + $this->db->update('T_Bankinvoicereport'); + $r = $this->db->affected_rows(); + return $r; + } + function gettotalbankmappingpo($igrno) + { + $this->db->select('sum(Amountpaid)as Amountpaid'); + $this->db->from ('T_Bankmappingpo'); + $this->db->where('IGRLineItemNo',$igrno); + $this->db->where('IsActive',1); + $this->db->group_by('T_Bankmappingpo.IGRLineItemNo'); + $query = $this->db->get(); + return $query->result(); + } + function getlatestamount($mappingid,$invoiceno) + { + $this->db->select('min(balancetoreceived)as balancetoreceived'); + $this->db->from ('T_Bankmappingiv'); + $this->db->where('ID',$mappingid); + $this->db->where('invoiceno',$invoiceno); + $this->db->where('IsActive',1); + //$this->db->group_by('T_Bankmappingpo.IGRLineItemNo'); + $query = $this->db->get(); + return $query->result(); + } + function getlatest($invoiceno) + { + $sql="select ID,balancetoreceived from T_Bankmappingiv where invoiceno='$invoiceno' and + ID in(select max(ID) from T_Bankmappingiv group by invoiceno)"; + $query =$this->db->query($sql); + return $query->result(); + } + function deletecashbookdata($Bankid,$updatebankamount,$clearbalance) + { + $this->db->set('Clearbalance',$clearbalance); + $this->db->set('Balancetocleared',$updatebankamount); + $this->db->where('ID',$Bankid); + $this->db->update('T_bankreport'); + $r = $this->db->affected_rows(); + return $r; + } + function deletecashbookdatacredit($Bankid,$updateclearbalance,$updatebalancetoclear) + { + $this->db->set('cclearbalance',$updateclearbalance); + $this->db->set('cbalancetocleared',$updatebalancetoclear); + $this->db->where('ID',$Bankid); + $this->db->update('T_bankreport'); + $r = $this->db->affected_rows(); + return $r; + } + function getaccountcode($accountname) + { + $this->db->select('code'); + $this->db->from ('t_accountcode'); + $this->db->where('name',$accountname); + $query = $this->db->get(); + return $query->result(); + } + function StatusUpadateCashbook($id,$IsActive) + { + $this->db->set('IsActive',$IsActive); + $this->db->where('id',$id); + $this->db->update('t_income_expense'); + $r = $this->db->affected_rows(); + return $r; + } + +} + +?> \ No newline at end of file diff --git a/application/views/bankamountpaid.php b/application/views/bankamountpaid.php index 36ec7b47..bc2d2978 100644 --- a/application/views/bankamountpaid.php +++ b/application/views/bankamountpaid.php @@ -1,513 +1,513 @@ - - -financial_year; - - } ?> - - - - - - - - - - - - -
-
-
- - -
- -
- - - - - - - -
-

Bank Debit Amount Paid Reports

-
- -
-
- -
- - - - -
-
- - -
- -
- - - - -
-
-
- - -
-
- - -
- -
- -
-
- - - - - - - - - - - - - - - - - - - - - - - id; - //print_r($ap); - ?> - - - - - - - - - - - - - - - - - - file !='') - { - ?> - - - - Fpath !='') - { - - - ?> - - - - - - - - - - FilePath=='') - { - ?> - - - - - - - - - - - - - - - - -
DatePONOIGR NOIGRItemNoSupplier NameTotal PO Amount (₹)Balance To Pay (₹)Amount Paid (₹)IGR FilePO FileAction
MaterialRcvdDate),'d-m-Y'); ?>PONO?>IGRNO?>IGRLineItemNo?>Suppliername?>Totalpoamount?>Totalpoamount-$ap->Amountpaid?>Amountpaid?> N/AN/A -     - -     -
-
-
-
-
-
- - - - - - - - - - - - - - - + + +financial_year; + + } ?> + + + + + + + + + + + + +
+
+
+ + +
+ +
+ + + + + + + +
+

Bank Debit Amount Paid Reports

+
+ +
+
+ +
+ + + + +
+
+ + +
+ +
+ + + + +
+
+
+ + +
+
+ + +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + id; + //print_r($ap); + ?> + + + + + + + + + + + + + + + + + + file !='') + { + ?> + + + + Fpath !='') + { + + + ?> + + + + + + + + + + FilePath=='') + { + ?> + + + + + + + + + + + + + + + + +
DatePONOIGR NOIGRItemNoSupplier NameTotal PO Amount (₹)Balance To Pay (₹)Amount Paid (₹)IGR FilePO FileAction
MaterialRcvdDate),'d-m-Y'); ?>PONO?>IGRNO?>IGRLineItemNo?>Suppliername?>Totalpoamount?>Balancetopay?>Amountpaid?> N/AN/A +     + +     +
+
+
+
+
+
+ + + + + + + + + + + + + + + diff --git a/application/views/bankamountunpaid.php b/application/views/bankamountunpaid.php new file mode 100644 index 00000000..36b60ebf --- /dev/null +++ b/application/views/bankamountunpaid.php @@ -0,0 +1,228 @@ +financial_year; +} +?> + + + + + +
+
+
+ +
+ +
+
+
+ Back +
+
+

Un Paid Reports

+
+ +
+ + + + +
+ + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+
+ + +
+ +
+ + + + +
+
+ +
+ + +
+
+ + +
+
+ + + +
+
+ +
+ + +
+ +
+
+ + + + + + + + + + + + + + + + Paymentstatus; + $balancetopay=$t->Balancetopay; + $ReceivedQuantity=$t->ReceivedQuantity; + $rate=$t->finalamount; + + + if($status !='ST057') + { + ?> + + + + + + + + + + + + + + + + + +
DatePONOIGRNOIGR Item NoSupplier NameIGR Amount (₹)
CreatedDate),'d-m-Y');?>PONO?>IGRNO?>IGRItemNo?>SupplierName?>
+ + + +
+
+
+
+ +
+
+ + + + + + + + + + + + + diff --git a/application/views/bankdebit.php b/application/views/bankdebit.php index 0a7a138c..80ae9054 100644 --- a/application/views/bankdebit.php +++ b/application/views/bankdebit.php @@ -176,7 +176,7 @@ foreach($financialyear as $item) $balancetopay=$t->Balancetopay; $ReceivedQuantity=$t->ReceivedQuantity; $rate=$t->finalamount; - + if($status !='ST057') { diff --git a/application/views/bankposettlement.php b/application/views/bankposettlement.php index 0598651e..8c6c9c09 100644 --- a/application/views/bankposettlement.php +++ b/application/views/bankposettlement.php @@ -1,215 +1,215 @@ - - -financial_year; - - } ?> - - - - - - - - - - - - -
-
- - - -
- -
- - - - - - -
-

Bank PO settlement

-
- - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Bank IDNarrationPONOIGRLine Item NoAmount Paid (₹)
mid?>Narration?>PONO?>IGRLineItemNo?>Amountpaid?>
- -
-
- -
- -
- - - - - - - - - - - - - - - - - - - - - + + +financial_year; + + } ?> + + + + + + + + + + + + +
+
+ + + +
+ +
+ + + + + + +
+

Bank PO settlement

+
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Bank IDNarrationPONOIGRLine Item NoAmount Paid (₹)
mid?>Narration?>PONO?>IGRLineItemNo?>Amountpaid?>
+ +
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/application/views/includes/header.php b/application/views/includes/header.php old mode 100755 new mode 100644 index 6741e3ce..fb0787e5 --- a/application/views/includes/header.php +++ b/application/views/includes/header.php @@ -1,2128 +1,2140 @@ - - - - - - - <?php echo $pageTitle; ?> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Siddharth Industries - - - - - - - - - - - - - -
-
- - - - -
- - - - - -
- - - + + + + + + + <?php echo $pageTitle; ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Siddharth Industries + + + + + + + + + + + + + +
+
+ + + + +
+ + + + + +
+ + +