diff --git a/application/config/routes.php b/application/config/routes.php index 08bbb2d6..175654bc 100644 --- a/application/config/routes.php +++ b/application/config/routes.php @@ -42,111 +42,22 @@ $route['default_controller'] = "login"; $route['404_override'] = 'error'; -/*********** Resico DEFINED ROUTES *******************/ +/***************** Resico DEFINED ROUTES *******************/ $route['loginMe'] = 'login/loginMe'; $route['dashboard'] = 'user'; $route['logout'] = 'user/logout'; $route['reports']='reportlistcontroller'; -//<-----------Application listing Routes------------> - -$route['userListing'] = 'user/userListing'; -$route['userListing/(:num)'] = "user/userListing/$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'; - -$route['qualityreportlist'] = "quality/reportList"; -$route['qualityreportlistinward'] = "quality/reportListInward"; - -//<-----------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/editasset"; -$route['editOldasset/(:num)'] = "assetdetails/editasset/$1"; -$route['editasset'] = "assetdetails/editasset"; - -//$route['editOldemployee'] = "employeedetails/editOldemployee"; -//$route['editOldemployee/(:num)'] = "employeedetails/editOldemployee/$1"; -$route['editemployee'] = "employeedetails/ViewEmployee"; - -$route['editRawmaterial/(:num)'] = "rawmaterialdetails/editRawmaterial/$1"; -$route['editRawmaterial'] = "rawmaterialdetails/editRawmaterial"; -$route['editrawmaterial'] = "rawmaterialdetails/editemployee"; - -//<-----------Application Delete Routes------------> - -$route['deleteUser'] = "user/deleteUser"; -$route['deletecost'] = "CostCenter/deletecost"; - - -//<-----------Application User Change Password Routes------------> +/**----------Application User Change Password Routes----------**/ $route['loadChangePass'] = "user/loadChangePass"; $route['changePassword'] = "user/changePassword"; -//<-----------Application Page Not Found Routes------------> +/**-------------Application Page Not Found Routes------------**/ $route['pageNotFound'] = "user/pageNotFound"; -//<-----------Application Email & ForgetPassword Routes------------> +/**--------Application Email & ForgetPassword Routes---------**/ $route['checkEmailExists'] = "user/checkEmailExists"; $route['forgotPassword'] = "login/forgotPassword"; @@ -156,7 +67,114 @@ $route['resetPasswordConfirmUser'] = "login/resetPasswordConfirmUser";//reset pa // $route['resetPasswordConfirmUser/(:any)/(:any)'] = "login/resetPasswordConfirmUser/$1/$2"; // $route['createPasswordUser'] = "login/createPasswordUser"; -/** --------------------------Payslip Routes---------------------- */ +/**-----------Application Master Details Routes -------------**/ + +/* --- User Routes --- */ +$route['addNew'] = "user/addNew"; +$route['addNewUser'] = "user/addNewUser"; + +$route['userListing'] = 'user/userListing'; +$route['userListing/(:num)'] = "user/userListing/$1"; + +$route['editOld'] = "user/editOld"; +$route['editUser'] = "user/editUser"; + +/* --- Supplier Routes --- */ +$route['addsupplier'] = "supplier/addsupplier"; +$route['addNewsupplier'] = "supplier/addNewsupplier"; + +$route['supplierListing'] = 'supplier/supplierListing'; +$route['supplierListing/(:num)'] = "supplier/supplierListing/$1"; + +$route['editsupplier'] = "supplier/editsupplier"; + +/* --- Material Master Routes --- */ +$route['addRawmaterial'] = "rawmaterialdetails/addRawMaterial"; +$route['addNewRawmaterial'] = "rawmaterialdetails/addNewRawMaterial"; + +$route['rawmaterialListing'] = 'rawmaterialdetails/rawmaterialListing'; +$route['rawmaterialListing/(:num)'] = "rawmaterialdetails/rawmaterialListing/$1"; + +$route['editRawmaterial/(:num)'] = "rawmaterialdetails/editRawmaterial/$1"; +$route['editRawmaterial'] = "rawmaterialdetails/editRawmaterial"; +$route['editrawmaterial'] = "rawmaterialdetails/editemployee"; + +/* --- Cost Center Routes --- */ +$route['addcost'] = "CostCenter/addCost"; +$route['addNewcost'] = "CostCenter/addNewCost"; + +$route['costListing'] = 'CostCenter/costListing'; +$route['costListing/(:num)'] = "CostCenter/costListing/$1"; + +$route['editOldcost'] = "CostCenter/editOldcost"; +$route['editOldcost/(:num)'] = "CostCenter/editOldcost/$1"; +$route['editcost'] = "CostCenter/editcost"; + +/* --- Asset Detail Routes --- */ +$route['assetListing'] = 'assetdetails/assetListing'; +$route['assetListing/(:num)'] = "assetdetails/assetListing/$1"; + +$route['editOldasset'] = "assetdetails/editasset"; +$route['editOldasset/(:num)'] = "assetdetails/editasset/$1"; +$route['editasset'] = "assetdetails/editasset"; + +/* --- Employee Detail Routes --- */ +$route['addemployee'] = "employeedetails/addemployee"; +$route['addNewemployee'] = "employeedetils/addNewemployee"; + +$route['employeeListing'] = 'employeedetails/employeeListing'; +$route['employeeListing/(:num)'] = "employeedetails/employeeListing/$1"; + +$route['editemployee'] = "employeedetails/ViewEmployee"; + +/* --- 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"; + + +/**----------Application Delete Routes----------**/ + +$route['deleteUser'] = "user/deleteUser"; +$route['deletecost'] = "CostCenter/deletecost"; + + +/** ----------Application Payslip Routes---------------------- */ +$route['monthlyListings'] = 'monthlypay/monthlyListing'; +$route['monthlyListings/(:num)'] = "monthlypay/monthlyListing/$1"; + +$route['attendance'] = 'monthlypay/attendanceLoad'; +$route['publicholidays'] = 'monthlypay/loadPublicholidays'; + +/* -- permission slip -- */ + +$route['permission'] = 'monthlypay/permissionslip'; +$route['permissionlist'] = 'monthlypay/permissionlist'; + +$route['emppayListings'] = 'emppaydate/emppayListing'; +$route['emppayListings/(:num)'] = 'emppaydate/emppayListing/$1'; + +$route['loanreports'] = 'payslip/loadLoanReport'; +$route['bonusreports'] = 'payslip/Bonusreport'; + $route['monthlypay'] = "payslip/monthlyInputs"; $route['ExcelUpload2'] = "payslip/viewUpload2"; $route['FileUpload'] = "payslip/uploadExcel"; @@ -168,12 +186,21 @@ $route['BankReport'] = "payslip/loadBankreportScreen"; $route['PaysilpListing'] = "payslip/payslipLisiting"; -//<-----------Application Requistion Flow Routes------------> +/**----------Application Requistion Flow Routes----------**/ + $route['Requisition'] = "requisitionform/requisitionlisting"; $route['RequisitionForm'] = "requisitionform/requisition"; $route['ApproveRequisition'] = "requisitionform/requisitionlistApproval"; $route['EditRequisition'] = "requisitionform/EditRequistionForm"; -//<-----------PO Flow------------> + +/**------------Application PO Flow Routes ------------**/ + +$route['addPO'] = "purchaseorder/addPO"; +$route['addNewPO'] = "purchaseorder/addNewPO"; + +$route['editOldPO'] = "purchaseorder/editOldPO"; +$route['editOldPO/(:num)'] = "purchaseorder/editOldPO/$1"; + $route['CreatePO'] = "purchaseorder/requisition"; $route['purchaseOrder'] = "purchaseorder/CreatePurchaseOrder"; $route['purchaseorderListing'] = "purchaseorder/PurchaseOrderList"; @@ -186,39 +213,57 @@ $route['ViewPO'] = "purchaseorder/viewfullpurchaseorder"; $route['POApproval'] = "purchaseorder/poapproval"; -// +/**--------Application Store Requisition Flow Routes----------------**/ $route['storerequisition']="storerequisitioncontroller/addstore"; $route['approvalstorerequisitionslip']="storerequisitioncontroller/SearchRequistLists"; $route['storerequisitionlisting']="storerequisitioncontroller/addstorerequisitionlist"; $route['EditStoreRequisition'] = "storerequisitioncontroller/EditStoreRequistion"; -//<-------------IGR page-----------------> +/**------------Application IGR Routes---------------**/ + $route['Addigr'] = "inwardgateregister/addinwardgateregister"; $route['ViewigrDetails'] = "inwardgateregister/viewIGRDetails"; $route['ViewMRIRBilling'] = "MRIRcontroller/viewmrirforbilling"; -//<-------------MRIR page-----------------> +/**------------Application MRIR Routes---------------**/ + $route['EditMRIR'] = "MRIRcontroller/editmaterialinspectionreport"; $route['ViewMRIR'] = "MRIRcontroller/viewmaterialinspectionreport"; $route['Viewigr'] = "MRIRcontroller/viewinwardgateregister"; $route['Distribution'] = "MRIRcontroller/viewmMaterialDistributionList"; -//<-------------Store page-----------------> + +/**------------Application Store Routes---------------**/ + $route['Stock'] = "storestatus/storeavailability"; $route['UpdatePOStatus'] = "servicepurchaseorder/UpdateServicePOStatus"; $route['ServicePOBilling'] = "servicepurchaseorder/viewServicePOReportForBilling"; -//<------------Cash book Routes--------------------> +/**-----------Application Cash book Routes------------------**/ + $route['ViewIncomeExpense'] = "cashbook/incomeExpenseList"; //$route['addNewIncomeExpense'] = "cashbook/addNewIncomeExpenseLoad"; $route['addIncomeExpense'] = "cashbook/addIncomeExpense"; -// permission slip// +/**------------Application Stock Details---------------**/ -$route['permission'] = 'monthlypay/permissionslip'; -$route['permissionlist'] = 'monthlypay/permissionlist'; +$route['FinalProduct'] = "batchcard/FinalProductCalculation"; -//<-------------Reports page-----------------> +$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"; + +/**------------Application Reports Routes---------------**/ $route['reportpending'] = "report/pending_report"; $route['releasedpo'] = "report/releasedPO"; $route['openOrder'] = "report/openorderPO"; @@ -249,49 +294,12 @@ $route['Report_purchase_attach'] = "report/iattach"; $route['Report_Material_inward_Register'] ="user/getMaterialInwardRegister"; $route['DeliveryPerformance']="user/deliver_perform"; - - - - $route['Empperform']="report/per"; -// 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"; - - - - - - - - - - - +/** -- others -- **/ +$route['qualityreportlist'] = "quality/reportList"; +$route['qualityreportlistinward'] = "quality/reportListInward"; /* End of file routes.php */ diff --git a/application/controllers/batchcard.php b/application/controllers/batchcard.php new file mode 100755 index 00000000..1d601d37 --- /dev/null +++ b/application/controllers/batchcard.php @@ -0,0 +1,1906 @@ +load->model('batchcard_model'); + $this->isLoggedIn(); + $this->load->helper(array('form','url')); + date_default_timezone_set('Asia/Kolkata'); + $this->CompanyName = $this->global['CompanyName']; + } + + public function index() + { + //$data['emplist'] = $this->batchcard_model->getEmplistforReport(); + //$this->global['pageTitle'] = $this->CompanyName.' : Hourly Batch Card'; + //$this->loadViews("hourly_batch_card", $this->global,$data,NULL); + } + + // function saveHourlyBatchCard() + // { + // //echo "done"; + // $data = $this->input->post('myData'); + // // print_r($data); + // //echo "*********************"; + + // $reportdate = $data['curdate']; + // $reporttime = $data['usr_time']; + // $reportdate = date_format(date_create($reportdate),'Y-m-d'); + // $open_trp_reading = $data['open_trp_reading']; + // $close_trp_reading = $data['close_trp_reading']; + // $total_trp_reading = $data['total_trp_reading']; + // $auto_start = $data['auto_start']; + // $auto_stop = $data['auto_stop']; + // $atime = $data['atime']; + + // $feed30sec = $data['feed30sec']; + // $feed1hr = $data['feed1hr']; + // $inlet_temp = $data['inlet_temp']; + // $outlet_temp = $data['outlet_temp']; + // $output_feed_30 = $data['output_feed_30']; + // $output_feed_1 = $data['output_feed_1']; + // $weight_rough = $data['weight_rough']; + // $weight_fine = $data['weight_fine']; + // $total = $data['total']; + // $cyclone = $data['cyclone']; + // $remarks = $data['remarks']; + // $cby = $data['cby']; + // $approvedby = $data['approvedby']; + // //echo "******************************"; + // $datatostore = array('report_date'=>$reportdate,'report_time'=>$reporttime,'opening_trp_reading'=>$open_trp_reading,'close_trp_reading'=>$close_trp_reading,'total_trp_reading'=>$total_trp_reading,'auto_start'=>$auto_start,'auto_stop'=>$auto_stop,'time'=>$atime,'feed30sec'=>$feed30sec,'feed1hr'=>$feed1hr,'inlet_temp'=>$inlet_temp,'outlet_temp'=>$outlet_temp,'output_feed_30'=>$output_feed_30,'output_feed_1'=>$output_feed_1,'weight_rough'=>$weight_rough,'weight_fine'=>$weight_fine,'total'=>$total,'cyclone'=>$cyclone,'remarks'=>$remarks,'checkedby'=>$cby,'approvedby'=>$approvedby); + // //print_r($datatostore);die(); + + // $res = $this->batchcard_model->saveHourlyBatchInfo($datatostore); + // if($res == 1) + // { + // echo ""; + // } + // else + // { + // echo ""; + // } + // } + + // function HourlyListing() + // { + + // $data['allhourdata'] = $this->batchcard_model->getAllHourlyData(); + // //print_r($data['allhourdata']);die(); + // $this->global['pageTitle'] = $this->CompanyName.' : Hourly Batch CardListing'; + // $this->loadViews("hourlybatchcardlisting", $this->global,$data,NULL); + // } + + // function checkExistHour() + // { + // $bdate = $this->input->post('param1'); + // $btime = $this->input->post('param2'); + // //echo $bdate."-".$btime; + // $bdate = date_format(date_create($bdate),'Y-m-d'); + // //echo $bdate."-".$btime; + // $res = $this->batchcard_model->checkExistHourlyData($bdate,$btime); + // if($res[0]->count == 1) + // { + // echo "Duplicate Entry...!Data Exist for Same Time Information"; + // } + + // } + + // function filterHourlyBatchData() + // { + // $hid=''; + // $from = $this->input->post('fromdate'); + // $to = $this->input->post('todate'); + + // $from = date_format(date_create($from),'Y-m-d'); + // $to = date_format(date_create($to),'Y-m-d'); + // //echo $from.'-'.$to;exit(); + // $data['allhourdata'] = $this->batchcard_model->getAllHourlyData($hid,$from,$to); + // $this->global['pageTitle'] = $this->CompanyName.' : Hourly Batch CardListing'; + // $this->loadViews("hourlybatchcardlisting", $this->global,$data,NULL); + + // } + + // function editHourly() + // { + // $hid = $this->uri->segment(3); + + // $data['emplist'] = $this->batchcard_model->getEmplistforReport(); + // $data['batchdata'] = $this->batchcard_model->getAllHourlyData($hid); + + // $this->global['pageTitle'] = $this->CompanyName.' : Edit Hourly Batch Card'; + // $this->loadViews("edit_hourly_batch_card", $this->global,$data,NULL); + // } + + + // function updateHourlyBatchCard() + // { + // $data = $this->input->post('myData'); + // // print_r($data); + // //echo "*********************"; + // $hid = $data['hid']; + // $reportdate = $data['curdate']; + // $reporttime = $data['usr_time']; + // $reportdate = date_format(date_create($reportdate),'Y-m-d'); + // $open_trp_reading = $data['open_trp_reading']; + // $close_trp_reading = $data['close_trp_reading']; + // $total_trp_reading = $data['total_trp_reading']; + // $auto_start = $data['auto_start']; + // $auto_stop = $data['auto_stop']; + // $atime = $data['atime']; + // $feed30sec = $data['feed30sec']; + // $feed1hr = $data['feed1hr']; + // $inlet_temp = $data['inlet_temp']; + // $outlet_temp = $data['outlet_temp']; + // $output_feed_30 = $data['output_feed_30']; + // $output_feed_1 = $data['output_feed_1']; + // $weight_rough = $data['weight_rough']; + // $weight_fine = $data['weight_fine']; + // $total = $data['total']; + // $cyclone = $data['cyclone']; + // $remarks = $data['remarks']; + // $cby = $data['cby']; + // $approvedby = $data['approvedby']; + + // $datatostore = array('report_date'=>$reportdate,'report_time'=>$reporttime,'opening_trp_reading'=>$open_trp_reading,'close_trp_reading'=>$close_trp_reading,'total_trp_reading'=>$total_trp_reading,'auto_start'=>$auto_start,'auto_stop'=>$auto_stop,'time'=>$atime,'feed30sec'=>$feed30sec,'feed1hr'=>$feed1hr,'inlet_temp'=>$inlet_temp,'outlet_temp'=>$outlet_temp,'output_feed_30'=>$output_feed_30,'output_feed_1'=>$output_feed_1,'weight_rough'=>$weight_rough,'weight_fine'=>$weight_fine,'total'=>$total,'cyclone'=>$cyclone,'remarks'=>$remarks,'checkedby'=>$cby,'approvedby'=>$approvedby,'updatedby'=>$cby); + // //print_r($datatostore);die(); + + // $res = $this->batchcard_model->updateHourlyBatchInfo($datatostore,$hid); + // if($res == 1) + // { + // echo ""; + // } + // else + // { + // echo ""; + // } + // } + + + // function loadDailyBatchCard() + // { + // $data['emplist'] = $this->batchcard_model->getEmplistforReport(); + // $this->global['pageTitle'] = $this->CompanyName.' : Daily Batch Card'; + // $this->loadViews("dailybatchcard", $this->global,$data,NULL); + // } + + + // function dailyListing() + // { + // $data = array(); + // if(empty($this->uri->segment(3))) + // { + + // $year = date("Y"); + // $month = date("m"); + // // $current = $current."-01"; + // $data['month'] = $month.'-'.$year; + // $data['monthdays'] = cal_days_in_month(CAL_GREGORIAN,$month,$year); + // $data['hourdata'] = $this->batchcard_model->getDailyBatchCardData($month); + // $data['datefordisplay'] = date('M-Y'); + // } + // else + // { + // $fromview = $this->uri->segment(3); + // $dmy = explode('-',$fromview); + + // $fromview_month = date('m', strtotime($dmy[0])); + // $fromview_year = $dmy[1]; + // $data['month'] = $fromview_month.'-'.$fromview_year; + // $data['monthdays'] = cal_days_in_month(CAL_GREGORIAN,$fromview_month,$fromview_year); + // $data['hourdata'] = $this->batchcard_model->getDailyBatchCardData($fromview_month); + // $data['datefordisplay'] = $fromview; + + + // } + // //print_r($data['hourdata']);exit(); + // $this->global['pageTitle'] = $this->CompanyName.' : Daily Batch Card Listing'; + // $this->loadViews("dailyBatchCardListing", $this->global,$data,NULL); + + // } + + + // function saveDailyBatchCardData()//T_daily_batchcard_data + // { + // $ddate = $this->input->post('rdate'); + // $ddate = date_format(date_create($ddate),'y-m-d'); + // $description = $this->input->post('description'); + // $trp_running_hrs = $this->input->post('trp_running_hrs'); + // $feeding_start = $this->input->post('feeding_start'); + // $less_maintenance = $this->input->post('less_maintenance'); + // $less_break_down_hrs = $this->input->post('less_break_down_hrs'); + // $total_burner_running_time = $this->input->post('total_burner_running_time'); + // $total_feeding_hrs = $this->input->post('total_feeding_hrs'); + // // $gas_consumption_per_hour = $this->input->post('gas_consumption_per_hour'); + // // $gas_consumption_per_ton = $this->input->post('gas_consumption_per_ton'); + // // $total_gas_consumption = $this->input->post('total_gas_consumption'); + // $ed_running_hrs = $this->input->post('ed_running_hrs'); + // $ed_receipt = $this->input->post('ed_receipt'); + // $ed_issues = $this->input->post('ed_issues'); + // $rotatry_input = $this->input->post('rotary_input'); + // $rotatry_output = $this->input->post('rotatry_output'); + // $roughsand_receipt = $this->input->post('roughsand_receipt'); + // $roughsand_issues = $this->input->post('roughsand_issues'); + // $finesand_receipt = $this->input->post('finesand_receipt'); + // $finesand_issues = $this->input->post('finesand_issues'); + // $gastrip_receipt = $this->input->post('gastrip_receipt'); + // $gastrip_consumption = $this->input->post('gastrip_consumption'); + // $water_receipt = $this->input->post('water_receipt'); + // $water_consumpiton = $this->input->post('water_consumpiton'); + // $diesel_receipt = $this->input->post('diesel_receipt'); + // $diesel_consumption = $this->input->post('diesel_consumption'); + // $diesel_running_hrs = $this->input->post('diesel_running_hrs'); + // $diesel_rotary_receipt = $this->input->post('diesel_rotary_receipt'); + // $diesel_rotary_consumption = $this->input->post('diesel_rotary_consumption'); + // $diesel_rotary_running_hrs = $this->input->post('diesel_rotary_running_hrs'); + // $open_reading = $this->input->post('open_reading'); + // $close_reading = $this->input->post('close_reading'); + // $engineers = $this->input->post('engineers'); + // $operators = $this->input->post('operators'); + // $helpers = $this->input->post('helpers'); + // // $breakdown = $this->input->post('breakdown'); + // // $location = $this->input->post('location'); + // // $maintenance_description = $this->input->post('maintenance_description'); + // // $maintenance_reason = $this->input->post('maintenance_reason'); + // // $maintenance_time_from = $this->input->post('maintenance_time_from'); + // // $maintenance_time_to = $this->input->post('maintenance_time_to'); + // // $maintenance_total_hrs = $this->input->post('maintenance_total_hrs'); + // // $cost_material = $this->input->post('cost_material'); + // // $cost_labour = $this->input->post('cost_labour'); + // $remarks = $this->input->post('remarks'); + // $createdby = $this->session->userdata ( 'userId' ); + // $createdtime = date('y-m-d'); + // $approvedby = $this->input->post('approvedby'); + + // $datatostore = array('ddate'=>$ddate,'description'=>$description,'total_trp_running_hrs'=>$trp_running_hrs,'less_feeding_start'=>$feeding_start,'less_maintenance'=>$less_maintenance,'less_break_down_hrs'=>$less_break_down_hrs,'total_burner_running_time'=>$total_burner_running_time,'total_feeding_hrs'=>$total_feeding_hrs,'ed_running_hrs'=>$ed_running_hrs,'ed_receipt'=>$ed_receipt,'ed_issues'=>$ed_issues,'rotary_input'=>$rotatry_input,'rotary_output'=>$rotatry_output,'trp_roughsand_receipt'=>$roughsand_receipt,'trp_roughsand_issues'=>$roughsand_issues,'trp_finesand_receipt'=>$finesand_receipt,'trp_finesand_issues'=>$finesand_issues,'water_receipt'=>$water_receipt,'water_consumption'=>$water_consumpiton,'diesel_receipt'=>$diesel_receipt,'diesel_consumption'=>$diesel_consumption,'diesel_runninig_hrs'=>$diesel_running_hrs,'diesel_dryer_receipt'=>$diesel_rotary_receipt,'diesel_dryer_consumption'=>$diesel_rotary_consumption,'diesel_dryer_runninig_hrs'=>$diesel_rotary_running_hrs,'power_open_reading'=>$open_reading,'power_close_reading'=>$close_reading,'engineers'=>$engineers,'operators'=>$operators,'helpers'=>$helpers,'gas_for_trip_receipt'=>$gastrip_receipt,'gas_for_trip_consumption'=>$gastrip_consumption,'remarks'=>$remarks,'createdby'=>$createdby,'createdon'=>$createdtime,'approvedby'=>$approvedby); + // //'total_gas_consumption'=>$total_gas_consumption,'gas_consumption_hr'=>$gas_consumption_per_hour,'gas_consumption_ton'=>$gas_consumption_per_ton,'maintenance_breakdown'=>$breakdown,'maintenance_location'=>$location,'maintenance_description'=>$maintenance_description,'maintenance_reason'=>$maintenance_reason,'maintenance_from_hrs'=>$maintenance_time_from,'maintenance_to_hrs'=>$maintenance_time_to,'maintenance_total_hrs'=>$maintenance_total_hrs,'cost_material'=>$cost_material,'cost_labour'=>$cost_labour + + // //$datatostore = array('ddate'=>$ddate,'description'=>$description,'total_trp_running_hrs'=>$trp_running_hrs,'less_feeding_start'=>$feeding_start,'less_maintenance'=>$less_maintenance,'less_break_down_hrs'=>$less_break_down_hrs,'total_burner_running_time'=>$total_burner_running_time,'total_feeding_hrs'=>$total_feeding_hrs,'gas_consumption_hr'=>$gas_consumption_per_hour,'gas_consumption_ton'=>$gas_consumption_per_ton,'total_gas_consumption'=>$total_gas_consumption,'ed_running_hrs'=>$ed_running_hrs,'ed_receipt'=>$ed_receipt,'ed_issues'=>$ed_issues,'rotary_input'=>$rotatry_input,'rotary_output'=>$rotatry_output,'trp_roughsand_receipt'=>$roughsand_receipt,'trp_roughsand_issues'=>$roughsand_issues,'trp_finesand_receipt'=>$finesand_receipt,'trp_finesand_issues'=>$finesand_issues,'gas_for_trip_receipt'=>$gastrip_receipt,'gas_for_trip_consumption'=>$gastrip_consumption,'water_receipt'=>$water_receipt,'water_consumption'=>$water_consumpiton,'diesel_receipt'=>$diesel_receipt,'diesel_consumption'=>$diesel_consumption,'diesel_runninig_hrs'=>$diesel_running_hrs,'diesel_dryer_receipt'=>$diesel_rotary_receipt,'diesel_dryer_consumption'=>$diesel_rotary_consumption,'diesel_dryer_runninig_hrs'=>$diesel_rotary_running_hrs,'power_open_reading'=>$open_reading,'power_close_reading'=>$close_reading,'engineers'=>$engineers,'operators'=>$operators,'helpers'=>$helpers,'maintenance_breakdown'=>$breakdown,'maintenance_location'=>$location,'maintenance_description'=>$maintenance_description,'maintenance_reason'=>$maintenance_reason,'maintenance_from_hrs'=>$maintenance_time_from,'maintenance_to_hrs'=>$maintenance_time_to,'maintenance_total_hrs'=>$maintenance_total_hrs,'cost_material'=>$cost_material,'cost_labour'=>$cost_labour,'remarks'=>$remarks,'createdby'=>$createdby,'createdon'=>$createdtime,'approvedby'=>$approvedby); + // //print_r($datatostore); + // $res = $this->batchcard_model->saveDailyBatchCardData($datatostore); + // if($res == 1) + // { + // echo ""; + // } + // else + // { + // echo ""; + // } + // //exit(); + // } + + // function checkExistDaily() + // { + // $rdate = $this->input->post('param1'); + // $rdate = date_format(date_create($rdate),'Y-m-d'); + // $res = $this->batchcard_model->checkExistDaily($rdate); + // echo $res[0]->count; + // } + + + // function getPowerConsumptionDetails() + // { + + // $rdate = $this->input->post('param1'); + // $rdate = date_format(date_create($rdate),'Y-m-d'); + // $res = $this->batchcard_model->getPowerConsumptionDetails($rdate); + // //print_r($res);exit(); + // $counut = count($res); + + // $data[open] = ''; + // $data[close] = ''; + // $data[start] = ''; + // $data[stop] = ''; + // for($i=0; $i<=$counut; $i++) + // { + // if($i == 0) + // { + // $data[open] = $res[$i]->opening_trp_reading; + // $data[start] = $res[$i]->auto_start; + // } + // if($i == ($counut-1)) + // { + // $data[close] = $res[$i]->close_trp_reading; + // $data[stop] = $res[$i]->auto_stop; + // } + + // } + + // echo json_encode($data); + + // } + + // function saveBatchCardtoExcel() + // { + + + // $abstractjsondata = $this->input->post('param1'); + // $month = $this->input->post('param2'); + // $abstractphpdata = json_decode($abstractjsondata,true); + // //print_r($abstractphpdata); + + + // $this->load->library('excel'); + + // $this->excel->setActiveSheetIndex(0); + // $this->excel->getActiveSheet()->setTitle('Abstract Report for ' . $month); + // $this->excel->getActiveSheet()->setCellValue('A1', 'Abstrct Report for ' . $month); + + // $this->excel->getActiveSheet()->setCellValue('A3', 'S.No.'); + // $this->excel->getActiveSheet()->setCellValue('B3', 'Description'); + // $this->excel->getActiveSheet()->setCellValue('C3', 'Running Hrs'); + // $this->excel->getActiveSheet()->setCellValue('D3', 'Per Hour'); + + // $this->excel->getActiveSheet()->setCellValue('E3', 'Open Stock'); + // $this->excel->getActiveSheet()->setCellValue('F3', 'Receipt'); + // $this->excel->getActiveSheet()->setCellValue('G3', 'Total'); + // $this->excel->getActiveSheet()->setCellValue('H3', 'Consumption'); + // $this->excel->getActiveSheet()->setCellValue('I3', 'Closing Stock'); + // $this->excel->getActiveSheet()->setCellValue('J3', 'Physical Stock'); + // $this->excel->getActiveSheet()->setCellValue('K3', 'Difference'); + // $this->excel->getActiveSheet()->mergeCells('A1:K1'); + // $this->excel->getActiveSheet()->getStyle('A1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER); + // $this->excel->getActiveSheet()->getStyle('A1')->getFont()->setBold(true); + // $this->excel->getActiveSheet()->getStyle('A1')->getFont()->setSize(16); + // $this->excel->getActiveSheet()->getStyle('A1')->getFill()->getStartColor()->setARGB('#333'); + + // for($col = ord('A'); $col <= ord('K'); $col++){ + + // $this->excel->getActiveSheet()->getColumnDimension(chr($col))->setAutoSize(true); + // $this->excel->getActiveSheet()->getStyle(chr($col))->getFont()->setSize(12); + // $this->excel->getActiveSheet()->getStyle(chr($col))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER); + + // } + + // $this->excel->getActiveSheet() + // ->getStyle('A3:K3') + // ->getFill() + // ->setFillType(PHPExcel_Style_Fill::FILL_SOLID) + // ->getStartColor() + // ->setARGB('FF808080'); + + // $this->excel->getActiveSheet() + // ->getStyle('A3:K3')-> + // getFont()->setBold(true); + + // $i = 5; + // $j = 1; + // //print_r($abstractphpdata);die(); + + // foreach($abstractphpdata as $row){ + + // $this->excel->getActiveSheet()->setCellValue('A' . (string)($i),$j); + // $this->excel->getActiveSheet()->setCellValue('B' . (string)($i),$row['Particulars']); + // $this->excel->getActiveSheet()->setCellValue('C' . (string)($i),$row['Running Hrs']); + // $this->excel->getActiveSheet()->setCellValue('D' . (string)($i),$row['Per Hour']); + // $this->excel->getActiveSheet()->getStyle('D'.(string)($i))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT); + + // $this->excel->getActiveSheet()->setCellValue('E' . (string)($i),$row['Open Stock']); + // $this->excel->getActiveSheet()->getStyle('E'.(string)($i))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT); + + + // $this->excel->getActiveSheet()->setCellValue('F' . (string)($i),$row['Receipt']); + // $this->excel->getActiveSheet()->getStyle('F'.(string)($i))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT); + + + // $this->excel->getActiveSheet()->setCellValue('G' . (string)($i),$row['Total']); + // $this->excel->getActiveSheet()->getStyle('G'.(string)($i))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT); + + // $this->excel->getActiveSheet()->setCellValue('H' . (string)($i),$row['Consumption']); + // $this->excel->getActiveSheet()->getStyle('H'.(string)($i))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT); + + + // $this->excel->getActiveSheet()->setCellValue('I' . (string)($i),$row['Closing Stock']); + // $this->excel->getActiveSheet()->getStyle('I'.(string)($i))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT); + // $this->excel->getActiveSheet()->setCellValue('J' . (string)($i),$row['Physical Stock']); + // $this->excel->getActiveSheet()->getStyle('J'.(string)($i))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT); + + // $this->excel->getActiveSheet()->setCellValue('K' . (string)($i),$row['Difference']); + // $this->excel->getActiveSheet()->getStyle('K'.(string)($i))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT); + + + + // //$this->excel->getActiveSheet()->setCellValue('A6','HI'); + // $i++; + // $j++; + // } + // $this->excel->getActiveSheet()->getProtection()->setSheet(true); + // $this->excel->getActiveSheet()->getProtection()->setSort(true); + // $this->excel->getActiveSheet()->getProtection()->setInsertRows(true); + // $this->excel->getActiveSheet()->getProtection()->setFormatCells(true); + + // $filename='Abstrct Report for'.$month.'.xls'; + // header('Content-Type: application/vnd.ms-excel'); + // header('Content-Disposition: attachment;filename="'.$filename.'"'); + // header('Cache-Control: max-age=0'); + // $objWriter = PHPExcel_IOFactory::createWriter($this->excel, 'Excel5'); + // $objWriter->save('php://output'); + + + // } + + // function editDailyData() + // { + + // $did = $this->uri->segment(3); + // $data['emplist'] = $this->batchcard_model->getEmplistforReport(); + // $data['dailydata'] = $this->batchcard_model->getIndividualDailyData($did); + // $ddate = explode("-",$data['dailydata'][0]->ddate); + // $dateval =$ddate[2].'-'.$ddate[1].'-'.$ddate[0]; + // //$data['Maintenances'] = $this->batchcard_model->getmaint_dtl_MntDate($data['dailydata'][0]->ddate); + // $data['Maintenances'] = $this->batchcard_model->maintenancesdata($dateval); + // //$arraydata = $this->batchcard_model->maintenancesdata($date); + // $this->global['pageTitle'] = $this->CompanyName.' : Daily Batch Card Edit'; + // $this->loadViews("editDailyData", $this->global,$data,NULL); + + // } + + + // function updateDailyBatchCardData() + // { + // $did = $this->input->post('did'); + // $ddate = $this->input->post('rdate'); + // $ddate = date_format(date_create($ddate),'y-m-d'); + // $description = $this->input->post('description'); + // $trp_running_hrs = $this->input->post('trp_running_hrs'); + // $feeding_start = $this->input->post('feeding_start'); + // $less_maintenance = $this->input->post('less_maintenance'); + // $less_break_down_hrs = $this->input->post('less_break_down_hrs'); + // $total_burner_running_time = $this->input->post('total_burner_running_time'); + // $total_feeding_hrs = $this->input->post('total_feeding_hrs'); + // // $gas_consumption_per_hour = $this->input->post('gas_consumption_per_hour'); + // // $gas_consumption_per_ton = $this->input->post('gas_consumption_per_ton'); + // // $total_gas_consumption = $this->input->post('total_gas_consumption'); + // $ed_running_hrs = $this->input->post('ed_running_hrs'); + // $ed_receipt = $this->input->post('ed_receipt'); + // $ed_issues = $this->input->post('ed_issues'); + // $rotatry_input = $this->input->post('rotary_input'); + // $rotatry_output = $this->input->post('rotatry_output'); + // $roughsand_receipt = $this->input->post('roughsand_receipt'); + // $roughsand_issues = $this->input->post('roughsand_issues'); + // $finesand_receipt = $this->input->post('finesand_receipt'); + // $finesand_issues = $this->input->post('finesand_issues'); + // $gastrip_receipt = $this->input->post('gastrip_receipt'); + // $gastrip_consumption = $this->input->post('gastrip_consumption'); + // $water_receipt = $this->input->post('water_receipt'); + // $water_consumpiton = $this->input->post('water_consumpiton'); + // $diesel_receipt = $this->input->post('diesel_receipt'); + // $diesel_consumption = $this->input->post('diesel_consumption'); + // $diesel_running_hrs = $this->input->post('diesel_running_hrs'); + // $diesel_rotary_receipt = $this->input->post('diesel_rotary_receipt'); + // $diesel_rotary_consumption = $this->input->post('diesel_rotary_consumption'); + // $diesel_rotary_running_hrs = $this->input->post('diesel_rotary_running_hrs'); + // $open_reading = $this->input->post('open_reading'); + // $close_reading = $this->input->post('close_reading'); + // $engineers = $this->input->post('engineers'); + // $operators = $this->input->post('operators'); + // $helpers = $this->input->post('helpers'); + // // $breakdown = $this->input->post('breakdown'); + // // $location = $this->input->post('location'); + // // $maintenance_description = $this->input->post('maintenance_description'); + // // $maintenance_reason = $this->input->post('maintenance_reason'); + // // $maintenance_time_from = $this->input->post('maintenance_time_from'); + // // $maintenance_time_to = $this->input->post('maintenance_time_to'); + // // $maintenance_total_hrs = $this->input->post('maintenance_total_hrs'); + // // $cost_material = $this->input->post('cost_material'); + // // $cost_labour = $this->input->post('cost_labour'); + // $remarks = $this->input->post('remarks'); + // $createdby = $this->session->userdata ( 'userId' ); + // $createdtime = date('y-m-d'); + // $approvedby = $this->input->post('approvedby'); + + // $datatostore = array('ddate'=>$ddate,'description'=>$description,'total_trp_running_hrs'=>$trp_running_hrs,'less_feeding_start'=>$feeding_start,'less_maintenance'=>$less_maintenance,'less_break_down_hrs'=>$less_break_down_hrs,'total_burner_running_time'=>$total_burner_running_time,'total_feeding_hrs'=>$total_feeding_hrs,'ed_running_hrs'=>$ed_running_hrs,'ed_receipt'=>$ed_receipt,'ed_issues'=>$ed_issues,'rotary_input'=>$rotatry_input,'rotary_output'=>$rotatry_output,'trp_roughsand_receipt'=>$roughsand_receipt,'trp_roughsand_issues'=>$roughsand_issues,'trp_finesand_receipt'=>$finesand_receipt,'trp_finesand_issues'=>$finesand_issues,'gas_for_trip_receipt'=>$gastrip_receipt,'gas_for_trip_consumption'=>$gastrip_consumption,'water_receipt'=>$water_receipt,'water_consumption'=>$water_consumpiton,'diesel_receipt'=>$diesel_receipt,'diesel_consumption'=>$diesel_consumption,'diesel_runninig_hrs'=>$diesel_running_hrs,'diesel_dryer_receipt'=>$diesel_rotary_receipt,'diesel_dryer_consumption'=>$diesel_rotary_consumption,'diesel_dryer_runninig_hrs'=>$diesel_rotary_running_hrs,'power_open_reading'=>$open_reading,'power_close_reading'=>$close_reading,'engineers'=>$engineers,'operators'=>$operators,'helpers'=>$helpers,'remarks'=>$remarks,'updatedby'=>$createdby,'approvedby'=>$approvedby); + // //'gas_consumption_hr'=>$gas_consumption_per_hour,'gas_consumption_ton'=>$gas_consumption_per_ton,'total_gas_consumption'=>$total_gas_consumption,'maintenance_breakdown'=>$breakdown,'maintenance_location'=>$location,'maintenance_description'=>$maintenance_description,'maintenance_reason'=>$maintenance_reason,'maintenance_from_hrs'=>$maintenance_time_from,'maintenance_to_hrs'=>$maintenance_time_to,'maintenance_total_hrs'=>$maintenance_total_hrs,'cost_material'=>$cost_material,'cost_labour'=>$cost_labour, + // //print_r($datatostore); + // $res = $this->batchcard_model->updateDailyBatchCardData($datatostore,$did); + // if($res == 1) + // { + // echo ""; + // } + // else + // { + // echo ""; + // } + + + // } + + // function saveAbstractReport() + // { + // //echo "working"; + // $overalltotal = 0; + // $date = $this->input->post('param1'); + // $cur_day = date('Y-m',strtotime($date)); + // //echo $date; + // $jsondata = $this->input->post('param2'); + // $phpdata = json_decode($jsondata,TRUE); + // //print_r($phpdata); + // //die(); + // //$isExist = $this->batchcard_model->checkAbstractReport($date); + // $isExist = $this->batchcard_model->checkAbstractReport($cur_day); + // $c = $isExist[0]->count; + // if($c == 0){ + // foreach($phpdata as $d) + // { + // $abstract_report_date = $date; + // $abstract_details = $d['Particulars']; + // $running_hrs = $d['Running Hrs']; + // $per_hr = $d['Per Hour']; + // $open_stock = $d['Open Stock']; + // $receipt = $d['Receipt']; + // $total = $d['Total']; + // $consumption = $d['Consumption']; + // $close_stock = $d['Closing Stock']; + // $physical_stock = $d['Physical Stock']; + // $difference = $d['Difference']; + // $createdby = $this->session->userdata ( 'userId' ); + + // $datatostore = array('abstract_report_date'=>$abstract_report_date,'abstract_details'=>$abstract_details,'running_hrs'=>$running_hrs,'per_hr'=>$per_hr,'open_stock'=>$open_stock,'receipt'=>$receipt,'total'=>$total,'consumption'=>$consumption,'close_stock'=>$close_stock,'physical_stock'=>$physical_stock,'difference'=>$difference,'createdby'=>$createdby); + + // $res = $this->batchcard_model->saveAbstractReport($datatostore); + + // $overalltotal += $res; + // } + // } + // else + // { + + // foreach($phpdata as $d) + // { + // $abstract_report_date = $date; + // $abstract_details = $d['Particulars']; + // $running_hrs = $d['Running Hrs']; + // $per_hr = $d['Per Hour']; + // $open_stock = $d['Open Stock']; + // $receipt = $d['Receipt']; + // $total = $d['Total']; + // $consumption = $d['Consumption']; + // $close_stock = $d['Closing Stock']; + // $physical_stock = $d['Physical Stock']; + // $difference = $d['Difference']; + // $createdby = $this->session->userdata ( 'userId' ); + + // $datatostore = array('abstract_details'=>$abstract_details,'running_hrs'=>$running_hrs,'per_hr'=>$per_hr,'open_stock'=>$open_stock,'receipt'=>$receipt,'total'=>$total,'consumption'=>$consumption,'close_stock'=>$close_stock,'physical_stock'=>$physical_stock,'difference'=>$difference,'updatedby'=>$createdby); + + // //$res = $this->batchcard_model->updateAbstractReport($datatostore,$date,$abstract_details); + // $res = $this->batchcard_model->updateAbstractReport($datatostore,$cur_day,$abstract_details); + + // $overalltotal += $res; + // } + // } + + // echo $overalltotal.' - Details Saved Successfully..!'; + + + // } + + // function getPreviousMonthAbstractDetails() + // { + // $month = $this->input->post('param1'); + // $year = $this->input->post('param2'); + // $currmonthyear = date('Y-m',strtotime($this->input->post('param3'))); + // $isExist = $this->batchcard_model->checkAbstractReport($currmonthyear); + // $c = $isExist[0]->count; + + // if($c == 0){//echo " for closestock"; + + // $res = $this->batchcard_model->getPreviousMonthAbstractDetails($month,$year); + // echo json_encode($res); + + // } + // else{ //echo " for openstock"; + // $arr = $this->batchcard_model->getMonthAbstractDetails($currmonthyear); + // echo json_encode($arr); + // } + + // } + + // function getMonthAbstractDetails(){ + + // $month = $this->input->post('param1'); + // $year = $this->input->post('param2'); + // $arr = $this->batchcard_model->getMonthAbstractDetails($month,$year); + // echo json_encode($arr); + // } + +// function getStockDetails() +// { +// //echo "hi"; + +// if(!empty($this->input->post('fromdate')) && $this->input->post('stockname')) +// { +// $sn = $this->input->post('stockname'); +// $snforview = $sn; +// $fd = $this->input->post('fromdate'); +// $fm = date_format(date_create($fd),'m'); +// $fy = date_format(date_create($fd),'Y'); +// $string = $fy.$fm.'01'.'last month'; +// $py = date_format(date_create($string),'Y-m'); +// $py = explode('-',$py); + +// // echo 'CURRENT'.$fm.'-'.$fy.'
'; +// // echo 'PREVOIUS'.$py[0].'-'.$py[1].'
'; +// // echo $sn; +// switch($sn) +// { +// case 1: + +// $sn = '(sum(ed_receipt) - sum(ed_issues)) as lastmonthclosinged'; +// $sd1 = 'ed_receipt'; +// $sd2 = 'ed_issues'; +// break; +// case 2: + +// $sn = '(sum(rotary_input) - sum(rotary_output)) as lastmonthclosingrotary'; +// $sd1 = 'rotary_input as ed_receipt'; +// $sd2 = 'rotary_output as ed_issues'; +// break; +// case 3: +// $sn = '(sum(diesel_dryer_receipt) - sum(diesel_dryer_consumption)) as lastmonthclosingdryerdiesel'; +// $sd1 = 'diesel_dryer_receipt as ed_receipt'; +// $sd2 = 'diesel_dryer_consumption as ed_issues'; +// break; +// case 4: +// $sn = '(sum(diesel_receipt) - sum(diesel_consumption)) as lastmonthclosingbull'; +// $sd1 = 'diesel_receipt as ed_receipt'; +// $sd2 = 'diesel_consumption as ed_issues'; +// break; +// case 5: +// $sn = '(sum(trp_roughsand_receipt) - sum(trp_roughsand_issues)) as lastmonthclosingrough'; +// $sd1 = 'trp_roughsand_receipt as ed_receipt'; +// $sd2 = 'trp_roughsand_issues as ed_issues'; +// break; + +// case 6: +// $sn = '(sum(trp_finesand_receipt) - sum(trp_finesand_issues)) as lastmonthclosingfine'; +// $sd1 = 'trp_finesand_receipt as ed_receipt'; +// $sd2 = 'trp_finesand_issues as ed_issues'; +// break; +// case 7: +// $sn = '(sum(gas_for_trip_receipt) - sum(gas_for_trip_consumption)) as lastmonthclosinggas'; +// $sd1 = 'gas_for_trip_receipt as ed_receipt'; +// $sd2 = 'gas_for_trip_consumption as ed_issues'; +// break; +// case 8: +// $sn = '(sum(water_receipt) - sum(water_consumption)) as lastmonthclosingewater'; +// $sd1 = 'water_receipt as ed_receipt'; +// $sd2 = 'water_consumption as ed_issues'; +// break; +// } + +// $data['previousmonthclosingstock'] = $this->batchcard_model->getPreviousMonthClosedStockDetails($py[0],$py[1],$sn); +// //print_r($data['previousmonthclosingstock']);echo '
';die(); +// $data['currentmonthstockdetails'] = $this->batchcard_model->currentMonthStockDetails($fm,$fy,$sd1,$sd2); +// $data['selmonth'] = $fd; +// $data['selstockvalue'] = $snforview; +// //print_r($data['currentmonthstockdetails']);echo '
';die(); + + + +// } +// else +// { + +// } +// $this->global['pageTitle'] = $this->CompanyName.' : Stock Details'; +// $this->loadViews("batchcard_stockdetails", $this->global,$data,NULL); +// } + +// function getMaintenancesDetails(){ + +// $date = $this->input->post('id1'); +// // echo $date; +// // die(); +// $arraydata = $this->batchcard_model->maintenancesdata($date); +// if(count($arraydata) != 0){ +// echo json_encode($arraydata);} +// } + +// function getMaintListing(){ + +// if ($this->input->post('btn_submit')) +// { + +// $fdate = $this->input->post('from_date'); + +// $tdate = $this->input->post('to_date'); +// $type = $this->input->post('mySelect'); + + +// } + +// $data['MaintListing'] = $this->batchcard_model->getmaint_dtl( $fdate,$tdate, $type ); + +// $this->global['pageTitle'] = $this->CompanyName.' : Maintenance/Breakdown Listing'; +// $this->loadViews("BatchcardMaintListing", $this->global,$data,NULL); + + + +// } + +// function addMaint(){ +// $data['emplist'] = $this->batchcard_model->getEmplistforReport(); +// $data['supplist'] = $this->batchcard_model->getSupplierlist(); +// $data['MachineList'] = $this->batchcard_model->getmachine_codename(); +// $this->global['pageTitle'] = $this->CompanyName.' : Add Maintenance/Breakdown'; +// $this->loadViews("BatchcardMaintAdd", $this->global,$data,NULL); +// } +// function editMaint(){ + +// $MntID = base64_decode(urldecode($this->uri->segment(3))); + +// $data['emplist'] = $this->batchcard_model->getEmplistforReport(); +// $data['MachineList'] = $this->batchcard_model->getmachine_codename(); +// $data['supplist'] = $this->batchcard_model->getSupplierlist(); +// $data['MaintEdit'] = $this->batchcard_model->getmaint_dtl_MntID($MntID); +// $data['MaintFileEdit'] = $this->batchcard_model->getfiledetails($MntID); +// //print_r($data); + +// $this->global['pageTitle'] = $this->CompanyName.' : Edit Maintenance/Breakdown'; +// $this->loadViews("BatchcardMaintEdit", $this->global,$data,NULL); +// } +// function addmntbr(){ + +// $type = $this->input->post('radiobtn'); +// //$maintenance_date = $this->input->post('maintenance_date'); +// $machinecode = $this->input->post('machine'); +// if($type == '0'){ +// $maintenance_subtype = $this->input->post('maintenance_subtype'); +// if($maintenance_subtype == '1'){ +// $supplier = $this->input->post('supplier'); +// } +// else{ $supplier = NULL; } +// } +// else{ $maintenance_subtype = NULL;$supplier = NULL; } +// //$maintenance_time= $this->input->post('maintenance_time'); +// $location = $this->input->post('location'); +// $maintenance_description = $this->input->post('maintenance_description'); +// $maintenance_reason = $this->input->post('maintenance_reason'); +// // $maintenance_time_from = $this->input->post('maintenance_time_from'); +// // $maintenance_time_to = $this->input->post('maintenance_time_to'); +// $maintenance_date_time = $this->input->post('maintenance_date_time'); +// $maintenance_date_time = explode(" - ",$maintenance_date_time); +// $maintenance_time_from = $maintenance_date_time[0]; +// $maintenance_time_to = $maintenance_date_time[1]; +// $maintenance_total_hrs = $this->input->post('maintenance_total_hrs'); +// $cost_material = $this->input->post('cost_material'); +// $cost_labour = $this->input->post('cost_labour'); +// $createdby = $this->session->userdata ( 'userId' ); +// $approvedby = $this->input->post('approvedby'); +// $workdoneby = $this->input->post('workdoneby'); + +// $addmntbr = array('Type'=>$type,'Machine_Code'=>$machinecode,'Maint_Subtype'=>$maintenance_subtype, 'Maint_Supplier'=>$supplier,'Maint_Location'=>$location, 'Maint_Description'=>$maintenance_description, 'Maint_Reason'=>$maintenance_reason, 'Maint_Time_from'=>$maintenance_time_from, 'Maint_Time_to'=>$maintenance_time_to, 'Maint_Total_hrs'=>$maintenance_total_hrs, 'Cost_Material'=>$cost_material, 'Cost_Labour'=>$cost_labour,'WorkDone_By'=>$workdoneby,'Approved_By'=>$approvedby,'CreatedBy'=>$createdby); +// //'Maint_Date'=>$maintenance_date,'Maint_Time'=>$maintenance_time, +// //print_r($addmntbr); +// //die(); +// $added = $this->batchcard_model->addmaint_dtl($addmntbr); + +// $maint_id = ''; + +// if(count($added)>0) +// { +// foreach ($added as $key ) { + +// $maint_id=$key->Maint_ID; + +// } +// } + +// $count = $this->input->post('hidecounter'); +// $constant = $this->input->post('hideconstant'); + +// for($i=1;$i<=$constant;$i++){ +// $pathname = 'browseFiles'.$i; +// if(!empty($_FILES[$pathname]['name'])) +// { +// $varname = 'filename'.$i; +// $temp = $this->input->post($varname); +// $Picture = $this->add($pathname); +// $arr[] = array($temp,$Picture); +// } +// } + +// foreach($arr as $ma){ + +// $index = 0; +// foreach($ma as $key=>$value){ +// $index++; +// if($index == 1){ +// $file_descrpition = $value; +// } +// if($index == 2){ +// $filename = $value; +// } +// } +// $addfilelist = array( +// 'Machine_code/Maint_id'=>$maint_id, +// 'File_name'=>$filename, +// 'Status'=>"1", +// 'Status_description'=>($type == '0') ? ('Maintenaces related files') : ('Breakdown related files') +// ); +// $this->batchcard_model->addfiledetails($addfilelist); +// //print_r($addfilelist); +// //die(); + +// } + + +// if(count($added)>0) +// { +// echo ""; +// } + +// //print_r($addmntbr); + +// } +// function editmntbr(){ + +// $type = $this->input->post('radiobtn'); +// $mntid = $this->input->post('mntid'); +// $machinecode = $this->input->post('machine'); +// if($type == '0'){ +// $maintenance_subtype = $this->input->post('maintenance_subtype'); +// if($maintenance_subtype == '1'){ +// $supplier = $this->input->post('supplier'); +// } +// else{ $supplier = NULL; } +// } +// else{ $maintenance_subtype = NULL; $supplier = NULL; } +// // $maintenance_date = $this->input->post('maintenance_date'); +// // $maintenance_time= $this->input->post('maintenance_time'); +// $location = $this->input->post('location'); +// $maintenance_description = $this->input->post('maintenance_description'); +// $maintenance_reason = $this->input->post('maintenance_reason'); +// // $maintenance_time_from = $this->input->post('maintenance_time_from'); +// // $maintenance_time_to = $this->input->post('maintenance_time_to'); +// $maintenance_date_time = $this->input->post('maintenance_date_time'); +// $maintenance_date_time = explode(" - ",$maintenance_date_time); +// $maintenance_time_from = $maintenance_date_time[0]; +// $maintenance_time_to = $maintenance_date_time[1]; +// $maintenance_total_hrs = $this->input->post('maintenance_total_hrs'); +// $cost_material = $this->input->post('cost_material'); +// $cost_labour = $this->input->post('cost_labour'); +// $updatedby = $this->session->userdata ( 'userId' ); +// $approvedby = $this->input->post('approvedby'); +// $workdoneby = $this->input->post('workdoneby'); +// // $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); +// // $updatedon = $date->format('d-m-Y H:i:s'); + +// $editmntbr = array('Type'=>$type,'Machine_Code'=>$machinecode,'Maint_Subtype'=>$maintenance_subtype, 'Maint_Supplier'=>$supplier,'Maint_Location'=>$location, 'Maint_Description'=>$maintenance_description, 'Maint_Reason'=>$maintenance_reason, 'Maint_Time_from'=>$maintenance_time_from, 'Maint_Time_to'=>$maintenance_time_to, 'Maint_Total_hrs'=>$maintenance_total_hrs, 'Cost_Material'=>$cost_material, 'Cost_Labour'=>$cost_labour,'WorkDone_By'=>$workdoneby,'Approved_By'=>$approvedby,'UpdatedBy'=>$updatedby); +// //'Maint_Date'=>$maintenance_date,'Maint_Time'=>$maintenance_time, +// //print_r($editmntbr); +// //die(); +// // echo $type; +// // echo $mntid; +// // die(); +// $updated = $this->batchcard_model->updatemaint_dtl($editmntbr,$mntid); + +// $count = $this->input->post('hidecounter'); +// $constant = $this->input->post('hideconstant'); +// for($i=1;$i<=$constant;$i++){ +// $pathname = 'browseFiles'.$i; +// if(!empty($_FILES[$pathname]['name'])) +// { +// $varname = 'filename'.$i; +// $temp = $this->input->post($varname); +// $Picture = $this->add($pathname); +// $arr[] = array($temp,$Picture); +// } +// } +// foreach($arr as $ma){ + +// $index = 0; +// foreach($ma as $key=>$value){ +// $index++; +// if($index == 1){ +// $file_descrpition = $value; +// } +// if($index == 2){ +// $filename = $value; +// } +// } + + +// $addfilelist = array( +// 'Machine_code/Maint_id'=>$mntid, +// 'File_name'=>$filename, +// 'Status'=>"1", +// 'Status_description'=>($type == '0') ? ('Maintenaces files') : ('Breakdown files') +// ); +// $this->batchcard_model->addfiledetails($addfilelist); +// //$updatefilelist= array_filter(array_map('array_filter',$updatefilelist )); +// } + +// if($updated >= 0) +// { +// echo ""; +// } + +// } + + + +// function getHistListing() +// { +// $data['HistListing'] = $this->batchcard_model->getHist_mstr(); +// $this->global['pageTitle'] = $this->CompanyName.' : Machine Master/History Listing'; +// $this->loadViews("BatchcardHistListing", $this->global,$data,NULL); +// } + +// function getPODtls(){ + +// $pono = $this->input->post('id'); +// $podtls = $this->batchcard_model->getpo_dtls($pono); +// echo json_encode($podtls); +// } + +// function addHist(){ +// $data['HistDeptList'] = $this->batchcard_model->getdept_dtls(); +// $data['HistPONOList'] = $this->batchcard_model->getpono(); +// $this->global['pageTitle'] = $this->CompanyName.' : Add Machine Master/History '; +// $this->loadViews("BatchcardHistAdd", $this->global,$data,NULL); +// } + +// function autocomplete() +// { +// $mc = $this->input->get('query'); +// $query= $this->batchcard_model->checkMachineCategory($mc); +// echo json_encode($query); +// } + + +// function add($pathname) +// { +// // echo "add files"; +// // die(); +// // echo $pathname; + +// $picture = ''; +// if(!empty($_FILES[$pathname]['name'])) +// { + +// $config['upload_path'] = 'uploads/images/'; +// $config['allowed_types'] = '*'; +// //$config['allowed_types'] = 'jpg|jpeg|png|gif'; +// $config['file_name'] = $_FILES[$pathname]['name']; +// //print_r($config); + +// //Load upload library and initialize configuration +// $this->load->library('upload',$config); +// $this->upload->initialize($config); +// if($this->upload->do_upload($pathname)) +// { +// $uploadData = $this->upload->data(); +// $picture = $uploadData['file_name']; +// } +// else +// { +// $error = array('error' => $this->upload->display_errors()); +// $picture = ''; +// } +// } +// else +// { +// $picture = ''; +// } + +// return $picture ; +// } + + +// function addHist_mstr(){ + +// $machinename= $this->input->post('mach_name'); +// $make= $this->input->post('tomake'); +// $capacity= $this->input->post('machs_capacity'); +// $category= strtoupper($this->input->post('machs_category')); +// $categoryarray = $this->batchcard_model->getmachineCategory(); + +// foreach($categoryarray as $mc){ + +// $TempArr[] = $mc->ConfigValue; + +// } + +// if (in_array($category, $TempArr)){} +// else +// { +// $configcode = 'C028'; +// $config = array('Config_ID'=>$configcode,'ConfigValue'=>$category); +// $query= $this->batchcard_model->insertvalueintoconfig($config); +// } +// $dept= $this->input->post('machs_dept'); +// $location= $this->input->post('machs_locn'); +// $PONO= $this->input->post('machs_pono'); +// $POdate= $this->input->post('machs_podate'); +// $supplier = $this->input->post('machs_supplier'); +// $instalizationdate= $this->input->post('install_date'); +// $machineslifetime = $this->input->post('machs_lifetime'); +// $commencementdate = $this->input->post('machs_comm_date'); +// $createdby = $this->session->userdata ('userId'); + +// $add = array( +// 'Machine_Name' => $machinename, +// 'Machines_Make' => $make, +// 'Machines_Capacity' => $capacity, +// 'Machines_Category' => $category, +// 'Machines_Dept' => $dept, +// 'Factory_Loc' => $location, +// 'Machines_PONO' => $PONO, +// 'Machines_POdate' => $POdate, +// 'Machines_Supplier' => $supplier , +// 'Instalization_Date' => $instalizationdate, +// 'Machines_Lifetime' => $machineslifetime , +// 'Commencement_Date' => $commencementdate , +// 'CreatedBy' => $createdby); + +// $addedmaster = $this->batchcard_model->addhist_mstr($add); + +// $mach_code = ''; + +// if(count($addedmaster)>0) +// { +// foreach ($addedmaster as $key ) { + +// $mach_code=$key->Machine_Code; + +// } +// } + +// $count = $this->input->post('hidecounter'); +// $constant = $this->input->post('hideconstant'); + +// for($i=1;$i<=$constant;$i++){ +// $pathname = 'browseFiles'.$i; +// if(!empty($_FILES[$pathname]['name'])) +// { +// $varname = 'filename'.$i; +// $temp = $this->input->post($varname); +// $Picture = $this->add($pathname); +// $arr[] = array($temp,$Picture); +// } +// } + +// foreach($arr as $ma){ + +// $index = 0; +// foreach($ma as $key=>$value){ +// $index++; +// if($index == 1){ +// $file_descrpition = $value; +// } +// if($index == 2){ +// $filename = $value; +// } +// } +// $addfilelist = array( +// 'Machine_code/Maint_id'=>$mach_code, +// 'File_name'=>$filename, +// 'Status'=>"0", +// 'Status_description'=>"Machine file" +// ); +// $this->batchcard_model->addfiledetails($addfilelist); +// //print_r($addfilelist); +// //die(); + +// } + +// $range = $this->input->post('machs_range'); +// $operatingrange = $this->input->post('machs_operating_range'); +// $leastcount = $this->input->post('machs_least_count'); +// $calibrationagency = $this->input->post('machs_calibration_agency'); +// $Calibrationon = $this->input->post('machs_calibration_on'); +// $Calibrationdue = $this->input->post('machs_calibration_due'); +// if($category == 'LAB'){ $Acctcriteria = $this->input->post('machs_acceptence_criteria'); } +// else{ $Acctcriteria = NULL; } +// $addchild = array( +// 'Machine_Code' => $mach_code, +// 'Machine_Name'=> $machinename, +// 'Range' => $range, +// 'Operating_Range' => $operatingrange, +// 'Least_Count' => $leastcount, +// 'Calibration_Agency' => $calibrationagency, +// 'Calibration_On' => $Calibrationon, +// 'Calibration_Due' => $Calibrationdue, +// 'Acceptence_Criteria'=> $Acctcriteria +// ); + + + +// $addedchild = $this->batchcard_model->addhist_dtl($addchild); + +// echo ""; + +// } + +// function editHist(){ +// //echo 'i am a edit function'; +// //$MachineCode = $_GET['Machcode']; +// $MachineCode = base64_decode(urldecode($this->uri->segment(3))); +// //echo $MachineCode; +// $data['TableDatas'] = $this->batchcard_model->getHist_tbls($MachineCode); +// $data['HistMstrEdit'] = $this->batchcard_model->getHist_mstr($MachineCode); +// $data['HistDtlsEdit'] = $this->batchcard_model->getHist_dtls($MachineCode); +// $data['HistFileEdit'] = $this->batchcard_model->getfiledetails($MachineCode); +// $data['HistDeptList'] = $this->batchcard_model->getdept_dtls(); +// $data['HistPONOList'] = $this->batchcard_model->getpono(); +// //echo count($data['HistFileEdit']); + +// //echo "
"; + +// //echo sizeof($data['HistFileEdit']); +// $this->global['pageTitle'] = $this->CompanyName.' : Edit Machine Master/History '; +// $this->loadViews("BatchcardHistEdit", $this->global,$data,NULL); +// } +// function Removefiledetails(){ + +// $id = $this->input->post('id'); +// $name = $this->input->post('name'); +// $deletedata = $this->batchcard_model->deletefiledetails($id,$name); +// echo $deletedata; +// } + +// function editHist_mstr(){ + +// $code_and_name= $this->input->post('mach_name'); +// $machcn = explode("-",$code_and_name); +// //$machinename = $machcn[1]; +// $machinecode = $machcn[0]; +// $make= $this->input->post('tomake'); +// $capacity= $this->input->post('machs_capacity'); +// $category= strtoupper($this->input->post('machs_category')); +// $categoryarray = $this->batchcard_model->getmachineCategory(); + +// foreach($categoryarray as $mc){ + +// $TempArr[] = $mc->ConfigValue; + +// } + +// if (in_array($category, $TempArr)){} +// else +// { +// $configcode = 'C028'; +// $config = array('Config_ID'=>$configcode,'ConfigValue'=>$category); +// $query= $this->batchcard_model->insertvalueintoconfig($config); +// } +// $dept= $this->input->post('machs_dept'); +// $location= $this->input->post('machs_locn'); +// $PONO= $this->input->post('machs_pono'); +// $POdate= $this->input->post('machs_podate'); +// $supplier = $this->input->post('machs_supplier'); +// $instalizationdate= $this->input->post('install_date'); +// $machineslifetime = $this->input->post('machs_lifetime'); +// $commencementdate = $this->input->post('machs_comm_date'); +// $updatedby = $this->session->userdata ('userId'); + +// $update = array( +// //'Machine_Name' => $machinename, +// 'Machines_Make' => $make, +// 'Machines_Capacity' => $capacity, +// 'Machines_Category' => $category, +// 'Machines_Dept' => $dept, +// 'Factory_Loc' => $location, +// 'Machines_PONO' => $PONO, +// 'Machines_POdate' => $POdate, +// 'Machines_Supplier' => $supplier , +// 'Instalization_Date' => $instalizationdate, +// 'Machines_Lifetime' => $machineslifetime , +// 'Commencement_Date' => $commencementdate , +// 'UpdatedBy' => $updatedby); + +// $updatedmaster = $this->batchcard_model->edithist_mstr($update,$machinecode); + +// $range = $this->input->post('machs_range'); +// $operatingrange = $this->input->post('machs_operating_range'); +// $leastcount = $this->input->post('machs_least_count'); +// $calibrationagency = $this->input->post('machs_calibration_agency'); +// $Calibrationon = $this->input->post('machs_calibration_on'); +// $Calibrationdue = $this->input->post('machs_calibration_due'); +// if($category == 'LAB'){ $Acctcriteria = $this->input->post('machs_acceptence_criteria'); } +// else{ $Acctcriteria = NULL; } + + +// $updatechild = array( +// //'Machine_Code' => $machinecode, +// //'Machine_Name'=> $machinename, +// 'Range' => $range, +// 'Operating_Range' => $operatingrange, +// 'Least_Count' => $leastcount, +// 'Calibration_Agency' => $calibrationagency, +// 'Calibration_On' => $Calibrationon, +// 'Calibration_Due' => $Calibrationdue, +// 'Acceptence_Criteria'=> $Acctcriteria +// ); + +// //print_r($updatechild); +// //die(); + +// $updatedchild = $this->batchcard_model->edithist_dtl($updatechild,$machinecode); + +// $count = $this->input->post('hidecounter'); +// $constant = $this->input->post('hideconstant'); +// for($i=1;$i<=$constant;$i++){ +// $pathname = 'browseFiles'.$i; +// if(!empty($_FILES[$pathname]['name'])) +// { +// $varname = 'filename'.$i; +// $temp = $this->input->post($varname); +// $Picture = $this->add($pathname); +// $arr[] = array($temp,$Picture); +// } +// } +// foreach($arr as $ma){ + +// $index = 0; +// foreach($ma as $key=>$value){ +// $index++; +// if($index == 1){ +// $file_descrpition = $value; +// } +// if($index == 2){ +// $filename = $value; +// } +// } + + +// $addfilelist = array( +// 'Machine_code/Maint_id'=>$machinecode, +// 'File_name'=>$filename, +// 'Status'=>"0", +// 'Status_description'=>"Machine File" +// ); +// $this->batchcard_model->addfiledetails($addfilelist); +// //$updatefilelist= array_filter(array_map('array_filter',$updatefilelist )); +// } +// echo ""; +// //echo ""; +// } + + + + function FinalProductCalculation() + { + + $data['inv_final_product'] = $this->batchcard_model->getinvoice_products(); + $data['consumable_material']= $this->batchcard_model->get_consumablematerials(); + $data['Raw_material'] = $this->batchcard_model->get_rawmaterials(); + $data['Pack_material'] = $this->batchcard_model->get_packmaterials(); + $data['supplier'] = $this->batchcard_model->getSupplierlist(); + + //print_r($data['allhourdata']);die(); + $this->global['pageTitle'] = $this->CompanyName.' : Final Product'; + $this->loadViews("FinalProduct", $this->global,$data,NULL); + } + + + function EditFinalProduct() + { + + $FPId = $_GET['FPId']; + $data['masterproduct'] = $this->batchcard_model->getmasterProductDetails($FPId); + $data['rawmaterial'] = $this->batchcard_model->getrawmaterialDetails($FPId); + $data['consumaterial'] = $this->batchcard_model->getconsumaterialDetails($FPId); + $data['packagematerial'] = $this->batchcard_model->getpackagematerialDetails($FPId); + $data['coproductmaterial'] = $this->batchcard_model->getcoproductmaterial($FPId); + $data['inv_final_product'] = $this->batchcard_model->getinvoice_products(); + $data['consumable_material']= $this->batchcard_model->get_consumablematerials(); + $data['Raw_material'] = $this->batchcard_model->get_rawmaterials(); + $data['Pack_material'] = $this->batchcard_model->get_packmaterials(); + $data['supplier'] = $this->batchcard_model->getSupplierlist(); + + + $this->global['pageTitle'] = $this->CompanyName.' : Final Product'; + $this->loadViews("editFinalProduct", $this->global,$data,NULL); + // $this->loadViews("finaledit", $this->global,$data,NULL); + + + } + + + function FinalProductlisting() + { + $data['final_product'] = $this->batchcard_model->getFinalProductDetaisl(); + + $this->global['pageTitle'] = $this->CompanyName.' : Final Product'; + $this->loadViews("FinalProductlisting", $this->global,$data,NULL); + } + + + + function FinalProductHistory() + { + + $data['inv_final_product'] = $this->batchcard_model->getinvoice_products(); + $this->global['pageTitle'] = $this->CompanyName.' : Final Product'; + $this->loadViews("FinalProductHistory", $this->global,$data,NULL); + } + + + function MaterailAdjustment() + { + $data['MaterialCode'] = $this->batchcard_model->getMaterial(); + $data['Supplier'] = $this->batchcard_model->getSupplierlist(); + + $this->global['pageTitle'] = $this->CompanyName.' : Material Adjustment'; + $this->loadViews("materialadjustment", $this->global,$data,NULL); + } + + + + function MaterailAdjustmentlist() + { + $data['materailAdjustmentlist'] = $this->batchcard_model->getAllMaterialAdjustments(); + + $this->global['pageTitle'] = $this->CompanyName.' : Material Adjustment'; + $this->loadViews("materialadjustmentlist", $this->global,$data,NULL); + } + + function getQuantity() + { + $MaterialCode = $this->input->post('materialcode'); + $date = $this->input->post('date'); + $Supplier = $this->input->post('Supplier'); + + $netQtyarray = $this->batchcard_model->GetNetQty($MaterialCode,$date,$Supplier); + + echo json_encode($netQtyarray); + //print_r($netQtyarray); + + // echo $MaterialCode; + // echo $date; + // echo $Supplier; + } + + + + function getFinishedProduct() + { + $starting_date = $this->input->post('from_date'); + $end_date = $this->input->post('to_date'); + $product_id = $this->input->post('productid'); + + $productlist = $this->batchcard_model->GetFinishedProductList($starting_date,$end_date,$product_id); + + $obj=json_encode($productlist); + echo $obj; + + //print_r($productlist); + } + + + + + // function displaying_stockvalues() + // { + // $MaterialCode = $this->input->post('MaterialCode'); + // $date = $this->input->post('date'); + + // $Qtyarray = $this->batchcard_model->GettotalQty($MaterialCode,$date); + // //print_r($Qtyarray); + // $obj=json_encode($Qtyarray); + // echo $obj; + + // } + + + function displaying_stockvalues() + { + $AdjustmentId = $this->input->post('AdjustmentId'); + $historydetais = $this->batchcard_model->GetMaterialHistory($AdjustmentId); + $SupplierID=''; + // if(!empty($historydetais)) + // { + // foreach($historydetais as $hi) + // { + // $SupplierID = $hi->SupplierID; + // } + // } + + $obj=json_encode($historydetais); + echo $obj; + + } + + + function addNewMaterialHistory() + { + $supplier = $this->input->post('supplier'); + $materialcode = $this->input->post('materialcode'); + $date = $this->input->post('date'); + $ActualQty = $this->input->post('ActualQty'); + $Qty = $this->input->post('AdjustableQty'); + $reason = $this->input->post('reason'); + $Description = $this->input->post('Description'); + $status = $this->input->post('transtatus'); + $CreatedBy = $this->session->userdata('userId'); + $absaluteQty = abs($Qty); + $Isactive=1; + + // echo $Qty; + // echo "abs"; + // echo abs($Qty); + //die(); + + $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); + $createddt = $dt->format('Y-m-d H:i:s'); + + //echo $dt; + + // echo $createddt; + // die(); + + $adjustmentaarray = array('MaterialCode'=>$materialcode,'ActualQuantity'=>$ActualQty,'Quantity'=>$absaluteQty,'SupplierID'=>$supplier,'Reason'=>$reason,'Description'=>$Description,'CreatedOn'=>$createddt, + 'CreatedBy'=>$CreatedBy,'Isactive'=>$Isactive); + + $materialadjust = $this->batchcard_model->AddmaterialAdjustment($adjustmentaarray); + + $adjustId =''; + + if(!empty($materialadjust)) + { + foreach($materialadjust as $ig) + { + $adjustId = $ig->AdjustmentId; + } + } + + + $historytable = array('SupplierID'=>$supplier,'MaterialCode'=>$materialcode,'Transaction_type'=>$status,'Ref_Type'=>'Adjust','Quantity'=>$absaluteQty,'CreatedBy'=>$CreatedBy,'CreatedOn'=>$createddt,'Ref_No'=>$adjustId,'Isactive'=>$Isactive); + + $historyadd = $this->batchcard_model->AddMaterialHistory($historytable); + + + if((count($materialadjust)>0) &&(count($historyadd))) + { + echo "Material Details Added Successfully"; + } + else + { + echo "Something Went Wrong,Please Try Again"; + } + } + + + function Final_Product_Save() + { + $final_product = $this->input->post('DEPTFN'); + $final_qty = $this->input->post('Quantity'); + $product_date = $this->input->post('Date'); + //$pdt = $product_date->format('Y-m-d'); + $pdt = date("Y-m-d", strtotime($product_date)); + $product_value = $this->input->post('values'); + $createdby = $this->session->userdata('userId'); + + $final_master =array('MaterialCode'=>$final_product,'Quantity'=>$final_qty,'Price'=>$product_value,'CreatedBy'=>$createdby,'ProductDate'=>$pdt,'ProductType'=>'Inward'); + + $final_master_save =$this->batchcard_model->insert_final_product($final_master); + + + + + // $final_product_id= $final_master_save[0]['PId']; + $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); + $createddt = $dt->format('Y-m-d H:i:s'); + + + + if(!empty($final_master_save)) + { + foreach($final_master_save as $pm) + { + $final_product_id = $pm->PId; + } + } + + + $final_history= array('RefID'=>$final_product_id,'ProductCode'=>$final_product,'Quantity'=>$final_qty,'Price'=>$product_value,'Transactiondate'=>$createddt,'TransactionType'=>'Inward'); + + + $final_history_save= $this->batchcard_model->SaveFinalHistory($final_history); + + $rawilne = $this->input->post('RawRow'); + $consuline = $this->input->post('ConsuRow'); + $packline = $this->input->post('PkgRow'); + $coproline = $this->input->post('CopRow'); + + //echo $coproline; + + for($i=1;$i<=$rawilne;$i++) + { + $rawmaterial = $this->input->post('rawmaterialcode'.$i); + $rawsupplier =$this->input->post('rawSupplierID'.$i); + $rawqty = $this->input->post('rawQty'.$i); + $rawvalue = $this->input->post('rawprice'.$i); + + $rawarray =array('FPId'=>$final_product_id,'MaterialCode'=>$rawmaterial,'SupplierID'=>$rawsupplier,'Quantity'=>$rawqty,'Price'=>$rawvalue,'CreatedBy'=>$createdby,'CreatedDate'=>$createddt); + + $rawmaterialhistory= array('MaterialCode'=>$rawmaterial,'Transaction_type'=>'Reduce','Ref_Type'=>'Final Product','Ref_No'=>$final_product_id,'SupplierID'=>$rawsupplier,'Quantity'=>$rawqty,'ItemValue'=>$rawvalue,'CreatedBy'=>$CreatedBy,'CreatedOn'=>$createddt); + + + $this->batchcard_model->save_rawmaterialto_materialHistory($rawmaterialhistory); + + //print_r($rawarray); + + $this->batchcard_model->save_finalraw($rawarray); + } + + + for($i=1;$i<=$consuline;$i++) + { + $conmaterial = $this->input->post('consumematerialcode'.$i); + $consupplier =$this->input->post('consumeSupplierID'.$i); + $conqty = $this->input->post('consumeQty'.$i); + $convalue = $this->input->post('consumeprice'.$i); + + $conarray =array('FPId'=>$final_product_id,'MaterialCode'=>$conmaterial,'SupplierID'=>$consupplier,'Quantity'=>$conqty,'Price'=>$convalue,'CreatedBy'=>$createdby,'CreatedDate'=>$createddt); + + $consuhistory= array('MaterialCode'=>$conmaterial,'Transaction_type'=>'Reduce','Ref_Type'=>'Final Product','Ref_No'=>$final_product_id,'SupplierID'=>$consupplier,'Quantity'=>$conqty,'ItemValue'=>$convalue,'CreatedBy'=>$CreatedBy,'CreatedOn'=>$createddt); + + $this->batchcard_model->save_rawmaterialto_materialHistory($consuhistory); + + $this->batchcard_model->save_finalcon($conarray); + } + + + for($i=1;$i<=$packline;$i++) + { + $packmaterial = $this->input->post('packmaterialcode'.$i); + $packsupplier =$this->input->post('packSupplierID'.$i); + $packqty = $this->input->post('packQty'.$i); + $packvalue = $this->input->post('packprice'.$i); + + $packarray =array('FPId'=>$final_product_id,'MaterialCode'=>$packmaterial,'SupplierID'=>$packsupplier,'Quantity'=>$packqty,'Price'=>$packvalue,'CreatedBy'=>$createdby,'CreatedDate'=>$createddt); + + $packmathistory= array('MaterialCode'=>$packmaterial,'Transaction_type'=>'Reduce','Ref_Type'=>'Final Product','Ref_No'=>$final_product_id,'SupplierID'=>$packsupplier,'Quantity'=>$packqty,'ItemValue'=>$packvalue,'CreatedBy'=>$CreatedBy,'CreatedOn'=>$createddt); + + $this->batchcard_model->save_rawmaterialto_materialHistory($packmathistory); + + $this->batchcard_model->save_finalpacking($packarray); + } + + + for($i=1;$i<=$coproline;$i++) + { + + $copmaterial = $this->input->post('Copmaterialcode'.$i); + $codate =$this->input->post('CopDate'.$i); + $copqty = $this->input->post('CopQty'.$i); + $copvalue = $this->input->post('Copprice'.$i); + + $coparray =array('FPId'=>$final_product_id,'MaterialCode'=>$copmaterial,'CoDate'=>$codate,'Quantity'=>$copqty,'Price'=>$copvalue,'CreatedBy'=>$createdby,'CreatedDate'=>$createddt); + + // print_r($coparray); + + $this->batchcard_model->save_finalcoproduct($coparray); + + + $copfinal_history = array('RefID'=>$final_product_id,'ProductCode'=>$copmaterial,'Quantity'=>$copqty,'Price'=>$copvalue,'Transactiondate'=>$createddt,'TransactionType'=>'Inward'); + + $final_cophistory_save= $this->batchcard_model->SaveFinalHistory($copfinal_history); + } + + echo "Details Saved Successfully"; + + + + } + + + + + function UpdateFinal_Product_Save() + { + + + $FPID = $this->input->post('FPId'); + $final_product = $this->input->post('DEPTFN'); + $final_qty = $this->input->post('Quantity'); + + $product_date = $this->input->post('Date'); + //$pdt = $product_date->format('Y-m-d H:i:s'); + //$pdt = date("Y-m-d", strtotime($product_date)); + + $product_value = $this->input->post('values'); + $createdby = $this->session->userdata('userId'); + $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); + $createddt = $dt->format('Y-m-d H:i:s'); + + + $final_master =array('MaterialCode'=>$final_product,'Quantity'=>$final_qty,'Price'=>$product_value,'CreatedBy'=>$createdby,'ProductDate'=>$product_date); + + // / print_r($final_master); + + $final_master_save =$this->batchcard_model->update_final_product($final_master,$FPID); + $lastId=''; + + $final_history= array('ProductCode'=>$final_product,'Quantity'=>$final_qty,'Price'=>$product_value,'Transactiondate'=>$createddt,'TransactionType'=>'Inward'); + +//print_r($final_history); +//die(); + $finalHistoryupdate = $this->batchcard_model->UpdateFinalHistory($final_history,$FPID,$final_product); + + + + $rawilne = $this->input->post('RawRow'); + $consuline = $this->input->post('ConsuRow'); + $packline = $this->input->post('PkgRow'); + $coproline = $this->input->post('CopRow'); + + + for($i=1;$i<=$rawilne;$i++) + { + $rawmaterial = $this->input->post('rawmaterialcode'.$i); + $rawsupplier =$this->input->post('rawSupplierID'.$i); + $rawqty = $this->input->post('rawQty'.$i); + $rawvalue = $this->input->post('rawprice'.$i); + $rawilneno = $this->input->post('RawId'.$i); + //echo $rawilneno; + if($rawmaterial == '' && $rawsupplier == '' & $rawqty == '') + { + + } + + else + { + + $rawarray =array('FPId'=>$FPID,'MaterialCode'=>$rawmaterial,'SupplierID'=>$rawsupplier,'Quantity'=>$rawqty,'Price'=>$rawvalue,'CreatedBy'=>$createdby,'CreatedDate'=>$createddt); + + + + + $rawmaterialhistory= array('MaterialCode'=>$rawmaterial,'Transaction_type'=>'Reduce','Ref_Type'=>'Final Product','Ref_No'=>$FPID,'SupplierID'=>$rawsupplier,'Quantity'=>$rawqty,'ItemValue'=>$rawvalue,'CreatedBy'=>$CreatedBy,'CreatedOn'=>$createddt); + + + $checkrawid=$this->batchcard_model->GetRawid($rawilneno); + + $checkrawhistory = $this->batchcard_model->GetRawCheck($rawmaterial,$FPID); + + // echo $checkrawhistory; + + + if(count($checkrawid)==0) + { + $this->batchcard_model->save_finalraw($rawarray); + $this->batchcard_model->save_rawmaterialto_materialHistory($rawmaterialhistory); + + } + + else + { + $this->batchcard_model->update_finalraw($rawarray,$rawilneno); + $this->batchcard_model->update_rawmaterialto_materialHistory($rawmaterialhistory,$rawmaterial,$FPID); + //$this->batchcard_model->save_rawmaterialto_materialHistory($rawmaterialhistory); + } + + } + } + + + + + for($i=1;$i<=$consuline;$i++) + { + $conmaterial = $this->input->post('consumematerialcode'.$i); + $consupplier =$this->input->post('consumeSupplierID'.$i); + $conqty = $this->input->post('consumeQty'.$i); + $convalue = $this->input->post('consumeprice'.$i); + $consuline = $this->input->post('Consumable'.$i); + + if($conmaterial == '' && $consupplier == '' & $conqty == '') + { + + } + + else + { + + $conarray =array('FPId'=>$FPID,'MaterialCode'=>$conmaterial,'SupplierID'=>$consupplier,'Quantity'=>$conqty,'Price'=>$convalue,'CreatedBy'=>$createdby,'CreatedDate'=>$createddt); + + $consuhistory= array('MaterialCode'=>$conmaterial,'Transaction_type'=>'Reduce','Ref_Type'=>'Final Product','Ref_No'=>$FPID,'SupplierID'=>$consupplier,'Quantity'=>$conqty,'ItemValue'=>$convalue,'CreatedBy'=>$CreatedBy,'CreatedOn'=>$createddt); + + + $checkconsuid=$this->batchcard_model->Getconsuid($consuline); + + if(count($checkconsuid)>0) + { + $this->batchcard_model->update_finalconsu($conarray,$consuline); + $this->batchcard_model->update_rawmaterialto_materialHistory($consuhistory,$conmaterial,$FPID); + } + + else + { + $this->batchcard_model->save_finalcon($conarray); + $this->batchcard_model->save_rawmaterialto_materialHistory($consuhistory); + } + + + } + } + + + + + for($i=1;$i<=$packline;$i++) + { + $packmaterial = $this->input->post('packmaterialcode'.$i); + $packsupplier =$this->input->post('packSupplierID'.$i); + $packqty = $this->input->post('packQty'.$i); + $packvalue = $this->input->post('packprice'.$i); + $packlineId = $this->input->post('packId'.$i); + + if($packmaterial == '' && $packsupplier == '' & $packqty == '') + { + + } + + else{ + + $packarray =array('FPId'=>$FPID,'MaterialCode'=>$packmaterial,'SupplierID'=>$packsupplier,'Quantity'=>$packqty,'Price'=>$packvalue,'CreatedBy'=>$createdby,'CreatedDate'=>$createddt); + + //print_r($packarray); + $packmathistory= array('MaterialCode'=>$packmaterial,'Transaction_type'=>'Reduce','Ref_Type'=>'Final Product','Ref_No'=>$FPID,'SupplierID'=>$packsupplier,'Quantity'=>$packqty,'ItemValue'=>$packvalue,'CreatedBy'=>$CreatedBy,'CreatedOn'=>$createddt); + + $checkpackid=$this->batchcard_model->Getpackid($packlineId); + + if(count($checkpackid)>0) + { + $this->batchcard_model->update_finalpacking($packarray,$packlineId); + + $this->batchcard_model->update_rawmaterialto_materialHistory($packmathistory,$packmaterial,$FPID); + } + + else + { + + $this->batchcard_model->save_rawmaterialto_materialHistory($packmathistory); + + $this->batchcard_model->save_finalpacking($packarray); + } + } + //echo "Updated"; + + } + + + + + for($i=1;$i<=$coproline;$i++) + { + + $copmaterial = $this->input->post('Copmaterialcode'.$i); + $codate =$this->input->post('CopDate'.$i); + $cddt = date("Y-m-d", strtotime($codate) ); + $copqty = $this->input->post('CopQty'.$i); + $copvalue = $this->input->post('Copprice'.$i); + $coplineId = $this->input->post('CopId'.$i); + + if($copmaterial == '' && $codate == '' & $copqty == '') + { + + } + else + { + + $coparray =array('FPId'=>$FPID,'MaterialCode'=>$copmaterial,'CoDate'=>$cddt,'Quantity'=>$copqty,'Price'=>$copvalue,'CreatedBy'=>$createdby,'CreatedDate'=>$createddt); + + $checkpackid=$this->batchcard_model->Getcopid($coplineId); + + // $copfinal_history = array('ProductCode'=>$copmaterial,'Quantity'=>$copqty,'Price'=>$copvalue,'Transactiondate'=>$createddt,'TransactionType'=>'Inward'); + + $copfinal_history = array('RefID'=>$FPID,'ProductCode'=>$copmaterial,'Quantity'=>$copqty,'Price'=>$copvalue,'Transactiondate'=>$createddt,'TransactionType'=>'Inward'); + + + // print_r($coparray); + + if(count($checkpackid)>0) + { + $this->batchcard_model->update_finalcoproduct($coparray,$coplineId); + $finalHistoryupdate = $this->batchcard_model->UpdateFinalHistory($copfinal_history,$FPID,$copmaterial); + + + } + else + { + + $this->batchcard_model->save_finalcoproduct($coparray); + $final_cophistory_save= $this->batchcard_model->SaveFinalHistory($copfinal_history); + } + } + } + + + + echo "Updated Successfully"; + + } + + + function EditMaterialAdjustment() + { + + $AdjustmentId = $_GET['AdjustmentId']; + $Supplier = $_GET['sn']; + $date =$_GET['date']; + $MaterialCode =$_GET['mc']; + $this->global['pageTitle'] = $this->CompanyName.' : Material Adjustment'; + $data['netQuantityarray'] = $this->batchcard_model->GetNetQty($MaterialCode,$date,$Supplier); + //print_r($data['netQuantityarray']); + $data['materailAdjustmentlist'] = $this->batchcard_model->getEditMaterialAdjustments($AdjustmentId); + + $data['materiallist'] = $this->batchcard_model->getMaterial(); + + $data['getSupplierlist'] = $this->batchcard_model->getSupplierlist(); + + $this->loadViews("editmaterialadjustment", $this->global,$data,NULL); + + //return true; + } + function material_history() + { + $this->global['pageTitle'] = $this->CompanyName.' : Material History'; + if ($this->input->post('btn_submit')) { + $prod = $this->input->post('item_name'); + $frm = $this->input->post('from_date'); + $t = $this->input->post('to_date'); + $data['material']=$this->batchcard_model->getMaterial_history($prod,$frm,$t); + } + $data['material_name']=$this->batchcard_model->material_name(); + + $this->loadviews("MaterialHistory",$this->global,$data,NULL); + + + } + function UpdateQuantity() + { + $adjquantity =$this->input->post('adjquantity'); + $reason =$this->input->post('reason'); + $id = $this->input->post('adid'); + //echo $id; + $adjustquantity = $this->input->post('editquantity'); + $description = $this->input->post('desc'); + $updatequantitydes = array('Quantity'=>$adjustquantity,'Description'=>$description,'Reason'=>$reason,'ActualQuantity'=>$adjquantity); + //print_r($updatequantitydes); + $updatequantity=array('Quantity'=>$adjustquantity); + $UpdateQuantityHistory = $this->batchcard_model->updateQuantityStockHistory($updatequantity,$id); + $UpdateQuantityAdj = $this->batchcard_model->updateQuantityAdjusment($updatequantitydes,$id); + + // print_r($updatequantityadj); + + if((count($updatequantityadj)>0) &&(count($updatequantityhistory))) + { + echo "Details Added Successfully"; + } + else + { + echo "Something Went Wrong,Please Try Again"; + } + //$this->loadViews("editmaterialadjustment", $this->global,$data,NULL); + } + function Deletequantity() + { + $AdjustmentId = $_GET['AdjustmentId']; + $Isactive=0; + $Updateactive =array('Isactive'=>$Isactive); + $this->batchcard_model->updateisactiveadjusment($Updateactive,$AdjustmentId); + $this->batchcard_model->updateisactiveastockhistory($Updateactive,$AdjustmentId); + $this->loadViews("editmaterialadjustment", $this->global,$data,NULL); + } + + +} +?> \ No newline at end of file diff --git a/application/models/batchcard_model.php b/application/models/batchcard_model.php new file mode 100755 index 00000000..3e1bb695 --- /dev/null +++ b/application/models/batchcard_model.php @@ -0,0 +1,1202 @@ +db->select('T_Employee_Details.EmpID,T_Employee_Details.FirstName,T_Employee_Details.LastName,T_Employee_Details.Departmentcode,T_DepartmentDetails.shortName'); + $this->db->from('T_Employee_Details'); + $this->db->join('T_DepartmentDetails','T_Employee_Details.Departmentcode=T_DepartmentDetails.DEPCode'); + //$this->db->join('ip_invoice_items','ip_invoices.invoice_number=ip_invoice_items.invoice_number'); + //$this->db->join('ip_products','ip_invoice_items.item_product_id=ip_products.product_id'); + //$this->db->join('ip_invoice_custom','ip_invoices.invoice_number=ip_invoice_custom.invoice_number and invoice_custom_fieldid=62'); + $this->db->order_by('T_Employee_Details.EmpID'); + $res = $this->db->get(); + return $res->result(); + + } + + function getSupplierlist(){ + + $this->db->select('SupplierName,SupplierID'); + $this->db->from('T_SupplierDetailsN'); + $supp = $this->db->get(); + return $supp->result(); + + } + + function saveHourlyBatchInfo($datatostore) + { + $this->db->insert('T_hourly_batch_info',$datatostore); + $res = $this->db->affected_rows(); + + return $res; + } + + function saveDailyBatchCardData($datatostore) + { + $this->db->insert('T_daily_batchcard_data',$datatostore); + $res = $this->db->affected_rows(); + return $res; + } + + function updateHourlyBatchInfo($datatostore,$hid) + { + $this->db->where('hourlyid',$hid); + $this->db->update('T_hourly_batch_info',$datatostore); + $res = $this->db->affected_rows(); + + return $res; + } + + function getAllHourlyData($hid='',$from='',$to='') + { + //echo "Model".$from.'-'.$to; + + $this->db->select('T_hourly_batch_info.*,T_Employee_Details.FirstName as F,T_Employee_Details.LastName as L'); + $this->db->from('T_hourly_batch_info'); + $this->db->join('tbl_users','T_hourly_batch_info.checkedby=tbl_users.userId'); + $this->db->join('T_Employee_Details','tbl_users.EmpID=T_Employee_Details.EmpID'); + if(!empty($hid)) + { + $this->db->where('hourlyid',$hid); + } + if(!empty($from) && !empty($to)) + { + $this->db->where('T_hourly_batch_info.report_date <=',$to); + $this->db->where('T_hourly_batch_info.report_date >=',$from); + } + $this->db->order_by('hourlyid','desc'); + $res = $this->db->get(); + //print_r($res->result());die(); + return $res->result(); + } + + + function checkExistHourlyData($bdate,$btime) + { + //echo 'Model'.$bdate.'-'.$btime; + $this->db->select('count(*) as count'); + $this->db->from('T_hourly_batch_info'); + $this->db->where('report_date',$bdate); + $this->db->where('report_time',$btime); + $res = $this->db->get(); + return $res->result(); + } + + + function getPowerConsumptionDetails($rdate) + { + + $this->db->select('hourlyid,report_time,opening_trp_reading,close_trp_reading,auto_start,auto_stop'); + $this->db->from('T_hourly_batch_info'); + $this->db->where('report_date',$rdate); + $res = $this->db->get(); + return $res->result(); + } + + function getDailyBatchCardData($month) + { + // $this->db->select('*'); + // $this->db->from('T_daily_batchcard_data'); + // $this->db->where('month(ddate)',$month); + $sql = 'select T_daily_batchcard_data.*,T_Employee_Details.FirstName,T_Employee_Details.LastName from T_daily_batchcard_data + join tbl_users on T_daily_batchcard_data.createdby = tbl_users.userId + join T_Employee_Details on T_Employee_Details.EmpID = tbl_users.EmpID + where month(ddate) = ?'; + $res = $this->db->query($sql,array($month)); + return $res->result(); + } + + function getIndividualDailyData($did) + { + + $this->db->select('*'); + $this->db->from('T_daily_batchcard_data'); + $this->db->where('dailyid',$did); + $res = $this->db->get(); + return $res->result(); + + } + + function checkExistDaily($rdate) + { + $this->db->select('count(*) as count'); + $this->db->from('T_daily_batchcard_data'); + $this->db->where('ddate',$rdate); + $res = $this->db->get(); + return $res->result(); + } + + function updateDailyBatchCardData($datatostore,$did) + { + $this->db->where('dailyid',$did); + $this->db->update('T_daily_batchcard_data',$datatostore); + $res = $this->db->affected_rows(); + + return $res; + } + + function checkAbstractReport($date) + { + $this->db->select('count(*) as count'); + $this->db->from('T_abstract_report'); + //$this->db->where('abstract_report_date',$date); + $this->db->where("date_format(abstract_report_date,'%Y-%m')",$date); + $res = $this->db->get(); + return $res->result(); + } + + function saveAbstractReport($datatostore) + { + $this->db->insert('T_abstract_report',$datatostore); + $res = $this->db->affected_rows(); + return $res; + } + + function updateAbstractReport($datatostore,$date,$abstract_details) + { + //$this->db->where('abstract_report_date',$date); + $this->db->where("date_format(abstract_report_date,'%Y-%m')",$date); + $this->db->where('abstract_details',$abstract_details); + $this->db->update('T_abstract_report',$datatostore); + $res = $this->db->affected_rows(); + + return $res; + + } + + function getPreviousMonthAbstractDetails($month,$year) + { + //$sql = "select abstract_details,close_stock from T_abstract_report where month(abstract_report_date) =? and year(abstract_report_date) =? "; + $sql = "select abstract_details,close_stock as Available from T_abstract_report where month(abstract_report_date) =? and year(abstract_report_date) =? "; + $res = $this->db->query($sql,array($month,$year)); + return $res->result(); + + } + + function getMonthAbstractDetails($month_year) + { + $sql = "select abstract_details,close_stock,open_stock as Available,physical_stock from T_abstract_report where date_format(abstract_report_date,'%Y-%m') = ? "; + $res = $this->db->query($sql,array($month_year)); + + return $res->result(); + } + + function getPreviousMonthClosedStockDetails($y,$m,$sn) + { + $month = 'month(ddate)'; + $year = 'year(ddate)'; + //$this->db->select($sn); + $this->db->select($sn,'ddate'); + $this->db->from('T_daily_batchcard_data'); + $this->db->where($month,$m); + $this->db->where($year,$y); + $this->db->order_by('ddate','desc'); + $this->db->limit(1); + $res = $this->db->get(); + //print_r($res->result()); + return $res->result(); + } + + function currentMonthStockDetails($m,$y,$sd1,$sd2) + { + $month = 'month(ddate)'; + $year = 'year(ddate)'; + $list = array('ddate',$sd1,$sd2); + $this->db->select($list); + $this->db->from('T_daily_batchcard_data'); + $this->db->where($month,$m); + $this->db->where($year,$y); + $this->db->order_by('ddate','asc'); + $res = $this->db->get(); + //print_r($res->result()); + return $res->result(); + } + + function addmaint_dtl($array) + { + // $this->db->insert('T_Batchcard_MaintanceDetails',$array); + // $bmd = $this->db->affected_rows(); + // return $bmd; + + $this->db->insert('T_Batchcard_MaintanceDetails',$array); + $bmd = $this->db->affected_rows(); + + + if($bmd>0) + { + $this->db->select('max(Maint_ID) as Maint_ID'); + $this->db->from('T_Batchcard_MaintanceDetails'); + $res = $this->db->get(); + return $res->result(); + } + } + function getmaint_dtl($fdate,$tdate,$type ) + { + + + $this->db->select('BMD.*'); + // $this->db->select() + $this->db->select('CONCAT(ED1.FirstName, " - " , ED1.LastName) AS Approver_Name', FALSE); + $this->db->select('CONCAT(ED2.FirstName, " - " , ED2.LastName) AS Worker_Name', FALSE); + $this->db->from('T_Batchcard_MaintanceDetails BMD'); + + $this->db->join('T_Employee_Details ED1', 'ED1.EmpID = BMD.Approved_By', 'left'); + $this->db->join('T_Employee_Details ED2', 'ED2.EmpID = BMD.WorkDone_By', 'left'); + + + + if ($fdate and $tdate != ''){ + + + $fromdate= date("Y-m-d",strtotime($fdate)); + $todate=date("Y-m-d",strtotime($tdate)); + + $date = "date(BMD.CreatedOn) >= '".$fromdate."' + and date( BMD.CreatedOn) <= '". $todate."'"; + $this->db->where($date); + } + + if($type!=""){ + + $this->db->where("BMD.type" ,$type); + + + } + $bmd = $this->db->get(); + return $bmd->result(); + } + + + + function getmaint_dtl_MntID($MntID) + { + + $this->db->select('*'); + $this->db->from('T_Batchcard_MaintanceDetails'); + $this->db->where('Maint_ID',$MntID); + $bmd = $this->db->get(); + return $bmd->result(); + } + + function updatemaint_dtl($array,$MntID) + { + $this->db->where('Maint_ID',$MntID); + $this->db->update('T_Batchcard_MaintanceDetails',$array); + $bmd = $this->db->affected_rows(); + + return $bmd; + } + + function maintenancesdata($date){ + + $this->db->select("bm.*,mm.Machine_Name"); + $this->db->select("DATE_FORMAT(bm.CreatedOn,'%d-%m-%Y') AS date", FALSE); + $this->db->select("DATE_FORMAT(bm.CreatedOn,'%l:%i %p') AS time", FALSE); + $this->db->select("CONCAT(ED1.FirstName, ' - ' , ED1.LastName) AS Approver_Name", FALSE); + $this->db->select("CONCAT(ED2.FirstName, ' - ' , ED2.LastName) AS Worker_Name", FALSE); + $this->db->from("T_Batchcard_MaintanceDetails bm"); + $this->db->join("T_Machine_Master mm", "bm.Machine_Code = mm.Machine_Code", "left"); + $this->db->join("T_Employee_Details ED1", "bm.Approved_By = ED1.EmpID", "left"); + $this->db->join("T_Employee_Details ED2", "bm.WorkDone_By = ED2.EmpID", "left"); + $this->db->where("mm.Machines_Category = 'TRP'"); + //AND DATE_FORMAT(bm.CreatedOn,'%Y-%m-%d') = '19-04-2018' + $this->db->where("DATE_FORMAT(bm.CreatedOn,'%d-%m-%Y')",$date); + $bmd = $this->db->get(); + return $bmd->result(); + + //print_r($this->db->last_query()); + //die(); + + } + + function getmachine_codename(){ + $this->db->select('Machine_Code,Machine_Name'); + $this->db->from('T_Machine_Master'); + $res = $this->db->get(); + return $res->result(); + } + + /** Machines History/Master */ + function getdept_dtls() + { + $this->db->select('T_DepartmentDetails.DEPCode,T_DepartmentDetails.shortName'); + $this->db->from('T_DepartmentDetails'); + $this->db->where('IsActive',1); + $res = $this->db->get(); + return $res->result(); + } + + function getpono(){ + + $this->db->select('PONO'); + $this->db->from('T_PurchaseOrder_Master'); + $this->db->where('Status','ST026'); + $res = $this->db->get(); + return $res->result(); + } + + function getpo_dtls($pono){ + + // $this->db->select('T_PurchaseOrder_Master.PONO,T_PurchaseOrder_Master.SupplierID,T_SupplierDetailsN.SupplierName,DATE_FORMAT(T_PurchaseOrder_Master.PODate,"%d-%m-%Y") as PO_Date'); + // $this->db->from('T_PurchaseOrder_Master'); + // $this->db->join('T_SupplierDetailsN','T_PurchaseOrder_Master.SupplierID=T_SupplierDetailsN.SupplierID'); + // $this->db->where('PONO',$pono); + // $res = $this->db->get(); + // return $res->result(); + $sql = "select T_PurchaseOrder_Master.PONO,T_PurchaseOrder_Master.SupplierID,T_SupplierDetailsN.SupplierName,DATE_FORMAT(T_PurchaseOrder_Master.PODate,'%d-%m-%Y') as PO_Date + from T_PurchaseOrder_Master + join T_SupplierDetailsN on T_PurchaseOrder_Master.SupplierID=T_SupplierDetailsN.SupplierID + where PONO = ? "; + $res = $this->db->query($sql,array($pono)); + return $res->result(); + + } + + function addhist_mstr($array) + { + $this->db->insert('T_Machine_Master',$array); + $mstr = $this->db->affected_rows(); + //print_r($this->db->last_query()); + //print_r($mstr); + if($mstr>0) + { + + $this->db->select('max(Machine_Code) as Machine_Code'); + $this->db->from('T_Machine_Master'); + $res = $this->db->get(); + //print_r($res->result()); + return $res->result(); + + + + + + } + + } + function addhist_dtl($array){ + + $this->db->insert('T_Machine_Details',$array); + $child = $this->db->affected_rows(); + return $child; + + } + //This function for multi file upload option (both machine and maint/br screen) + function addfiledetails($array){ + + $this->db->insert('T_Machines_file', $array); + $r = $this->db->affected_rows(); + return $r; + //return TRUE; + + } + function insertvalueintoconfig($config){ + + $this->db->insert('T_ConfigDetails', $config); + return TRUE; + } + + //This function used to get the material category using configdetails table + function getmachineCategory($MaterialCategory = '') + { + $Config_ID = 'C028'; + $this->db->select('Config_ID,ConfigValue'); + $this->db->from('T_ConfigDetails'); + $this->db->where('Config_id',$Config_ID ); + if($MaterialCategory != '') + { + $this->db->where('ConfigValue !=',$MaterialCategory ); + } + $query = $this->db->get(); + + return $query->result(); + } + + + function getHist_dtls($MachineCode = '') + { + + $this->db->select('*'); + $this->db->from('T_Machine_Details'); + if($MachineCode != '') + { + $this->db->where('Machine_Code',$MachineCode ); + } + $bmd = $this->db->get(); + return $bmd->result(); + } + + //This function for multi file upload option (both machine and maint/br screen) + function getfiledetails($data = '') + { + + $this->db->select('*'); + $this->db->from('T_Machines_file'); + if($data != '') + { + $this->db->where('Machine_code/Maint_id',$data ); + } + $bmd = $this->db->get(); + return $bmd->result(); + } + + function getHist_mstr($MachineCode = '') + { + + $this->db->select('*'); + $this->db->from('T_Machine_Master'); + if($MachineCode != '') + { + $this->db->where('Machine_Code',$MachineCode ); + } + $bmd = $this->db->get(); + return $bmd->result(); + } + + // function getHist_dtlsID($MntID) + // { + + // $this->db->select('*'); + // $this->db->from('T_Batchcard_MaintanceDetails'); + // $this->db->where('Maint_ID',$MntID); + // $bmd = $this->db->get(); + // return $bmd->result(); + // } + + // function getHist_dtlsDate($dateval) + // { + + // $this->db->select('*'); + // $this->db->from('T_Batchcard_MaintanceDetails'); + // $this->db->where('Maint_Date',$dateval); + // $bmd = $this->db->get(); + // return $bmd->result(); + // } + + + function edithist_mstr($array,$machinecode){ + + $this->db->where('Machine_Code',$machinecode ); + $this->db->update('T_Machine_Master',$array); + $mstr = $this->db->affected_rows(); + if($mstr>0) + { + + $this->db->select('max(Machine_Code) as Machine_Code'); + $this->db->from('T_Machine_Master'); + $res = $this->db->get(); + return $res->result(); + } + + } + + function edithist_dtl($array,$machinecode){ + $this->db->where('Machine_Code',$machinecode ); + $this->db->update('T_Machine_Details',$array); + $mdtl = $this->db->affected_rows(); + return $mdtl; + } + + function updatefilelist($array,$fileid){ + + $this->db->where('File_No',$fileid); + $this->db->update('T_Machines_file', $array); + $ar = $this->db->affected_rows(); + return $ar; + + } + + function checkMachineCategory($mc){ + + // $this->db->select('ConfigValue'); + // $this->db->from('T_ConfigDetails'); + // $this->db->where(Config_ID,'C023'); + // $this->db->like('ConfigValue',$mc); + // $query = $this->db->get(); + // //print_r($query->result()); + // return $query->result(); + + // //return $this->db->get('T_MaterialMaster'); + // } + $temp[] = '' ; + + $this->db->distinct(); + $this->db->select('ConfigValue'); + $this->db->from('T_ConfigDetails'); + $this->db->where('Config_ID','C028'); + $this->db->like('ConfigValue',$mc); + $query = $this->db->get(); + //print_r($query->result());die; + $temparr[] = '' ; + foreach($query->result() as $arr){ + $temparr[] = $arr->ConfigValue ; + } + $temp['suggestions'] = $temparr; + //print_r($temp); + + return $temp; + } + + //This function for multi file upload option (both machine and maint/br screen) + function deletefiledetails($id,$name){ + $sql = "DELETE FROM T_Machines_file WHERE File_No =".$id; + unlink("uploads/images/".$name);//this deletes the file on particular folder too + $query = $this->db->query($sql); + $ar = $this->db->affected_rows(); + return $ar; + } + + + function getHist_tbls($MachineCode){ + + $this->db->select('T_Machine_Master.*,T_Batchcard_MaintanceDetails.*,T_DepartmentDetails.DepartmentName'); + $this->db->select("DATE_FORMAT(T_Batchcard_MaintanceDetails.CreatedOn,'%d-%m-%Y') AS date", FALSE); + $this->db->select("DATE_FORMAT(T_Batchcard_MaintanceDetails.CreatedOn,'%l:%i %p') AS time", FALSE); + $this->db->select("CONCAT(ED1.FirstName, ' - ' , ED1.LastName) AS Approver_Name", FALSE); + $this->db->select("CONCAT(ED2.FirstName, ' - ' , ED2.LastName) AS Worker_Name", FALSE); + $this->db->from('T_Machine_Master'); + $this->db->join('T_Batchcard_MaintanceDetails','T_Batchcard_MaintanceDetails.Machine_Code=T_Machine_Master.Machine_Code'); + $this->db->join('T_DepartmentDetails','T_DepartmentDetails.DEPCode=T_Machine_Master.Machines_Dept'); + $this->db->join('T_Employee_Details ED1', 'ED1.EmpID = T_Batchcard_MaintanceDetails.Approved_By', 'left'); + $this->db->join('T_Employee_Details ED2', 'ED2.EmpID = T_Batchcard_MaintanceDetails.WorkDone_By', 'left'); + $this->db->where('T_Machine_Master.Machine_Code',$MachineCode); + $res = $this->db->get(); + return $res->result(); + + // $sql = "SELECT T_Machine_Master.*,T_Batchcard_MaintanceDetails.*, + // T_DepartmentDetails.DepartmentName, + // DATE_FORMAT(T_Batchcard_MaintanceDetails.CreatedOn, '%d-%m-%Y') as date, + // DATE_FORMAT(T_Batchcard_MaintanceDetails.CreatedOn, '%l:%i %p') as time, + // FROM T_Machine_Master + // LEFT JOIN T_Batchcard_MaintanceDetails ON T_Batchcard_MaintanceDetails.Machine_Code=T_Machine_Master.Machine_Code + // LEFT JOIN T_DepartmentDetails ON T_DepartmentDetails.DEPCode=T_Machine_Master.Machines_Dept + // WHERE T_Machine_Master.Machine_Code = '".$MachineCode."'" ; + // $res = $this->db->query($sql); + // return $res->result(); + + } + + + + + + function getinvoice_products() + { + + $this->db->select('product_id,product_name'); + $this->db->from('ip_products'); + $supp = $this->db->get(); + return $supp->result(); + + } + + function get_consumablematerials() + { + + $this->db->select('MaterialCode,MaterialName,'); + $this->db->from('T_MaterialMaster'); + $this->db->where('T_MaterialMaster.Category',Consumables); + $supp = $this->db->get(); + return $supp->result(); + + } + + + function get_rawmaterials() + { + $this->db->select('MaterialCode,MaterialName,'); + $this->db->from('T_MaterialMaster'); + $this->db->where('T_MaterialMaster.Category',RawMaterial); + $supp = $this->db->get(); + return $supp->result(); + } + + + function get_packmaterials() + { + $this->db->select('MaterialCode,MaterialName,'); + $this->db->from('T_MaterialMaster'); + $this->db->where('T_MaterialMaster.Category',Packingmaterial); + $supp = $this->db->get(); + return $supp->result(); + } + + + function getMaterial() + { + $this->db->select('MaterialCode,MaterialName,'); + $this->db->from('T_MaterialMaster'); + //$this->db->where('T_MaterialMaster.Category',Consumables); + $supp = $this->db->get(); + return $supp->result(); + } + + + + function GettotalQty($MaterialCode,$date) + { + echo $model; + $dt = date('d',strtotime($date)); + $year = date('Y', strtotime($date)); + $month = date('m', strtotime($date)); + if($month<04) + { + //echo "b4finance"; + $newyr = $year - 1; + $startdate = $newyr.'-'.'04'.'-'.'01'; + + //echo $startdate; + } + else + { + //echo "after Finance"; + $startdate = $year.'-'.'04'.'-'.'01'; + // echo $startdate; + } + + $nedt= $dt; + + $newdate=$year.'-'.$month.'-'.$nedt; + + $subQuery='select T_MaterialMaster.MaterialName,T_Material_stock_history.MaterialCode,ifnull((select ifnull(sum(Quantity),0) as AddQty from T_Material_stock_history +where Transaction_type = "Add" and MaterialCode=?),0) as Addqty, +ifnull((select ifnull(sum(Quantity),0) as ReduceQty from T_Material_stock_history where Transaction_type = "Reduce" +and MaterialCode=?),0) as ReduceQty from T_Material_stock_history join T_MaterialMaster on T_Material_stock_history.MaterialCode=T_MaterialMaster.MaterialCode where T_Material_stock_history.MaterialCode=? +and CreatedOn >= ? and CreatedOn<=? group by Addqty'; + + $query = $this->db->query($subQuery,array($MaterialCode,$MaterialCode,$MaterialCode,$startdate,$newdate)); + //print_r($this->db->last_query()); + return $query->result_array(); + + + } + + + function GetNetQty($MaterialCode,$date,$Supplier) + { + //echo $date; + $dt = date('d',strtotime($date)); + $year = date('Y', strtotime($date)); + $month = date('m', strtotime($date)); + + if($month<04) + { + //echo "b4finance"; + $newyr = $year - 1; + $startdate = $newyr.'-'.'04'.'-'.'01'; + + //echo $startdate; + } + + else + { + //echo "after Finance"; + $startdate = $year.'-'.'04'.'-'.'01'; + // echo $startdate; + } + + $nedt= $dt+1; + + $newdate=$year.'-'.$month.'-'.$nedt; + + +// $subQuery='select (select sum(Quantity) as AddQty from T_Material_stock_history where Transaction_type = "Add" and MaterialCode=? +// ) as Addqty,(select sum(Quantity) as ReduceQty from T_Material_stock_history where Transaction_type = "Reduce" and MaterialCode=? +// ) as ReduceQty from T_Material_stock_history where MaterialCode=? and CreatedOn >= ? and CreatedOn<=? and SupplierID=? group by Addqty'; + + + $subQuery='select ifnull((select ifnull(sum(Quantity),0) as AddQty from T_Material_stock_history +where Transaction_type = "Add" and MaterialCode=? and SupplierID=? ),0) as Addqty, +ifnull((select ifnull(sum(Quantity),0) as ReduceQty from T_Material_stock_history where Transaction_type = "Reduce" +and MaterialCode=? and SupplierID=? ),0) as ReduceQty from T_Material_stock_history where MaterialCode=? +and CreatedOn >= ? and CreatedOn<=? and SupplierID=? group by Addqty'; + + $query = $this->db->query($subQuery,array($MaterialCode,$Supplier,$MaterialCode,$Supplier,$MaterialCode,$startdate,$newdate,$Supplier)); + //print_r($this->db->last_query()); + return $query->result_array(); + + + } + + + function GetMaterialHistory($AdjustmentId) + { + $this->db->select('T_Material_Adjustment.*,SupplierName,MaterialName'); + $this->db->from('T_Material_Adjustment'); + $this->db->join('T_SupplierDetailsN',"T_SupplierDetailsN.SupplierID=T_Material_Adjustment.SupplierID"); + $this->db->join('T_MaterialMaster',"T_MaterialMaster.MaterialCode=T_Material_Adjustment.MaterialCode"); + $this->db->where('T_Material_Adjustment.AdjustmentId',$AdjustmentId); + $supp = $this->db->get(); + return $supp->result(); + + join("T_Machine_Master mm", "bm.Machine_Code = mm.Machine_Code", "left"); + } + + + + + function AddmaterialAdjustment($adjustmentaarray) + { + $this->db->trans_start(); + $this->db->insert('T_Material_Adjustment',$adjustmentaarray); + $insert_id = $this->db->affected_rows(); + $this->db->trans_complete(); + // print_r($this->db->last_query()); + //print_r($insert_id); + if($insert_id>0) + { + $subQuery = 'select max(AdjustmentId) as AdjustmentId from T_Material_Adjustment'; + $query = $this->db->query($subQuery); + + return $query->result(); + } + } + + + function AddMaterialHistory($historytable) + { + $this->db->trans_start(); + $this->db->insert('T_Material_stock_history',$historytable); + $insert_id = $this->db->affected_rows(); + $this->db->trans_complete(); + return $insert_id; + + } + + + function insert_final_product($final_master) + { + $this->db->trans_start(); + $this->db->insert('T_FinalProduct_Master',$final_master); + $insert_id = $this->db->affected_rows(); + $this->db->trans_complete(); + // print_r($this->db->last_query()); + //print_r($insert_id); + if($insert_id>0) + { + $subQuery = 'select max(FPId) as PId from T_FinalProduct_Master'; + $query = $this->db->query($subQuery); + + return $query->result(); + } + } + + + function save_finalraw($rawarray) + { + $this->db->trans_start(); + $this->db->insert('T_FinalProduct_RawMaterials',$rawarray); + $insert_id = $this->db->affected_rows(); + $this->db->trans_complete(); + return true; + + } + + + function save_finalcon($conarray) + { + $this->db->trans_start(); + $this->db->insert('T_FinalProduct_ConsumableMaterials',$conarray); + $insert_id = $this->db->affected_rows(); + $this->db->trans_complete(); + return true; + } + + function save_finalpacking($packarray) + { + $this->db->trans_start(); + $this->db->insert('T_FinalProduct_PackingMaterials',$packarray); + $insert_id = $this->db->affected_rows(); + $this->db->trans_complete(); + return true; + } + + + function save_finalcoproduct($coparray) + { + + //print_r($coparray); + $this->db->trans_start(); + $this->db->insert('T_FinalProduct_CoProduct_Materials',$coparray); + $insert_id = $this->db->affected_rows(); + $this->db->trans_complete(); + return true; + } + + + function getAllMaterialAdjustments() + { + $this->db->select('T_Material_Adjustment.*,SupplierName,MaterialName'); + $this->db->from('T_Material_Adjustment'); + $this->db->join('T_SupplierDetailsN', 'T_Material_Adjustment.SupplierID = T_SupplierDetailsN.SupplierID'); + $this->db->join('T_MaterialMaster', 'T_MaterialMaster.MaterialCode = T_Material_Adjustment.MaterialCode'); + $res = $this->db->get(); + return $res->result(); + } + + + + + function save_rawmaterialto_materialHistory($materialhistory) + { + $this->db->trans_start(); + $this->db->insert('T_Material_stock_history',$materialhistory); + $insert_id = $this->db->affected_rows(); + $this->db->trans_complete(); + return true; + } + + + function getFinalProductDetaisl() + { + $this->db->select('T_FinalProduct_Master.*,product_name,product_description'); + $this->db->from('T_FinalProduct_Master'); + $this->db->join('ip_products','ip_products.product_id=T_FinalProduct_Master.MaterialCode'); + $res = $this->db->get(); + return $res->result(); + + } + + + function getmasterProductDetails($FPId) + { + $this->db->select('T_FinalProduct_Master.*,product_name,product_description'); + $this->db->from('T_FinalProduct_Master'); + $this->db->join('ip_products','ip_products.product_id=T_FinalProduct_Master.MaterialCode'); + $this->db->where('T_FinalProduct_Master.FPId',$FPId); + $res = $this->db->get(); + return $res->result(); + } + + + function getrawmaterialDetails($FPId) + { + $this->db->select('T_FinalProduct_RawMaterials.*,SupplierName,MaterialName'); + $this->db->from('T_FinalProduct_RawMaterials'); + $this->db->join('T_MaterialMaster','T_MaterialMaster.MaterialCode=T_FinalProduct_RawMaterials.MaterialCode'); + $this->db->join('T_SupplierDetailsN','T_SupplierDetailsN.SupplierID=T_FinalProduct_RawMaterials.SupplierID'); + $this->db->where('T_FinalProduct_RawMaterials.FPId',$FPId); + $res = $this->db->get(); + return $res->result(); + } + + + function getconsumaterialDetails($FPId) + { + $this->db->select('T_FinalProduct_ConsumableMaterials.*,SupplierName,MaterialName'); + $this->db->from('T_FinalProduct_ConsumableMaterials'); + $this->db->join('T_MaterialMaster','T_MaterialMaster.MaterialCode=T_FinalProduct_ConsumableMaterials.MaterialCode'); + $this->db->join('T_SupplierDetailsN','T_SupplierDetailsN.SupplierID=T_FinalProduct_ConsumableMaterials.SupplierID'); + $this->db->where('T_FinalProduct_ConsumableMaterials.FPId',$FPId); + $res = $this->db->get(); + return $res->result(); + } + + + function getpackagematerialDetails($FPId) + { + $this->db->select('T_FinalProduct_PackingMaterials.*,SupplierName,MaterialName'); + $this->db->from('T_FinalProduct_PackingMaterials'); + $this->db->join('T_MaterialMaster','T_MaterialMaster.MaterialCode=T_FinalProduct_PackingMaterials.MaterialCode'); + $this->db->join('T_SupplierDetailsN','T_SupplierDetailsN.SupplierID=T_FinalProduct_PackingMaterials.SupplierID'); + $this->db->where('T_FinalProduct_PackingMaterials.FPId',$FPId); + $res = $this->db->get(); + return $res->result(); + } + + + function getcoproductmaterial($FPId) + { + $subQuery ='select T_FinalProduct_CoProduct_Materials.*,product_name + from T_FinalProduct_CoProduct_Materials + join ip_products on ip_products.product_id = T_FinalProduct_CoProduct_Materials.MaterialCode + where T_FinalProduct_CoProduct_Materials.FPId=?'; + + $query = $this->db->query($subQuery,array($FPId)); + + return $query->result_array(); + + } + + + function update_final_product($final_master,$FPId) + { + //print_r($final_master); + $this->db->where('FPId', $FPId); + $this->db->update('T_FinalProduct_Master', $final_master); + $insert_id = $this->db->affected_rows(); + //return TRUE; + if($insert_id>0) + { + $subQuery = 'select max(FPId) as FPId from T_FinalProduct_Master'; + + $query = $this->db->query($subQuery,array()); + + return $query->result_array(); + } + } + + + + function GetRawid($rawilneno) + { + $this->db->select('*'); + $this->db->from('T_FinalProduct_RawMaterials'); + $this->db->where('RawId',$rawilneno); + $query = $this->db->get(); + //print_r($this->db->last_query()); + return $query->result(); + } + + + + function Getconsuid($consuline) + { + $this->db->select('*'); + $this->db->from('T_FinalProduct_ConsumableMaterials'); + $this->db->where('ConId',$consuline); + $query = $this->db->get(); + //print_r($this->db->last_query()); + return $query->result(); + } + + + function Getpackid($packlineId) + { + + $this->db->select('*'); + $this->db->from('T_FinalProduct_PackingMaterials'); + $this->db->where('PackId',$packlineId); + $query = $this->db->get(); + //print_r($this->db->last_query()); + return $query->result(); + } + + + function Getcopid($coplineId) + { + $this->db->select('*'); + $this->db->from('T_FinalProduct_CoProduct_Materials'); + $this->db->where('CoId',$coplineId); + $query = $this->db->get(); + //print_r($this->db->last_query()); + return $query->result(); + + } + + + function update_finalraw($rawarray,$rawilneno) + { + $this->db->where('RawId', $rawilneno); + $this->db->update('T_FinalProduct_RawMaterials', $rawarray); + return TRUE; + } + + + function GetRawCheck($rawmaterial,$final_product_id) + { + $this->db->select('*'); + $this->db->from('T_Material_stock_history'); + $this->db->where('MaterialCode',$rawmaterial); + $this->db->where('Ref_No',$final_product_id); + $this->db->where('Ref_Type',FinalProduct); + $query = $this->db->get(); + //print_r($this->db->last_query()); + return $query->result(); + } + + + function update_rawmaterialto_materialHistory($rawmaterialhistory,$rawmaterial,$FPID) + { + $this->db->where('Ref_No', $FPID); + $this->db->where('MaterialCode', $rawmaterial); + $this->db->update('T_Material_stock_history', $rawmaterialhistory); + return TRUE; + } + + + function update_finalconsu($conarray,$consuline) + { + $this->db->where('ConId', $consuline); + $this->db->update('T_FinalProduct_ConsumableMaterials', $conarray); + return TRUE; + } + + + function update_finalpacking($conarray,$packlineId) + { + $this->db->where('PackId', $packlineId); + $this->db->update('T_FinalProduct_PackingMaterials', $conarray); + return TRUE; + } + + + function update_finalcoproduct($coparray,$coplineId) + { + $this->db->where('CoId', $coplineId); + $this->db->update('T_FinalProduct_CoProduct_Materials', $coparray); + return TRUE; + } + function getEditMaterialAdjustments($AdjustmentId) + { + + $this->db->select('T_Material_Adjustment.*,SupplierName,MaterialName,Description,AdjustmentId,ActualQuantity,T_Material_stock_history.Quantity,Ref_Type,Transaction_type'); + $this->db->from('T_Material_Adjustment'); + $this->db->join('T_Material_stock_history', 'T_Material_Adjustment.AdjustmentId = T_Material_stock_history.Ref_No and T_Material_stock_history.Ref_Type="Adjust"'); + $this->db->join('T_SupplierDetailsN', 'T_Material_Adjustment.SupplierID = T_SupplierDetailsN.SupplierID'); + $this->db->join('T_MaterialMaster', 'T_MaterialMaster.MaterialCode = T_Material_Adjustment.MaterialCode'); + $this->db->where('T_Material_Adjustment.AdjustmentId',$AdjustmentId); + $res = $this->db->get(); + return $res->result(); + } + function material_name(){ + $sql="SELECT distinct MaterialName FROM T_MaterialMaster;"; + $query = $this->db->query($sql); + return $query->result(); + } + function getMaterial_history($prod,$frm,$t) + { + $sql="SELECT msh.StockId,sd.SupplierName,mm.MaterialName,msh.Transaction_type,msh.Ref_Type,msh.Ref_No,msh.Quantity,msh.ItemValue,date_format(msh.UpdatedOn,'%d-%m-%Y') as updatedOn FROM T_Material_stock_history as msh + left join T_SupplierDetailsN as sd on sd.SupplierID=msh.SupplierID + left join T_MaterialMaster as mm on mm.MaterialCode=msh.MaterialCode + where msh.StockId != 'null' "; + if ($prod!= ''){ + + $sql.=" and mm.MaterialName = '".$prod."' "; + + } + if ($frm and $t != ''){ + $fromd= date("Y-m-d",strtotime($frm)); + $tod=date("Y-m-d",strtotime($t)); + + + $sql.="and date(msh.UpdatedOn) >= '".$fromd."' + and date(msh.UpdatedOn) <= '".$tod."'"; + + } + + + $query =$this->db->query($sql); + return $query->result(); + + + } + //created by TamilBala + //for update quantity stockhistory + function updateQuantityStockHistory($updatequantity,$id) + { + + $this->db->where('Ref_No',$id); + $this->db->where('Ref_Type',Adjust); + $this->db->update('T_Material_stock_history',$updatequantity); + $r = $this->db->affected_rows(); + //return $r->result(); + //echo "HIS"; + + } + + //created by TamilBala + //for update quantity T_Material_Adjustment + + function updateQuantityAdjusment($updatequantitydes,$id) + { + $this->db->where('AdjustmentId',$id); + $this->db->update('T_Material_Adjustment',$updatequantitydes); + $r = $this->db->affected_rows(); + return $r; + + } + //created by TamilBala + //for update isactive T_Material_Adjustment + function updateisactiveadjusment($Updateactive,$AdjustmentId) + { + $this->db->where('AdjustmentId',$AdjustmentId); + $this->db->update('T_Material_Adjustment',$Updateactive); + $r = $this->db->affected_rows(); + return $r; + + } + + //created by TamilBala + //for update isactive stockhistory + function updateisactiveastockhistory($Updateactive,$AdjustmentId) + { + $this->db->where('Ref_No',$AdjustmentId); + $this->db->where('Ref_Type',Adjust); + $this->db->update('T_Material_stock_history',$Updateactive); + $r = $this->db->affected_rows(); + return $r; + } + + + +// function GetFinishedProductList($starting_date,$end_date,$product_id) +// { + + +// $subQuery ='select ip_products.product_id,ip_products.product_name,ip_invoices.invoice_id,ip_invoice_items.item_quantity,ip_invoice_items.item_price,ip_invoices.invoice_number as IDnumber,ip_invoices.receivedstatus as Type from ip_products join ip_invoice_items on ip_products.product_id = ip_invoice_items.item_product_id join ip_invoices on ip_invoice_items.invoice_id = ip_invoices.invoice_id +// join T_FinalProduct_Master on ip_products.product_id = T_FinalProduct_Master.MaterialCode where (ip_invoices.invoice_date_modified>=? and ip_invoices.invoice_date_modified<=? and ip_invoice_items.item_product_id=?) union + +// select ip_products.product_id,ip_products.product_name,T_FinalProduct_Master.FPId,T_FinalProduct_Master.Quantity,T_FinalProduct_Master.Price,T_FinalProduct_Master.FPId as IDnumber,T_FinalProduct_Master.ProductType as Type from ip_products join ip_invoice_items on ip_products.product_id = ip_invoice_items.item_product_id +// join T_FinalProduct_Master on ip_products.product_id = T_FinalProduct_Master.MaterialCode where +// (T_FinalProduct_Master.ProductDate<=? and T_FinalProduct_Master.ProductDate>=? and T_FinalProduct_Master.MaterialCode=?) group by FPId'; + +// $query = $this->db->query($subQuery,array($starting_date,$end_date,$product_id,$end_date,$starting_date,$product_id)); + +// //print_r($this->db->last_query()); + + +// return $query->result_array(); + + +// } + + +function GetFinishedProductList($starting_date,$end_date,$product_id) +{ + + + // $subQuery = 'select * from T_FinalProduct_History,ip_products.product_name + // join ip_products on T_FinalProduct_History.ProductCode = ip_products.product_id + + // where ProductCode=? + // and Transactiondate >= ? and Transactiondate <= ?'; + + $subQuery='select RefID,ProductCode,Quantity,Price,Transactiondate,TransactionType,product_name +from T_FinalProduct_History +join ip_products on ip_products.product_id= T_FinalProduct_History.ProductCode +where ProductCode=? and Transactiondate >= ? and Transactiondate <= ?'; + + $query = $this->db->query($subQuery,array($product_id,$starting_date,$end_date)); + return $query->result_array(); + +} + + + function SaveFinalHistory($final_history) + { + $this->db->trans_start(); + $this->db->insert('T_FinalProduct_History',$final_history); + $insert_id = $this->db->affected_rows(); + $this->db->trans_complete(); + return true; + } + + + function UpdateFinalHistory($final_history,$FPID,$rawmaterial) + { + //print_r($final_history); + $this->db->where('RefID', $FPID); + $this->db->where('ProductCode',$rawmaterial); + $this->db->update('T_FinalProduct_History',$final_history); + //print_r($this->db->last_query()); + return TRUE; + } + + +} + +?> \ No newline at end of file diff --git a/application/views/FinalProduct.php b/application/views/FinalProduct.php new file mode 100644 index 00000000..6ba7261d --- /dev/null +++ b/application/views/FinalProduct.php @@ -0,0 +1,2575 @@ + + + + + + + + + + + +
+
+
+ +
+
+ +

+
+ +
+ + +
+ +
+ +
+ + 'form-label-left final_product ','name' => 'final_product','id' => 'final_product'); + + echo form_open($this->config->base_url().'/batchcard/Final+Product/',$attributes); + ?> + +
+
+ + + + 'Select Material'); + + if(!empty($inv_final_product)) + { + foreach ($inv_final_product as $SID): + + + $options2[$SID->product_id] = $SID->product_id.' '.' - '.' '.$SID->product_name; + + endforeach; + } + + echo form_dropdown('DEPTFN', $options2,set_value('DEPTFN',$SupId),'id="DEPTFN"' ,'required="true"' ,'class="form-control select2'); + + // $data = array('name' => 'Department','value' => set_value('Department'),'id'=>'Department', 'class' => 'form-control' ,'required' => 'true'); + // echo form_input($data); + + ?> + +
+ +
+ + 'Date','value' => set_value('Date',$CurrentDate),'id'=>'Date', 'class' => 'form-control' ,'required' => 'true', 'onkeypress'=>'return false;'); + echo form_input($data); + ?> +
+
+ + +
+ 'PlaceOforigin','value' => set_value('PlaceOforigin'),'id'=>'PlaceOforigin', 'class' => 'form-control' ,'required' => 'true', 'onkeypress'=>'return false;'); + // echo form_input($data); + $data = array('name' => 'Quantity','value' => set_value('Quantity'),'id'=>'Quantity', 'class' => 'form-control' ,'required' => 'true'); + echo form_input($data); + ?> +
+ +
+ +
+ + +
+ 'PlaceOforigin','value' => set_value('PlaceOforigin'),'id'=>'PlaceOforigin', 'class' => 'form-control' ,'required' => 'true', 'onkeypress'=>'return false;'); + // echo form_input($data); + $data = array('name' => 'values','value' => set_value('values'),'id'=>'values', 'class' => 'form-control' ,'required' => 'true'); + echo form_input($data); + ?> +
+ +
+ + + + + + + +
+
+
+ + +
+
Raw Materials
+ +
+
+ + + Raw Materials + + + + + + + +
+
+
+
+ +
+ + + + + + + + + + + + + + + + +
S.NoMaterialSupplierQuantityPriceAction
+
+ + +
+
Consumables
+ +
+
+ Add Consumable Materials + + + + + + +
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + +
S.NoMaterialSupplierQuantityPriceAction
+
+ + +
+
Packing Material
+ +
+
+ Add Packing Materials + + + + + + + +
+
+
+
+ +
+ + + + + + + + + + + + + + + + +
S.NoMaterialSupplierQuantityPriceAction
+
+ + + + + + + + + + + +
+
Co-Products
+ +
+
+ Add Co-Products + + + + + + + +
+
+
+
+ + + +
+ + + + + + + + + + + + + + + + + + +
S.NoMaterialDateQuantityPriceAction
+
+ + + + + + + + + + + + + + + + +
+   Save +
+ +
+ +
+
+
+ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/application/views/FinalProductHistory.php b/application/views/FinalProductHistory.php new file mode 100644 index 00000000..b5f2dd02 --- /dev/null +++ b/application/views/FinalProductHistory.php @@ -0,0 +1,262 @@ + + + + + + + + + +
+
+
+ +
+
+ +

+
+ +
+ + +
+ +
+ +
+ + 'form-label-left final_product ','name' => 'final_product','id' => 'final_product'); + + echo form_open($this->config->base_url().'/batchcard/Final+Product/',$attributes); + ?> + +
+
+ + + + 'Select Material'); + + if(!empty($inv_final_product)) + { + foreach ($inv_final_product as $SID): + + + $options2[$SID->product_id] = $SID->product_id.' '.' - '.' '.$SID->product_name; + + endforeach; + } + + echo form_dropdown('DEPTFN', $options2,set_value('DEPTFN',$SupId),'id="DEPTFN"' ,'required="true"' ,'class="form-control select2'); + + ?> + + +
+ +
+ +
+ 'fromDate','value' => set_value('fromDate',$CurrentDate),'id'=>'fromDate', 'class' => 'form-control' ,'required' => 'true', 'onkeypress'=>'return false;'); + echo form_input($data); + ?> +
+ +
+ + +
+ +
+ 'toDate','value' => set_value('toDate',$CurrentDate),'id'=>'toDate', 'class' => 'form-control' ,'required' => 'true', 'onkeypress'=>'return false;'); + echo form_input($data); + ?> +
+ +
+ + + +
+ +
+   Go +
+
+ + + + + + + +
+
+   +   +
+ +
+ +
+ + + + + +
+ +
+ + +
+
+ + + + + + + + + + + + + + + + + +
Invoice No/Final Product IDProduct CodeProduct NamePriceQuantityType
+ + + +
+
+
+
+ + \ No newline at end of file diff --git a/application/views/FinalProductlisting.php b/application/views/FinalProductlisting.php new file mode 100644 index 00000000..7b75e38c --- /dev/null +++ b/application/views/FinalProductlisting.php @@ -0,0 +1,93 @@ + + +
+ + + +
+
+
+
+
+ +

+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
IdProduct NameQuantityPriceDateAction
FPId ?>product_description."-".$record->product_name; ?> Quantity; ?>Price ?>ProductDate); + $CreatedDate= $Cdt->format('d-m-Y'); + echo $CreatedDate; ?>    
+
+ +
+ + +
+ +
+ +
+ +
+ + + + diff --git a/application/views/MaterialHistory.php b/application/views/MaterialHistory.php new file mode 100644 index 00000000..c4d926a8 --- /dev/null +++ b/application/views/MaterialHistory.php @@ -0,0 +1,308 @@ + + + + + +
+
+
+ +
+ +
+
+

Siddharth Industries - Material History

+ input->post('item_name')){ + $it=$this->input->post('item_name'); + echo $it; + echo ' '.' '; + } + + + if($this->input->post('from_date') && $this->input->post('to_date')){ + $frm = $this->input->post('from_date'); + $t = $this->input->post('to_date'); + echo $frm.'-to-'.$t; + } + + ?>

+
+ + +
+ +
+ +
+
+ +
+ +
+
+
+ +
+ + + + +
+
+ + +
+ +
+ + + + +
+ +
+

+ + +
+
+
+ + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Stock IDSupplier NameMaterial NameUpdatedONTransaction TypeRef TypeRef NOQuantityItem Value
StockId;?>SupplierName;?>MaterialName;?>updatedOn;?>Transaction_type;?>Ref_Type;?>Ref_No;?>Quantity;?>ItemValue;?>
+
+ +
+ +
+
+
+ + + + + + + + + + + \ No newline at end of file diff --git a/application/views/Report_consolidate.php b/application/views/Report_consolidate.php index 1313a57e..6797a2bf 100755 --- a/application/views/Report_consolidate.php +++ b/application/views/Report_consolidate.php @@ -186,80 +186,80 @@ table.dataTable thead > tr > td.sorting { $mar = 0; $tot = 0; $ab=$this->input->post('financialyear'); - foreach ($spurchse as $result) { ?> - - - supplier_name;?> - - material_name)) { echo $result->material_name ; } else {echo "-";} - ?> - April); - ?> - April);?> - - May); - ?> - May);?> - - June); - ?> - June);?> - - July); - ?> - July);?> - - August); - ?> - August);?> - - September); - ?> - September);?> - - October); - ?> - October);?> - - November); - ?> - November);?> - - December); - ?> - December);?> - - January); - ?> - January);?> - - February); - ?> - February);?> - - March); - ?> - March);?> - - qtotal); - ?> - qtotal);?> - - + foreach ($spurchse as $index=>$result) { ?> + + + supplier_name;?> + + material_name)) { echo $result->material_name ; } else {echo "-";} + ?> + April); + ?> + April);?> + + May); + ?> + May);?> + + June); + ?> + June);?> + + July); + ?> + July);?> + + August); + ?> + August);?> + + September); + ?> + September);?> + + October); + ?> + October);?> + + November); + ?> + November);?> + + December); + ?> + December);?> + + January); + ?> + January);?> + + February); + ?> + February);?> + + March); + ?> + March);?> + + qtotal); + ?> + qtotal);?> + + tr > td.sorting { $feb = 0; $mar = 0; $tot = 0; - foreach ($spurchse as $result) { ?> - - - supplier_name;?> - - material_name)) { echo $result->material_name ; } else {echo "-";} - ?> - vApril,2,'.',''); - ?> - vApril,2,'.','');?> - - vMay,2,'.',''); - ?> - vMay,2,'.','');?> - - vJune,2,'.',''); - ?> - vJune,2,'.','');?> - - vJuly,2,'.',''); - ?> - vJuly,2,'.','');?> - - vAugust,2,'.',''); - ?> - vAugust,2,'.','');?> - - vSeptember,2,'.',''); - ?> - vSeptember,2,'.','');?> - - vOctober,2,'.',''); - ?> - vOctober,2,'.','');?> - - vNovember,2,'.',''); - ?> - vNovember,2,'.','');?> - - vDecember,2,'.',''); - ?> - vDecember,2,'.','');?> - - vJanuary,2,'.',''); - ?> - vJanuary,2,'.','');?> - - vFebruary,2,'.',''); - ?> - vFebruary,2,'.','');?> - - vMarch,2,'.',''); - ?> - vMarch,2,'.','');?> - - vtotal,2,'.',''); - ?> - vtotal,2,'.','');?> - - + foreach ($spurchse as $index=>$result) { ?> + + + supplier_name;?> + + material_name)) { echo $result->material_name ; } else {echo "-";} + ?> + vApril,2,'.',''); + ?> + vApril,2,'.','');?> + + vMay,2,'.',''); + ?> + vMay,2,'.','');?> + + vJune,2,'.',''); + ?> + vJune,2,'.','');?> + + vJuly,2,'.',''); + ?> + vJuly,2,'.','');?> + + vAugust,2,'.',''); + ?> + vAugust,2,'.','');?> + + vSeptember,2,'.',''); + ?> + vSeptember,2,'.','');?> + + vOctober,2,'.',''); + ?> + vOctober,2,'.','');?> + + vNovember,2,'.',''); + ?> + vNovember,2,'.','');?> + + vDecember,2,'.',''); + ?> + vDecember,2,'.','');?> + + vJanuary,2,'.',''); + ?> + vJanuary,2,'.','');?> + + vFebruary,2,'.',''); + ?> + vFebruary,2,'.','');?> + + vMarch,2,'.',''); + ?> + vMarch,2,'.','');?> + + vtotal,2,'.',''); + ?> + vtotal,2,'.','');?> + + tr > td.sorting { // Bootstrap datepicker // Set up your table $(document).ready(function() { - var april_value_sum =0; - var april_quantity_sum= 0; - - var may_value_sum =0; - var may_quantity_sum= 0; - - var june_value_sum =0; - var june_quantity_sum= 0; - - var july_value_sum =0; - var july_quantity_sum= 0; - - var august_value_sum =0; - var august_quantity_sum= 0; - - var september_value_sum =0; - var september_quantity_sum= 0; - - var october_value_sum =0; - var october_quantity_sum= 0; - - var november_value_sum =0; - var november_quantity_sum= 0; - - var december_value_sum =0; - var december_quantity_sum= 0; - - var january_value_sum =0; - var january_quantity_sum= 0; - - var february_value_sum =0; - var february_quantity_sum= 0; - - var march_value_sum =0; - var march_quantity_sum= 0; - - var finalTotal_value_sum =0; - var finalTotal_quantity_sum= 0; - table = $('#tab').DataTable( { "language": { "emptyTable":"
Data Not Found !
" @@ -757,142 +718,98 @@ $(document).ready(function() { }, 'colvis' - ], + ], + + "footerCallback": function ( row, data, start, end, display ) - { - - for(var j = 0;j<=display.length-1;j++) - { - - var count = display[j]; - - var april_value_value = $('#aprval'+count).text(); - - var may_value_value = $('#mayin'+count).text(); - - var june_value_value = $('#junin'+count).text(); - - var july_value_value = $('#jlyin'+count).text(); - - var august_value_value = $('#augin'+count).text(); - - var september_value_value = $('#sepin'+count).text(); - - var october_value_value = $('#octin'+count).text(); - - var november_value_value = $('#novin'+count).text(); - - var december_value_value = $('#decin'+count).text(); - - var january_value_value = $('#janin'+count).text(); - - var february_value_value = $('#febin'+count).text(); - - var march_value_value = $('#marin'+count).text(); - - var finalTotal_value_value = $('#totalvalue'+count).text(); + { + + var april_sum=0; + var may_sum=0; + var june_sum = 0; + var july_sum = 0; + var aug_sum = 0; + var sep_sum=0; + var oct_sum =0; + var nov_sum =0; + var dec_sum=0; + var jan_sum=0; + var feb_sum=0; + var mar_sum=0; + var total_sum=0; + + for(var j = 0;j<=display.length-1;j++) + { + var count = display[j]; + var april= $('#april_qty'+count).text(); + var may = $('#may_qty'+count).text(); + var june = $('#june_qty'+count).text(); + var july = $('#july_qty'+count).text(); + var aug = $('#aug_qty'+count).text(); + var sep = $('#sep_qty'+count).text(); + var oct = $('#oct_qty'+count).text(); + var nov = $('#nov_qty'+count).text(); + var dec = $('#dec_qty'+count).text(); + var jan = $('#jan_qty'+count).text(); + var feb = $('#feb_qty'+count).text(); + var mar = $('#mar_qty'+count).text(); + var tot = $('#tot_qty'+count).text(); + + april_sum += +april; + may_sum += +may; + june_sum += +june; + july_sum += +july; + aug_sum += +aug; + sep_sum += +sep; + oct_sum += +oct; + nov_sum += +nov; + dec_sum += + dec; + jan_sum += +jan; + feb_sum += +feb; + mar_sum += +mar; + total_sum += +tot; + } - april_value_sum += +april_value_value; - - may_value_sum += +may_value_value; - - - june_value_sum += +june_value_value; - - - july_value_sum += +july_value_value; - - - august_value_sum += +august_value_value; - - - september_value_sum += +september_value_value; - - - october_value_sum += +october_value_value; - - - november_value_sum += +november_value_value; - - - december_value_sum += +december_value_value; - - - january_value_sum += +january_value_value; - - - february_value_sum += +february_value_value; - - - march_value_sum += +march_value_value; - - - finalTotal_value_sum += +finalTotal_value_value; - - - } - - var api = this.api(), data; - - $( api.column( 1 ).footer() ).html( "report/cashbookdepartment?d=&c=&finyear=>"+parseInt(april_value_sum).toFixed(2).bold()+'' ); - - $( api.column( 2 ).footer() ).html( "report/cashbookdepartment?d=&c=&finyear=>"+parseInt(april_quantity_sum).toFixed(2).bold()+'' ); - - $( api.column( 3 ).footer() ).html( "report/cashbookdepartment?d=&c=&finyear=>"+parseInt(may_value_sum).toFixed(2).bold()+'' ); - - $( api.column( 4 ).footer() ).html( "report/cashbookdepartment?d=&c=&finyear=>"+parseInt(may_quantity_sum).toFixed(2).bold()+'' ); - - $( api.column( 5 ).footer() ).html( "report/cashbookdepartment?d=&c=&finyear=>"+parseInt(june_value_sum).toFixed(2).bold()+'' ); - - $( api.column( 6 ).footer() ).html( "report/cashbookdepartment?d=&c=&finyear=>"+parseInt(june_quantity_sum).toFixed(2).bold()+'' ); - - $( api.column( 7 ).footer() ).html( "report/cashbookdepartment?d=&c=&finyear=>"+parseInt(july_value_sum).toFixed(2).bold()+'' ); - - $( api.column( 8 ).footer() ).html( "report/cashbookdepartment?d=&c=&finyear=>"+parseInt(july_quantity_sum).toFixed(2).bold()+'' ); - - $( api.column( 9 ).footer() ).html( "report/cashbookdepartment?d=&c=&finyear=>"+parseInt(august_value_sum).toFixed(2).bold()+'' ); - - $( api.column( 10 ).footer() ).html( "report/cashbookdepartment?d=&c=&finyear=>"+parseInt(august_quantity_sum).toFixed(2).bold()+'' ); - - $( api.column( 11 ).footer() ).html( "report/cashbookdepartment?d=&c=&finyear=>"+parseInt(september_value_sum).toFixed(2).bold()+'' ); - - $( api.column( 12 ).footer() ).html( "report/cashbookdepartment?d=&c=&finyear=>"+parseInt(september_quantity_sum).toFixed(2).bold()+'' ); - - $( api.column( 13 ).footer() ).html( "report/cashbookdepartment?d=&c=&finyear=>"+parseInt(october_value_sum).toFixed(2).bold()+'' ); - - $( api.column( 14 ).footer() ).html( "report/cashbookdepartment?d=&c=&finyear=>"+parseInt(october_quantity_sum).toFixed(2).bold()+'' ); - - $( api.column( 15 ).footer() ).html( "report/cashbookdepartment?d=&c=&finyear=>"+parseInt(november_value_sum).toFixed(2).bold()+'' ); - - $( api.column( 16 ).footer() ).html( "report/cashbookdepartment?d=&c=&finyear=>"+parseInt(november_quantity_sum).toFixed(2).bold()+'' ); - - $( api.column( 17 ).footer() ).html( "report/cashbookdepartment?d=&c=&finyear=>"+parseInt(december_value_sum).toFixed(2).bold()+'' ); - - $( api.column( 18 ).footer() ).html( "report/cashbookdepartment?d=&c=&finyear=>"+parseInt(december_quantity_sum).toFixed(2).bold()+'' ); - - $( api.column( 19 ).footer() ).html( "report/cashbookdepartment?d=&c=&finyear=>"+parseInt(january_value_sum).toFixed(2).bold()+'' ); - - $( api.column( 20 ).footer() ).html( "report/cashbookdepartment?d=&c=&finyear=>"+parseInt(january_quantity_sum).toFixed(2).bold()+'' ); - - $( api.column( 21 ).footer() ).html( "report/cashbookdepartment?d=&c=&finyear=>"+parseInt(february_value_sum).toFixed(2).bold()+'' ); - - $( api.column( 22 ).footer() ).html( "report/cashbookdepartment?d=&c=&finyear=>"+parseInt(february_quantity_sum).toFixed(2).bold()+'' ); - - $( api.column( 23 ).footer() ).html( "report/cashbookdepartment?d=&c=&finyear=>"+parseInt(march_value_sum).toFixed(2).bold()+'' ); - - $( api.column( 24 ).footer() ).html( "report/cashbookdepartment?d=&c=&finyear=>"+parseInt(march_quantity_sum).toFixed(2).bold()+'' ); - - $( api.column( 25 ).footer() ).html( "report/cashbookdepartment?c=&finyear=>"+parseInt(finalTotal_value_sum).toFixed(2).bold()+'' ); - - $( api.column( 26 ).footer() ).html( "report/cashbookdepartment?c=&finyear=>"+parseInt(finalTotal_quantity_sum).toFixed(2).bold()+'' ); + var api = this.api(), data; + var Final_april_total =parseInt(april_sum); + var Final_may_total = parseInt(may_sum); + var Final_june_total = parseInt(june_sum); + var Final_july_total = parseInt(july_sum); + var Final_aug_total = parseInt(aug_sum); + var Final_sep_total = parseInt(sep_sum); + var Final_oct_total = parseInt(oct_sum); + var Final_nov_total = parseInt(nov_sum); + var Final_dec_total = parseInt(dec_sum); + var Final_jan_total = parseInt(jan_sum); + var Final_feb_total = parseInt(feb_sum); + var Final_mar_total = parseInt(mar_sum); + var Final_tot = parseInt(total_sum); + $( api.column( 2 ).footer() ).html( Final_april_total.toFixed(2).bold() ); + $( api.column( 3 ).footer() ).html( Final_may_total.toFixed(2).bold() ); + $( api.column( 4 ).footer() ).html( Final_june_total.toFixed(2).bold() ); + $( api.column( 5 ).footer() ).html( Final_july_total.toFixed(2).bold() ); + $( api.column( 6 ).footer() ).html( Final_aug_total.toFixed(2).bold() ); + $( api.column( 7 ).footer() ).html( Final_sep_total.toFixed(2).bold() ); + $( api.column( 8 ).footer() ).html( Final_oct_total.toFixed(2).bold() ); + $( api.column( 9 ).footer() ).html( Final_nov_total.toFixed(2).bold() ); + $( api.column( 10 ).footer() ).html( Final_dec_total.toFixed(2).bold() ); + $( api.column( 11 ).footer() ).html( Final_jan_total.toFixed(2).bold() ); + $( api.column( 12 ).footer() ).html( Final_feb_total.toFixed(2).bold() ); + $( api.column( 13 ).footer() ).html( Final_mar_total.toFixed(2).bold() ); + $( api.column( 14 ).footer() ).html( Final_tot.toFixed(2).bold() ); } - } ); + } ); +} ); +$(document).ready(function() { table = $('#ta').DataTable( { + "language": { + "emptyTable":"
Data Not Found !
" + }, "dom": "<'row'<'col-md-6'l><'col-md-6'Bf>>" + "<'row'<'col-md-6'><'col-md-6'>>" + "<'row'<'col-md-12't>><'row'<'col-md-4'i><'col-md-8'p>>", @@ -910,152 +827,92 @@ $(document).ready(function() { }, 'colvis' - ], + ], + + "footerCallback": function ( row, data, start, end, display ) { + var aprilval_sum =0; + var mayval_sum =0; + var juneval_sum =0; + var julyval_sum =0; + var augval_sum =0; + var sepval_sum =0; + var octval_sum =0; + var novval_sum =0; + var decval_sum =0; + var janval_sum =0; + var febval_sum =0; + var marval_sum =0; + var totalval_sum =0; - - for(var j = 0;j<=display.length-1;j++) - { - - var count = display[j]; - - var april_value_value = $('#aprin'+count).text(); - var april_quantity_value= $('#aprex'+count).text(); - - var may_value_value = $('#mayin'+count).text(); - var may_quantity_value= $('#mayex'+count).text(); - - var june_value_value = $('#junin'+count).text(); - var june_quantity_value= $('#junex'+count).text(); - - var july_value_value = $('#jlyin'+count).text(); - var july_quantity_value= $('#jlyex'+count).text(); + for(var j = 0;j<=display.length-1;j++) + { + var count = display[j]; - var august_value_value = $('#augin'+count).text(); - var august_quantity_value= $('#augex'+count).text(); - - var september_value_value = $('#sepin'+count).text(); - var september_quantity_value= $('#sepex'+count).text(); - - var october_value_value = $('#octin'+count).text(); - var october_quantity_value= $('#octex'+count).text(); - - var november_value_value = $('#novin'+count).text(); - var november_quantity_value= $('#novex'+count).text(); - - var december_value_value = $('#decin'+count).text(); - var december_quantity_value= $('#decex'+count).text(); - - var january_value_value = $('#janin'+count).text(); - var january_quantity_value= $('#janex'+count).text(); - - var february_value_value = $('#febin'+count).text(); - var february_quantity_value= $('#febex'+count).text(); - - var march_value_value = $('#marin'+count).text(); - var march_quantity_value= $('#marex'+count).text(); - - var finalTotal_value_value = $('#totalvalue'+count).text(); - var finalTotal_quantity_value= $('#totalquantity'+count).text(); + var aprilv= $('#aprilval'+count).text(); + var mayv = $('#mayval'+count).text(); + var junev = $('#juneval'+count).text(); + var julyv = $('#julyval'+count).text(); + var augv = $('#augval'+count).text(); + var sepv = $('#sepval'+count).text(); + var octv = $('#octval'+count).text(); + var novv = $('#novval'+count).text(); + var decv = $('#decval'+count).text(); + var janv = $('#janval'+count).text(); + var febv = $('#febval'+count).text(); + var marv = $('#marval'+count).text(); + var totv = $('#totalval'+count).text(); - april_value_sum += +april_value_value; - april_quantity_sum += +april_quantity_value; - - may_value_sum += +may_value_value; - may_quantity_sum += +may_quantity_value; - - june_value_sum += +june_value_value; - june_quantity_sum += +june_quantity_value; - - july_value_sum += +july_value_value; - july_quantity_sum += +july_quantity_value; - - august_value_sum += +august_value_value; - august_quantity_sum += +august_quantity_value; - - september_value_sum += +september_value_value; - september_quantity_sum += +september_quantity_value; - - october_value_sum += +october_value_value; - october_quantity_sum += +october_quantity_value; - - november_value_sum += +november_value_value; - november_quantity_sum += +november_quantity_value; - - december_value_sum += +december_value_value; - december_quantity_sum += +december_quantity_value; - - january_value_sum += +january_value_value; - january_quantity_sum += +january_quantity_value; - - february_value_sum += +february_value_value; - february_quantity_sum += +february_quantity_value; - - march_value_sum += +march_value_value; - march_quantity_sum += +march_quantity_value; - - finalTotal_value_sum += +finalTotal_value_value; - finalTotal_quantity_sum += +finalTotal_quantity_value; - - } - - var api = this.api(), data; - - $( api.column( 1 ).footer() ).html( "report/cashbookdepartment?d=&c=&finyear=>"+parseInt(april_value_sum).toFixed(2).bold()+'' ); - - $( api.column( 2 ).footer() ).html( "report/cashbookdepartment?d=&c=&finyear=>"+parseInt(april_quantity_sum).toFixed(2).bold()+'' ); - - $( api.column( 3 ).footer() ).html( "report/cashbookdepartment?d=&c=&finyear=>"+parseInt(may_value_sum).toFixed(2).bold()+'' ); - - $( api.column( 4 ).footer() ).html( "report/cashbookdepartment?d=&c=&finyear=>"+parseInt(may_quantity_sum).toFixed(2).bold()+'' ); - - $( api.column( 5 ).footer() ).html( "report/cashbookdepartment?d=&c=&finyear=>"+parseInt(june_value_sum).toFixed(2).bold()+'' ); - - $( api.column( 6 ).footer() ).html( "report/cashbookdepartment?d=&c=&finyear=>"+parseInt(june_quantity_sum).toFixed(2).bold()+'' ); - - $( api.column( 7 ).footer() ).html( "report/cashbookdepartment?d=&c=&finyear=>"+parseInt(july_value_sum).toFixed(2).bold()+'' ); - - $( api.column( 8 ).footer() ).html( "report/cashbookdepartment?d=&c=&finyear=>"+parseInt(july_quantity_sum).toFixed(2).bold()+'' ); - - $( api.column( 9 ).footer() ).html( "report/cashbookdepartment?d=&c=&finyear=>"+parseInt(august_value_sum).toFixed(2).bold()+'' ); - - $( api.column( 10 ).footer() ).html( "report/cashbookdepartment?d=&c=&finyear=>"+parseInt(august_quantity_sum).toFixed(2).bold()+'' ); - - $( api.column( 11 ).footer() ).html( "report/cashbookdepartment?d=&c=&finyear=>"+parseInt(september_value_sum).toFixed(2).bold()+'' ); - - $( api.column( 12 ).footer() ).html( "report/cashbookdepartment?d=&c=&finyear=>"+parseInt(september_quantity_sum).toFixed(2).bold()+'' ); - - $( api.column( 13 ).footer() ).html( "report/cashbookdepartment?d=&c=&finyear=>"+parseInt(october_value_sum).toFixed(2).bold()+'' ); - - $( api.column( 14 ).footer() ).html( "report/cashbookdepartment?d=&c=&finyear=>"+parseInt(october_quantity_sum).toFixed(2).bold()+'' ); - - $( api.column( 15 ).footer() ).html( "report/cashbookdepartment?d=&c=&finyear=>"+parseInt(november_value_sum).toFixed(2).bold()+'' ); - - $( api.column( 16 ).footer() ).html( "report/cashbookdepartment?d=&c=&finyear=>"+parseInt(november_quantity_sum).toFixed(2).bold()+'' ); - - $( api.column( 17 ).footer() ).html( "report/cashbookdepartment?d=&c=&finyear=>"+parseInt(december_value_sum).toFixed(2).bold()+'' ); - - $( api.column( 18 ).footer() ).html( "report/cashbookdepartment?d=&c=&finyear=>"+parseInt(december_quantity_sum).toFixed(2).bold()+'' ); - - $( api.column( 19 ).footer() ).html( "report/cashbookdepartment?d=&c=&finyear=>"+parseInt(january_value_sum).toFixed(2).bold()+'' ); - - $( api.column( 20 ).footer() ).html( "report/cashbookdepartment?d=&c=&finyear=>"+parseInt(january_quantity_sum).toFixed(2).bold()+'' ); - - $( api.column( 21 ).footer() ).html( "report/cashbookdepartment?d=&c=&finyear=>"+parseInt(february_value_sum).toFixed(2).bold()+'' ); - - $( api.column( 22 ).footer() ).html( "report/cashbookdepartment?d=&c=&finyear=>"+parseInt(february_quantity_sum).toFixed(2).bold()+'' ); - - $( api.column( 23 ).footer() ).html( "report/cashbookdepartment?d=&c=&finyear=>"+parseInt(march_value_sum).toFixed(2).bold()+'' ); - - $( api.column( 24 ).footer() ).html( "report/cashbookdepartment?d=&c=&finyear=>"+parseInt(march_quantity_sum).toFixed(2).bold()+'' ); - - $( api.column( 25 ).footer() ).html( "report/cashbookdepartment?c=&finyear=>"+parseInt(finalTotal_value_sum).toFixed(2).bold()+'' ); - - $( api.column( 26 ).footer() ).html( "report/cashbookdepartment?c=&finyear=>"+parseInt(finalTotal_quantity_sum).toFixed(2).bold()+'' ); + aprilval_sum += +aprilv; + mayval_sum += +mayv; + juneval_sum += +junev; + julyval_sum += +julyv; + augval_sum += +augv; + sepval_sum += +sepv; + octval_sum += +octv; + novval_sum += +novv; + decval_sum += + decv; + janval_sum += +janv; + febval_sum += +febv; + marval_sum += +marv; + totalval_sum += +totv; - } + } + + + var api = this.api(), data; + var Final_april_total =parseInt(aprilval_sum); + var Final_may_total = parseInt(mayval_sum); + var Final_june_total = parseInt(juneval_sum); + var Final_july_total = parseInt(julyval_sum); + var Final_aug_total = parseInt(augval_sum); + var Final_sep_total = parseInt(sepval_sum); + var Final_oct_total = parseInt(octval_sum); + var Final_nov_total = parseInt(novval_sum); + var Final_dec_total = parseInt(decval_sum); + var Final_jan_total = parseInt(janval_sum); + var Final_feb_total = parseInt(febval_sum); + var Final_mar_total = parseInt(marval_sum); + var Final_tot = parseInt(totalval_sum); + + $( api.column( 2 ).footer() ).html( Final_april_total.toFixed(2).bold() ); + $( api.column( 3 ).footer() ).html( Final_may_total.toFixed(2).bold() ); + $( api.column( 4 ).footer() ).html( Final_june_total.toFixed(2).bold() ); + $( api.column( 5 ).footer() ).html( Final_july_total.toFixed(2).bold() ); + $( api.column( 6 ).footer() ).html( Final_aug_total.toFixed(2).bold() ); + $( api.column( 7 ).footer() ).html( Final_sep_total.toFixed(2).bold() ); + $( api.column( 8 ).footer() ).html( Final_oct_total.toFixed(2).bold() ); + $( api.column( 9 ).footer() ).html( Final_nov_total.toFixed(2).bold() ); + $( api.column( 10 ).footer() ).html( Final_dec_total.toFixed(2).bold() ); + $( api.column( 11 ).footer() ).html( Final_jan_total.toFixed(2).bold() ); + $( api.column( 12 ).footer() ).html( Final_feb_total.toFixed(2).bold() ); + $( api.column( 13 ).footer() ).html( Final_mar_total.toFixed(2).bold() ); + $( api.column( 14 ).footer() ).html( Final_tot.toFixed(2).bold() ); + + } + } ); } ); @@ -1075,7 +932,4 @@ function toggleTables(which) } } - - - - \ No newline at end of file + \ No newline at end of file diff --git a/application/views/Report_consolidate_inward.php b/application/views/Report_consolidate_inward.php index aa4a3599..39320ac9 100755 --- a/application/views/Report_consolidate_inward.php +++ b/application/views/Report_consolidate_inward.php @@ -127,428 +127,793 @@ $(document).ready(function () { $("#client_name").select2(); }); -
- - - - - - - - - - - - - - - - - - - - - - - - - input->post('financialyear'); - foreach ($spurchse as $result) { ?> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Supplier NameMaterial NameAprMayJunJulAugSepOctNovDecJanFebMarTotal
- supplier_name;?> - material_name)) { echo $result->material_name ; } else {echo "-";} - ?>April); - ?> - April);?> - May); - ?> - May);?> - June); - ?> - June);?> - July); - ?> - July);?> - August); - ?> - August);?> - September); - ?> - September);?> - October); - ?> - October);?> - November); - ?> - November);?> - December); - ?> - December);?> - January); - ?> - January);?> - February); - ?> - February);?> - March); - ?> - March);?> - qtotal); - ?> - qtotal);?> -
Total
- -
- - - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + + + + + \ No newline at end of file diff --git a/application/views/Report_consolidate_raw.php b/application/views/Report_consolidate_raw.php index 4971c535..f1f80153 100755 --- a/application/views/Report_consolidate_raw.php +++ b/application/views/Report_consolidate_raw.php @@ -142,626 +142,802 @@ table.dataTable thead > tr > td.sorting { -
- - - - - - - - - - - - - - - - - - - - - - - - input->post('financialyear'); - foreach ($spurchse as $result) { ?> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CategoryAprMayJunJulAugSepOctNovDecJanFebMarTotal
- category;?> - - April); - ?> - April);?> - - May); - ?> - May);?> - - June); - ?> - June);?> - - July); - ?> - July);?> - - August); - ?> - August);?> - - September; - ?> - September);?> - - October); - ?> - October);?> - - November); - ?> - November);?> - - December); - ?> - December);?> - - January); - ?> - January);?> - - February); - ?> - February);?> - - March); - ?> - March);?> - - qtotal); - ?> - qtotal);?> -
Total - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- - - - - - - - - - - - - - - - - - - + + + + + + + - - - \ No newline at end of file + aprilval_sum += +aprilv; + mayval_sum += +mayv; + juneval_sum += +junev; + julyval_sum += +julyv; + augval_sum += +augv; + sepval_sum += +sepv; + octval_sum += +octv; + novval_sum += +novv; + decval_sum += + decv; + janval_sum += +janv; + febval_sum += +febv; + marval_sum += +marv; + totalval_sum += +totv; + + + } + + + var api = this.api(), data; + var Final_april_total =parseInt(aprilval_sum); + var Final_may_total = parseInt(mayval_sum); + var Final_june_total = parseInt(juneval_sum); + var Final_july_total = parseInt(julyval_sum); + var Final_aug_total = parseInt(augval_sum); + var Final_sep_total = parseInt(sepval_sum); + var Final_oct_total = parseInt(octval_sum); + var Final_nov_total = parseInt(novval_sum); + var Final_dec_total = parseInt(decval_sum); + var Final_jan_total = parseInt(janval_sum); + var Final_feb_total = parseInt(febval_sum); + var Final_mar_total = parseInt(marval_sum); + var Final_tot = parseInt(totalval_sum); + + $( api.column( 1 ).footer() ).html( Final_april_total.toFixed(2).bold() ); + $( api.column( 2 ).footer() ).html( Final_may_total.toFixed(2).bold() ); + $( api.column( 3 ).footer() ).html( Final_june_total.toFixed(2).bold() ); + $( api.column( 4 ).footer() ).html( Final_july_total.toFixed(2).bold() ); + $( api.column( 5 ).footer() ).html( Final_aug_total.toFixed(2).bold() ); + $( api.column( 6 ).footer() ).html( Final_sep_total.toFixed(2).bold() ); + $( api.column( 7 ).footer() ).html( Final_oct_total.toFixed(2).bold() ); + $( api.column( 8 ).footer() ).html( Final_nov_total.toFixed(2).bold() ); + $( api.column( 9 ).footer() ).html( Final_dec_total.toFixed(2).bold() ); + $( api.column( 10 ).footer() ).html( Final_jan_total.toFixed(2).bold() ); + $( api.column( 11 ).footer() ).html( Final_feb_total.toFixed(2).bold() ); + $( api.column( 12 ).footer() ).html( Final_mar_total.toFixed(2).bold() ); + $( api.column( 13 ).footer() ).html( Final_tot.toFixed(2).bold() ); + + } + + + + } ); + } ); + + + function toggleTables(which) + { + + if(which == "1") { + document.getElementById('a').style.display = "block"; + document.getElementById('b').style.display = "none"; + + } + if(which == "2") { + document.getElementById('b').style.display = "block"; + document.getElementById('a').style.display = "none"; + + } + } + + + + + \ No newline at end of file diff --git a/application/views/Report_costcenter.php b/application/views/Report_costcenter.php index c4290bc1..88a4e79c 100755 --- a/application/views/Report_costcenter.php +++ b/application/views/Report_costcenter.php @@ -1,13 +1,3 @@ - - - - + + + + + +
+
+
+ +
+
+ +

+
+ +
+ + +
+ +
+ +
+ + 'form-label-left final_product ','name' => 'final_product','id' => 'final_product'); + + echo form_open($this->config->base_url().'/batchcard/FinalProduct/',$attributes); + ?> + +
+
+ + + + product_id) + { + $options1[$material->product_id] = $material->product_id.' '.' - '.' '.$material->product_name; + } + } + + + // foreach ($inv_final_product as $materiall) + // { + // if($finProduct != $material->product_id) + // { + + // $options1[$materiall->product_id] = $materiall->product_id.' '.' - '.' '.$materiall->product_name; + + // } + // } + + + } + + echo form_dropdown('DEPTFN', $options1,set_value('DEPTFN',$product_id),'id="DEPTFN"' ,'required="true"' ,'class="form-control select2'); + + ?> + +
+ +
+ + 'Date','value' => set_value('Date',$date),'id'=>'Date', 'class' => 'form-control' ,'required' => 'true', 'onkeypress'=>'return false;'); + echo form_input($data); + ?> +
+
+ + +
+ 'Quantity','value' => set_value('Quantity',$qty),'id'=>'Quantity', 'class' => 'form-control' ,'required' => 'true'); + echo form_input($data); + ?> +
+ +
+ +
+ + +
+ 'values','value' => set_value('values',$value),'id'=>'values', 'class' => 'form-control' ,'required' => 'true'); + echo form_input($data); + ?> +
+ +
+ + + + + + + +
+
+
+ + +
+
Raw Materials
+ +
+
+ + + Raw Materials + + + + + + + +
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
S.NoMaterial CodeSupplierQuantityPriceAction
MaterialCode."-".$raw->MaterialName?>SupplierID."-".$raw->SupplierName?>Quantity;?>Price?>    
+
+ + +
+
Consumables
+ +
+
+ Add Consumable Materials + + + + + + +
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
S.NoMaterial CodeSupplierQuantityPriceAction
MaterialCode."-".$cou->MaterialName?>SupplierID."-".$cou->SupplierName?>Quantity?>Price?> + +     +
+
+ + +
+
Packing Material
+ +
+
+ Add Packing Materials + + + + + + + +
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
S.NoMaterial CodeSupplierQuantityPriceAction
MaterialCode."-".$pac->MaterialName?>SupplierID."-".$pac->SupplierName?>Quantity?>Price?> + +     +
+
+ + + + + + + + + + + +
+
Co-Products
+ +
+
+ Add Co-Products + + + + + + + +
+
+
+
+ + + +
+ + + + + + + + + + + + + + format('d-m-Y'); + + + ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
S.NoProduct IdDateQuantityPriceAction
format('d-m-Y'); + echo $CreatedDate; ?>    
+
+ + + + + + + + + + + + + + + + + + +
+   Save +
+ +
+ +
+
+
+ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/application/views/editmaterialadjustment.php b/application/views/editmaterialadjustment.php new file mode 100644 index 00000000..f830a19a --- /dev/null +++ b/application/views/editmaterialadjustment.php @@ -0,0 +1,474 @@ +AdjustmentId; + $supplier = $mat->SupplierID; + $suppliername=$mat->SupplierName; + $materialcode = $mat->MaterialCode; + $date = $mat->CreatedOn; + $editquantity= $mat->Quantity; + $edit_Actual_Qty= $mat->ActualQuantity; + + // $edit_Adjustable_qty= ''; + $edit_Description= $mat->Description; + $edit_reason= $mat->Reason; + $type = $mat->Transaction_type; + } +} + +$as_per_system = ''; +$value_to_display= ''; +if($type == "Add") +{ + // $as_per_system = $editquantity - $edit_Actual_Qty; + + $as_per_system = $edit_Actual_Qty-$editquantity; + $value_to_display = $editquantity; +} + +else if($type == "Reduce") +{ + // $as_per_system = $editquantity + $edit_Actual_Qty; + + $as_per_system=$edit_Actual_Qty+$editquantity; + $value_to_display = "-".$editquantity; +} + + +//$latestupdate=parseFloat($Addqty)-parseFloat($reduceqty); +//print_r($latestupdate); +?> + + + + + + + +
+ +
+ +

+
+ +
+
+
+
+ 'form-label-left materialadjustment','name' => 'materialadjustment','id' => 'materialadjustment'); + + echo form_open($this->config->base_url().'batchcard/addmaterialadjustment',$attributes); + + + + ?> + +
+
+
+ + MaterialCode) + { + $options1[$material->MaterialCode] = $material->MaterialCode.' '.' - '.' '.$material->MaterialName; + } + } + + + foreach ($materiallist as $materiall) + { + if($materialcode != $material->MaterialCode) + { + + $options1[$materiall->MaterialCode] = $materiall->MaterialCode.' '.' - '.' '.$materiall->MaterialName; + + } + } + + + } + + echo form_dropdown('MaterialCode', $options1,set_value('MaterialCode',$materialcode),'id="MaterialCode"','class="form-control select2"' , 'required="true"'); + ?> +
+ + +
+ +
+ + 'date','value' => set_value('date',$date),'id'=>'date', 'class' => 'form-control' ,'required' => 'true', 'onkeypress'=>'return false;'); + echo form_input($data); + ?> +
+
+ + +
+ +
+ 'Supplier','value' => set_value('Supplier',$suppliername),'id'=>'Supplier', 'class' => 'form-control num','readonly'=>'true' ); + echo form_input($data); + + ?> +
+ +
+
+ + + + + + +
+ + + + + + + +
+ +
+
+ + +
+
+
+ AddQty; + + $reduceqty=$netQuantityarray[0]['ReduceQty']; + } + + $latestupdate=$Addqty-$reduceqty; + $data = array('name' => 'Qty_aspersystem','value' => set_value('Qty_aspersystem', $as_per_system),'id'=>'Qty_aspersystem', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);'); + echo form_input($data); + + ?> +
+
+
+ + + + +
+
+ + +
+
+
+ 'ActualQty','value' => set_value('ActualQty',$edit_Actual_Qty),'id'=>'ActualQty', 'class' => 'form-control num' ,'onchange'=>'calculateamount()'); + echo form_input($data); + + ?> +
+
+
+ + + +
+
+ + +
+
+
+ 'AdjustableQty','value' => set_value('AdjustableQty',$value_to_display),'id'=>'AdjustableQty', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);','onchange'=>'', 'readonly'=>'true'); + echo form_input($data); + + ?> +
+
+
+ + + + + + +
+
+ + +
+
+
+ 'Select',"1"=>'Stock on fire',"2"=>'Stolen goods',"3"=>'Damaged Goods',"4"=>'Stock written off',"5"=>'Stock taking results',"6"=>'Inventory revaluation'); + + // if(!empty($PONO)) + // { + // foreach ($PONO as $PO): + // $options[$PO->PONO] =$PO->PONO.' '.' - '.' '.$PO->POType; + + + // //$RL[$SID->ReqNo] = $SID->ReqNo.' '.' - '.' '.$SID->DepartmentName; + // endforeach; + // } + + + + + echo form_dropdown('reason', $options,set_value('reason'),'id="reason"' ,'class="form-control select2"' , 'required="true"' ); + ?> +
+
+ + + +
+ + +
+
+ + +
+
+
+ 'Description','value' => set_value('Description',$edit_Description),'id'=>'Description', 'class' => 'form-control' ,'rows' => '5', 'cols' => '100','maxlength' => '250'); + echo Form_textarea($data); + ?> +
+
+
+ + + + + + +
+
+ + + OK +
+ + + + + + + + + + + + + + +
+
+ + + diff --git a/application/views/includes/header.php b/application/views/includes/header.php index fbdd9a4e..e388e234 100644 --- a/application/views/includes/header.php +++ b/application/views/includes/header.php @@ -435,9 +435,9 @@ - - -
  • + + +
  • Stock Details @@ -447,48 +447,38 @@
  • - Store Details + Stock Details