From fc31d93c1b79ea2ed16ba26ebb36d82b3c0218b6 Mon Sep 17 00:00:00 2001 From: "venbatechnologies@gmail.com" Date: Mon, 18 Dec 2017 11:22:59 +0530 Subject: [PATCH] report code merged in ria model description given --- application/config/routes.php | 2 +- application/controllers/assetdetails.php | 4 +- application/controllers/cashbook.php | 2 +- application/controllers/configurationctrl.php | 13 +- application/controllers/purchaseorder.php | 1846 +++++++++-------- application/controllers/user.php | 8 +- application/models/assetdetails_model.php | 67 +- application/models/cashbook_model.php | 40 +- application/models/companydetailsmodel.php | 45 +- application/models/configmodel.php | 160 +- application/models/costcenter_model.php | 240 ++- application/models/dahsboard_model.php | 291 +-- application/models/department_model.php | 116 +- application/models/employeedetails_model.php | 143 +- application/models/emppaydate_model.php | 55 +- .../models/inwardgateregister_model.php | 129 +- application/models/login_model.php | 2 +- application/models/monthlypay_model.php | 86 +- application/models/supplier_model.php | 6 +- .../views/Report_Material_Master_ItemWise.php | 35 +- .../Report_Material_Master_ReceiptValue.php | 37 +- .../Report_Material_Master_SupplierWise.php | 43 +- application/views/Report_POreleased.php | 40 +- application/views/Report_consolidate.php | 79 +- .../views/Report_consolidate_inward.php | 97 +- .../views/Report_consolidate_month.php | 46 +- application/views/Report_consolidate_raw.php | 95 +- application/views/Report_consolidate_year.php | 47 +- application/views/Report_costcenter.php | 69 +- application/views/Report_cumulative.php | 78 +- application/views/Report_cumulative_day.php | 46 +- .../views/Report_cumulative_day_inward.php | 48 +- .../views/Report_cumulative_day_raw.php | 47 +- .../views/Report_cumulative_inward.php | 71 +- application/views/Report_cumulative_month.php | 52 +- .../views/Report_cumulative_month_inward.php | 56 +- .../views/Report_cumulative_month_raw.php | 70 +- application/views/Report_cumulative_raw.php | 70 +- application/views/Report_cumulative_year.php | 68 +- .../views/Report_cumulative_year_inward.php | 72 +- .../views/Report_cumulative_year_raw.php | 69 +- application/views/Report_month_wise.php | 54 +- .../views/Report_month_wise_inward.php | 59 +- application/views/Report_openorder.php | 52 +- application/views/Report_purchase.php | 98 +- application/views/Report_purchase_inward.php | 115 +- application/views/Report_supplier.php | 101 +- application/views/Report_supplier_inward.php | 110 +- application/views/Report_totalorders.php | 64 +- application/views/Report_year_wise.php | 72 +- application/views/Report_year_wise_inward.php | 73 +- application/views/Report_year_wise_total.php | 52 +- .../views/Report_year_wise_total_inward.php | 59 +- application/views/addnewIncomeExpense.php | 4 +- application/views/dashboard.php | 85 +- application/views/report_pendingreqst.php | 54 +- application/views/reportcashbook.php | 23 +- 57 files changed, 3457 insertions(+), 2208 deletions(-) diff --git a/application/config/routes.php b/application/config/routes.php index 7fa12815..2bfe408e 100644 --- a/application/config/routes.php +++ b/application/config/routes.php @@ -208,7 +208,7 @@ $route['addIncomeExpense'] = "cashbook/addIncomeExpense"; // permission slip// $route['permission'] = 'monthlypay/permissionslip'; -$route['permissionlist'] = 'monthlypay/addper'; +$route['permissionlist'] = 'monthlypay/permissionlist'; //<-------------Reports page-----------------> $route['reportpending'] = "report/pending_report"; diff --git a/application/controllers/assetdetails.php b/application/controllers/assetdetails.php index ac2ed29d..16f0db55 100644 --- a/application/controllers/assetdetails.php +++ b/application/controllers/assetdetails.php @@ -154,7 +154,7 @@ class assetdetails extends BaseController */ function Asset_validate($selectValue) { - //echo 'select_validate method called'; + //'none' is the first option and the text says something like "-Choose one-" if($selectValue == '-1') { @@ -536,4 +536,4 @@ class assetdetails extends BaseController } } -?>s \ No newline at end of file +?> \ No newline at end of file diff --git a/application/controllers/cashbook.php b/application/controllers/cashbook.php index 4fdac920..fc3f1c61 100755 --- a/application/controllers/cashbook.php +++ b/application/controllers/cashbook.php @@ -25,7 +25,7 @@ class cashbook extends BaseController } /** - * To list incomeexpense details + * To list income expense details */ function incomeExpenseList() { diff --git a/application/controllers/configurationctrl.php b/application/controllers/configurationctrl.php index 2db8f7ee..3d02ec4d 100644 --- a/application/controllers/configurationctrl.php +++ b/application/controllers/configurationctrl.php @@ -38,10 +38,14 @@ class configurationctrl extends BaseController function configlisting() { - $this->load->model('configmodel'); - $this->global['pageTitle'] = 'Resico : Config Listing'; - $this->loadViews("configlisting", $this->global, $data, NULL); + $this->load->model('configmodel'); + $data['userRecords'] = $this->configmodel->configlisting(); + + $this->global['pageTitle'] = 'Resico : Config Listing'; + + $this->loadViews("configlisting", $this->global, $data, NULL); + } /** @@ -49,7 +53,8 @@ class configurationctrl extends BaseController */ function addconfig() { - $this->global['pageTitle'] = 'Resico : Add New Config'; + $this->global['pageTitle'] = 'Resico : Add New Config'; + $data['userRecords'] = $this->configmodel->configlisting(); $this->loadViews("addconfig", $this->global,NULL, NULL); } diff --git a/application/controllers/purchaseorder.php b/application/controllers/purchaseorder.php index 2818d785..f7c668be 100644 --- a/application/controllers/purchaseorder.php +++ b/application/controllers/purchaseorder.php @@ -1,13 +1,12 @@ global['pageTitle'] = 'Resico : AddPO'; $this->loadViews("addPO", $this->global, NULL , NULL); } - - function viewfullpurchaseorder() - { - $this->global['pageTitle'] = 'Resico : View Purchase Order'; - $this->loadViews("viewfullpurchaseorder", $this->global,Null); - - } - - /** + + function viewfullpurchaseorder() + { + $this->global['pageTitle'] = 'Resico : View Purchase Order'; + $this->loadViews("viewfullpurchaseorder", $this->global,Null); + + } + + /** * To load Advance Request screen */ - function advancerequest() - { + function advancerequest() + { $this->global['pageTitle'] = 'Resico : Advance Request'; - $data['PONO']=$this->purchaseorder_model->getadvancePONO('ST026'); - $this->loadViews("advancerequest", $this->global, $data, NULL); - } + } - /** - * To Create PO from Requisition Listing - */ - function requisition() - { - $data['DeptList'] = $this->purchaseorder_model->getDepartmentListForAllReq(); - + /** + * To Create PO from Requisition Listing + */ + function requisition() + { + $data['DeptList'] = $this->purchaseorder_model->getDepartmentListForAllReq(); $data['stList'] = $this->purchaseorder_model->getStatusListforAllReq(); - /* Cost code from Requisition - Client Review Fix + + /* Cost code from Requisition - Client Review Fix Start here */ $data['ReqList'] = $this->purchaseorder_model->getAllRequistionListToCreatePO(); /* End Here */ $this->global['pageTitle'] = 'Resico : Create PO from Requisition List'; $this->loadViews("createPOfromRequistion", $this->global, $data,Null); - } + } - /** + /** * To List the all PurchaseOrder */ function PurchaseOrderList() @@ -105,11 +102,11 @@ class purchaseorder extends BaseController } } - /** + /** * To show the Purchase Order Screen */ - function CreatePurchaseOrder() - { + function CreatePurchaseOrder() + { $this->form_validation->set_rules('txtReqNo', 'txtReqNo', 'callback_Req_validate'); @@ -121,108 +118,124 @@ class purchaseorder extends BaseController else { - $this->global['pageTitle'] = 'Resico : Purchase order' ; - - $data['TaxType'] = $this->purchaseorder_model->getConfigValue('C006'); - $data['FreightType'] = $this->purchaseorder_model->getConfigValue('C018'); - $data['Suplist'] = $this->purchaseorder_model->getSupplierName(); - $data['Payment']=$this->purchaseorder_model->getPaymentTermsDetails(); - $data['WorkStatus']=$this->purchaseorder_model->getStatus(7); - - $SelectedReq = json_decode($this->input->post('txtReqNo')); + $this->global['pageTitle'] = 'Resico : Purchase order' ; + $data['TaxType'] = $this->purchaseorder_model->getConfigValue('C006'); + $data['FreightType'] = $this->purchaseorder_model->getConfigValue('C018'); + $data['Suplist'] = $this->purchaseorder_model->getSupplierName(); + $data['Payment']=$this->purchaseorder_model->getPaymentTermsDetails(); + $data['WorkStatus']=$this->purchaseorder_model->getStatus(7); + + $SelectedReq = json_decode($this->input->post('txtReqNo')); - $Req = $SelectedReq->Req; - $data['ReqList'] = $Req ; - $ReqArray = array(); - $ReqType = $this->input->post('txtReqType'); - $result = array(); - - foreach ($Req as $SID): - $ReqArray[] = $SID->ReqNo ; - $result[] = $this->purchaseorder_model->getRawPOMaterialList($SID->ReqNo); - if($ReqType == '') - { - $ReqType = $SID->ReqType; - } - endforeach; + $Req = $SelectedReq->Req; + $data['ReqList'] = $Req ; + $ReqArray = array(); + $ReqType = $this->input->post('txtReqType'); + $result = array(); + + foreach ($Req as $SID): + $ReqArray[] = $SID->ReqNo ; + $result[] = $this->purchaseorder_model->getRawPOMaterialList($SID->ReqNo); + if($ReqType == '') + { + $ReqType = $SID->ReqType; + } + + endforeach; $data['MaterialList'] = $result; - + /* Cost code from Requisition - Client Review Fix Start here */ - $ReqDetails = $this->purchaseorder_model->getRequistDetails($ReqArray); - - $data['RequistionDetails'] = $ReqDetails; - $CostCode = ''; - - $this->load->model('costcenter_model'); - - $FYStart = ''; - $FYEnd = ''; - $FiscalYear = $this->costcenter_model->getFiscalYear(); - if(!empty($FiscalYear)) - { - foreach ($FiscalYear as $Fy) - { - $FYStart =$Fy->StartYear; - $FYEnd =$Fy->EndYear; - } - } - $FYdt = $FYStart." - ".$FYEnd ; + + $ReqDetails = $this->purchaseorder_model->getRequistDetails($ReqArray); + + $data['RequistionDetails'] = $ReqDetails; + $CostCode = ''; + + $this->load->model('costcenter_model'); + $FYStart = ''; + $FYEnd = ''; + $FiscalYear = $this->costcenter_model->getFiscalYear(); + if(!empty($FiscalYear)) + { + foreach ($FiscalYear as $Fy) + { + $FYStart =$Fy->StartYear; + $FYEnd =$Fy->EndYear; + + } + + } + + $FYdt = $FYStart." - ".$FYEnd ; - foreach ($ReqDetails as $Rs): - $CostCode = $Rs->CostCenterCode; - endforeach; - - $AvlBudget = $this->purchaseorder_model->GetAvailableBudgetAmount($CostCode,$FYdt,$ReqType); - - - if(count($AvlBudget)>0) - { - $data['AvlBudAmt'] = $AvlBudget[0]['BudgetAmount'] - $AvlBudget[0]['Totalvalue']; - } + foreach ($ReqDetails as $Rs): + $CostCode = $Rs->CostCenterCode; + endforeach; + + $AvlBudget = $this->purchaseorder_model->GetAvailableBudgetAmount($CostCode,$FYdt,$ReqType); + + + if(count($AvlBudget)>0) + { + $data['AvlBudAmt'] = $AvlBudget[0]['BudgetAmount'] - $AvlBudget[0]['Totalvalue']; + } /* End Here */ $data['CompanyDetails'] = $this->purchaseorder_model->getCompanyInformation(); + $data['MaxPODate'] = $this->purchaseorder_model->getLastReleasedPODate(); $data['Currency']=$this->purchaseorder_model->GetCurrencytype(); $data['INRSYMBOL']=$this->purchaseorder_model->GetINRCurrencytype('INR'); + $AvlimportBudget = $this->purchaseorder_model->GetAvailableImportBudgetAmount($CostCode,$FYdt,$ReqType); + - if(count($AvlimportBudget)>0) - { - $data['AvlimportBudAmt'] = $AvlimportBudget[0]['BudgetAmount'] - $AvlimportBudget[0]['Totalvalue']; - } - $data['PoTypeOptions'] = $this->purchaseorder_model->getConfigValue('C026'); + + if(count($AvlimportBudget)>0) + { + $data['AvlimportBudAmt'] = $AvlimportBudget[0]['BudgetAmount'] - $AvlimportBudget[0]['Totalvalue']; + } + + + $data['PoTypeOptions'] = $this->purchaseorder_model->getConfigValue('C026'); + $ViewName = ''; - - if($ReqType == REVENUE) - { + if($ReqType == REVENUE) + { $ViewName = 'purchaseorder'; - } - else if($ReqType == SERVICE) - { + } + else if($ReqType == SERVICE) + { + + $ViewName = 'servicePurchaseorder'; - } - else if($ReqType == IMPORT) - { - $data['staticspecialinstruction']=$this->purchaseorder_model->getConfigValue('C027'); - $ViewName = 'importpo'; - } - else if($ReqType == CAPITAL) - { - $data['staticspecialinstruction']=$this->purchaseorder_model->getConfigValue('C027'); - $CapitalAvlBudget = $this->purchaseorder_model->GetAvailableCapitalBudgetAmount($CostCode,$FYdt,$ReqType); + } + else if($ReqType == IMPORT) + { + + $data['staticspecialinstruction']=$this->purchaseorder_model->getConfigValue('C027'); + + $ViewName = 'importpo'; + } + else if($ReqType == CAPITAL) + { + $data['staticspecialinstruction']=$this->purchaseorder_model->getConfigValue('C027'); + $CapitalAvlBudget = $this->purchaseorder_model->GetAvailableCapitalBudgetAmount($CostCode,$FYdt,$ReqType); - if(count($CapitalAvlBudget)>0) - { - $data['AvlCapitalBudAmt'] = $CapitalAvlBudget[0]['BudgetAmount'] - $CapitalAvlBudget[0]['Totalvalue']; - } - $ViewName = 'capitalpurchaseorder'; - } - $this->loadViews($ViewName, $this->global,$data, NULL); + + if(count($CapitalAvlBudget)>0) + { + + + $data['AvlCapitalBudAmt'] = $CapitalAvlBudget[0]['BudgetAmount'] - $CapitalAvlBudget[0]['Totalvalue']; + } + $ViewName = 'capitalpurchaseorder'; + } + $this->loadViews($ViewName, $this->global,$data, NULL); } } @@ -231,22 +244,30 @@ class purchaseorder extends BaseController */ function CreatePOPrint() { - $PONO = $_GET['PONO']; - $ReqType = $_GET['ReqType']; + $PONO = $_GET['PONO']; + $ReqType = $_GET['ReqType']; + if($ReqType == SERVICE) { $this ->servicepoprint($PONO); + } - else if($ReqType == REVENUE) + + + + else if($ReqType == REVENUE) { $this ->revenuepoprint($PONO); + } + else if($ReqType == IMPORT) { $this ->importpoprint($PONO); + } - else if($ReqType == CAPITAL) + else if($ReqType == CAPITAL) { $this ->CapitalPoPrint($PONO); @@ -255,27 +276,30 @@ class purchaseorder extends BaseController - /** - * To load revenue po pdf screen - */ + /** + * To load revenue po pdf screen + */ function CreaterevenuePOPrint() { $this->load->View("revenuepopdf", NULL); } - /** - * To load service po pdf screen - */ + + /** + * To load service po pdf screen + */ function CreateservicePOPrint() { $this->load->View("servicepopdf", NULL); } + /** - * To load import po pdf screen - */ + * To load import po pdf screen + */ function CreateimportPOPrint() { $this->load->View("importpopdf", NULL); } + /** * To load capital po pdf screen */ @@ -284,11 +308,12 @@ class purchaseorder extends BaseController $this->load->View("capitalpopdf", NULL); } - /** + + /** * To View/Update Purchase Order */ function EditPurchaseOrder() - { + { $PONO = $_GET['PONO']; $ReqType = $_GET['ReqType']; @@ -298,65 +323,65 @@ class purchaseorder extends BaseController $result = array(); $ReqArray = array(); - foreach ($Req as $SID): $ReqArray[] = $SID->ReqNo ; $result[] = $this->purchaseorder_model->getRawPOMaterialList($SID->ReqNo); - endforeach; + endforeach; $data['MaterialList'] = $result; $data['Suplist'] = $this->purchaseorder_model->getSupplierName(); - $data['Payment']=$this->purchaseorder_model->getPaymentTermsDetails(); - $data['PoTypeOptions'] = $this->purchaseorder_model->getConfigValue('C026'); + $data['Payment']=$this->purchaseorder_model->getPaymentTermsDetails(); + $data['PoTypeOptions'] = $this->purchaseorder_model->getConfigValue('C026'); $data['INRSYMBOL']=$this->purchaseorder_model->GetINRCurrencytype('INR'); /* Cost code from Requisition - Client Review Fix Start here */ - $ReqDetails = $this->purchaseorder_model->getRequistDetails($ReqArray); + $ReqDetails = $this->purchaseorder_model->getRequistDetails($ReqArray); - $data['RequistionDetails'] = $ReqDetails; - - foreach ($data['RequistionDetails'] as $ReqDet) - { - - $Status=$ReqDet->Status; - } + $data['RequistionDetails'] = $ReqDetails; + + foreach ($data['RequistionDetails'] as $ReqDet) + { - $data['POSTATUS']=$this->purchaseorder_model->GetPOStatus($Status); - - foreach ($data['POSTATUS'] as $POST) - { - $Status=$POST->StatusName; - } + $Status=$ReqDet->Status; + } - $CostCode = ''; - $this->load->model('costcenter_model'); - $FYStart = ''; - $FYEnd = ''; - $FiscalYear = $this->costcenter_model->getFiscalYear(); - if(!empty($FiscalYear)) - { - foreach ($FiscalYear as $Fy) - { - $FYStart =$Fy->StartYear; - $FYEnd =$Fy->EndYear; - } - - } - - $FYdt = $FYStart." - ".$FYEnd ; - foreach ($ReqDetails as $Rs): - $CostCode = $Rs->CostCenterCode; - endforeach; - $AvlBudget = $this->purchaseorder_model->GetAvailableBudgetAmount($CostCode,$FYdt,$ReqType); - if(count($AvlBudget)>0) - { - $data['AvlBudAmt'] = $AvlBudget[0]['BudgetAmount'] - $AvlBudget[0]['Totalvalue']; - } + $data['POSTATUS']=$this->purchaseorder_model->GetPOStatus($Status); + + foreach ($data['POSTATUS'] as $POST) + { + $Status=$POST->StatusName; + } + + $CostCode = ''; + $this->load->model('costcenter_model'); + $FYStart = ''; + $FYEnd = ''; + $FiscalYear = $this->costcenter_model->getFiscalYear(); + if(!empty($FiscalYear)) + { + foreach ($FiscalYear as $Fy) + { + $FYStart =$Fy->StartYear; + $FYEnd =$Fy->EndYear; + } + + } + + $FYdt = $FYStart." - ".$FYEnd ; + foreach ($ReqDetails as $Rs): + $CostCode = $Rs->CostCenterCode; + endforeach; + $AvlBudget = $this->purchaseorder_model->GetAvailableBudgetAmount($CostCode,$FYdt,$ReqType); + if(count($AvlBudget)>0) + { + $data['AvlBudAmt'] = $AvlBudget[0]['BudgetAmount'] - $AvlBudget[0]['Totalvalue']; + } /* End Here */ $data['POMaster'] = $this->purchaseorder_model->GetServicePurchaseOrder($PONO); + foreach ($data['POMaster'] as $Exc) { $exRate=$Exc->ExchangeRate; @@ -370,112 +395,127 @@ class purchaseorder extends BaseController $data['MaxPODate'] = $this->purchaseorder_model->getLastReleasedPODate(); $data['TaxType'] = $this->purchaseorder_model->getConfigValue('C006'); $data['FreightType'] = $this->purchaseorder_model->getConfigValue('C018'); - if($ReqType == SERVICE) - { + if($ReqType == SERVICE) + { - $data['POItem'] = $this->purchaseorder_model->GetServicePurchaseOrderDetails($PONO); - $data['PaymentTerms']=$this->purchaseorder_model->GetPaymentTerms($PONO); - $data['WorkStatus']=$this->purchaseorder_model->getStatus(7); - $this->global['pageTitle'] = 'Resico : Edit Service Purchase order form'; - $this->loadViews("EditservicePurchaseorder", $this->global, $data, NULL); - } + $data['POItem'] = $this->purchaseorder_model->GetServicePurchaseOrderDetails($PONO); + + $data['PaymentTerms']=$this->purchaseorder_model->GetPaymentTerms($PONO); + + + $data['WorkStatus']=$this->purchaseorder_model->getStatus(7); + $this->global['pageTitle'] = 'Resico : Edit Service Purchase order form'; + $this->loadViews("EditservicePurchaseorder", $this->global, $data, NULL); + } else if($ReqType == REVENUE) { - $data['POItem'] = $this->purchaseorder_model->GetRevenuePurchaseOrderDetails($PONO); - $data['PaymentTerms']=$this->purchaseorder_model->GetPaymentTerms($PONO); - $data['WorkStatus']=$this->purchaseorder_model->getStatus(7); - $this->global['pageTitle'] = 'Resico : Edit Revenue Purchase order form'; - $this->loadViews("editRevenuepurchaseorder", $this->global, $data, NULL); + $data['POItem'] = $this->purchaseorder_model->GetRevenuePurchaseOrderDetails($PONO); + $data['PaymentTerms']=$this->purchaseorder_model->GetPaymentTerms($PONO); + $data['WorkStatus']=$this->purchaseorder_model->getStatus(7); + $this->global['pageTitle'] = 'Resico : Edit Revenue Purchase order form'; + $this->loadViews("editRevenuepurchaseorder", $this->global, $data, NULL); } else if($ReqType == IMPORT) { $AvlBudget = $this->purchaseorder_model->GetAvailableImportBudgetAmount($CostCode,$FYdt,$ReqType); - if(count($AvlBudget)>0) - { - $data['AvlBudAmt'] = $AvlBudget[0]['BudgetAmount'] - $AvlBudget[0]['Totalvalue']; - } - - $data['POItem'] = $this->purchaseorder_model->GetImportPurchaseOrderDetails($PONO); - $data['Currency']=$this->purchaseorder_model->GetCurrencytype(); - foreach($data['POMaster'] as $CUR) - { - $Currency=$CUR->CurrencyType; - } - - $data['CurrencyDetail']=$this->purchaseorder_model->GetCurrencyDetail($Currency); - $data['PaymentTerms']=$this->purchaseorder_model->GetPaymentTerms($PONO); + + + if(count($AvlBudget)>0) + { + $data['AvlBudAmt'] = $AvlBudget[0]['BudgetAmount'] - $AvlBudget[0]['Totalvalue']; + } + + $data['POItem'] = $this->purchaseorder_model->GetImportPurchaseOrderDetails($PONO); + + $data['Currency']=$this->purchaseorder_model->GetCurrencytype(); + foreach($data['POMaster'] as $CUR) + { + + $Currency=$CUR->CurrencyType; + } + + $data['CurrencyDetail']=$this->purchaseorder_model->GetCurrencyDetail($Currency); + $data['PaymentTerms']=$this->purchaseorder_model->GetPaymentTerms($PONO); - $unicode =''; - foreach ($data['CurrencyDetail'] as $Detail) - { - $unicode=$Detail->FontCode2000; - } - foreach ($data['CurrencyDetail'] as $Detail) - { - $currencycode=$Detail->Currency_Code; - } - - $data['unicode']=$unicode; - $data['currencycode']=$currencycode; - $this->global['pageTitle'] = 'Resico : Edit Import Purchase order form'; - $this->loadViews("editimportpo", $this->global, $data, NULL); - } - else if($ReqType == CAPITAL) - { + + $unicode =''; + foreach ($data['CurrencyDetail'] as $Detail) + { + $unicode=$Detail->FontCode2000; + } + foreach ($data['CurrencyDetail'] as $Detail) + { + $currencycode=$Detail->Currency_Code; + } + + $data['unicode']=$unicode; + $data['currencycode']=$currencycode; + $this->global['pageTitle'] = 'Resico : Edit Import Purchase order form'; + $this->loadViews("editimportpo", $this->global, $data, NULL); + } + else if($ReqType == CAPITAL) + { $CapitalRange = $_GET['CapitalRange']; - $CapitalAvlBudget = $this->purchaseorder_model->GetAvailableCapitalBudgetAmount($CostCode,$FYdt,$ReqType); + $CapitalAvlBudget = $this->purchaseorder_model->GetAvailableCapitalBudgetAmount($CostCode,$FYdt,$ReqType); - if(count($CapitalAvlBudget)>0) - { + if(count($CapitalAvlBudget)>0) + { - $data['AvlCapitalBudAmt'] = $CapitalAvlBudget[0]['BudgetAmount'] - $CapitalAvlBudget[0]['Totalvalue']; - } + + $data['AvlCapitalBudAmt'] = $CapitalAvlBudget[0]['BudgetAmount'] - $CapitalAvlBudget[0]['Totalvalue']; + } - if($CapitalRange=='0'){ + if($CapitalRange=='0'){ $data['POItem'] = $this->purchaseorder_model->getCapitalPurchaseOrderDetails($PONO); } - else if($CapitalRange=='1'){ + else if($CapitalRange=='1'){ $data['POItem'] = $this->purchaseorder_model->getDomesticCapitalPurchaseOrderDetails($PONO); } - $data['requestedBy'] = $this->purchaseorder_model->GetRequesedByDetails($PONO); + $data['requestedBy'] = $this->purchaseorder_model->GetRequesedByDetails($PONO); - foreach($data['POItem'] as $Rate) - { + + + foreach($data['POItem'] as $Rate) + { $exRate=$Rate->ExchangeRate; $CapitalRange=$Rate->CapitalRange; - } - - foreach($data['POItem'] as $CUR) - { + } + foreach($data['POItem'] as $CUR) + { + $Currency=$CUR->CurrencyType; - } + } - if($CapitalRange=='0'){ - $data['CurrencyDetail']=$this->purchaseorder_model->GetCurrencyDetail($Currency); + if($CapitalRange=='0'){ + $data['CurrencyDetail']=$this->purchaseorder_model->GetCurrencyDetail($Currency); $data['ExchangeRate']=$exRate; $data['Currency']=$this->purchaseorder_model->GetCurrencytype(); - } - else if($CapitalRange=='1'){ - $data['CurrencyDetail']=$this->purchaseorder_model->GetCurrencyDetail('INR'); + } + else if($CapitalRange=='1'){ + $data['CurrencyDetail']=$this->purchaseorder_model->GetCurrencyDetail('INR'); $data['ExchangeRate']=$exRate; $data['Currency']=$this->purchaseorder_model->GetCurrencytype(); - } + } $this->global['pageTitle'] = 'Resico : Edit Capital Purchase order form'; - $this->loadViews("editCapitalPo", $this->global, $data, NULL); - } + $this->loadViews("editCapitalPo", $this->global, $data, NULL); + } } - // + + /** + * To get the Material value based on the MaterialCode + * */ function PurchaseOrderFinanceView() { $PONO = $_GET['PONO']; $POType = $_GET['POType']; + $ReqType= $_GET['ReqType']; $Req = $this->purchaseorder_model->getRequistionNoFromPO($PONO); @@ -492,56 +532,55 @@ class purchaseorder extends BaseController $data['MaterialList'] = $result; $data['Suplist'] = $this->purchaseorder_model->getSupplierName(); - $data['Payment']=$this->purchaseorder_model->getPaymentTermsDetails(); + $data['Payment']=$this->purchaseorder_model->getPaymentTermsDetails(); $data['INRSYMBOL']=$this->purchaseorder_model->GetINRCurrencytype('INR'); /* Cost code from Requisition - Client Review Fix Start here */ - $data['PoTypeOptions'] = $this->purchaseorder_model->getConfigValue('C026'); - $ReqDetails = $this->purchaseorder_model->getRequistDetails($ReqArray); + $data['PoTypeOptions'] = $this->purchaseorder_model->getConfigValue('C026'); + $ReqDetails = $this->purchaseorder_model->getRequistDetails($ReqArray); - $data['RequistionDetails'] = $ReqDetails; - foreach ($data['RequistionDetails'] as $ReqDet) - { - - $Status=$ReqDet->Status; - } - - $data['POSTATUS']=$this->purchaseorder_model->GetPOStatus($Status); - - foreach ($data['POSTATUS'] as $POST) - { - $Status=$POST->StatusName; - } - - $CostCode = ''; - $this->load->model('costcenter_model'); - $FYStart = ''; - $FYEnd = ''; - $FiscalYear = $this->costcenter_model->getFiscalYear(); - if(!empty($FiscalYear)) - { - foreach ($FiscalYear as $Fy) - { - $FYStart =$Fy->StartYear; - $FYEnd =$Fy->EndYear; - } + $data['RequistionDetails'] = $ReqDetails; + foreach ($data['RequistionDetails'] as $ReqDet) + { + + $Status=$ReqDet->Status; + } + + $data['POSTATUS']=$this->purchaseorder_model->GetPOStatus($Status); + + foreach ($data['POSTATUS'] as $POST) + { + $Status=$POST->StatusName; + } + + $CostCode = ''; + $this->load->model('costcenter_model'); + $FYStart = ''; + $FYEnd = ''; + $FiscalYear = $this->costcenter_model->getFiscalYear(); + if(!empty($FiscalYear)) + { + foreach ($FiscalYear as $Fy) + { + $FYStart =$Fy->StartYear; + $FYEnd =$Fy->EndYear; + } - } + } - $FYdt = $FYStart." - ".$FYEnd ; - - foreach ($ReqDetails as $Rs): - $CostCode = $Rs->CostCenterCode; - endforeach; - $AvlBudget = $this->purchaseorder_model->GetAvailableBudgetAmount($CostCode,$FYdt,$ReqType); - if(count($AvlBudget)>0) - { - $data['AvlBudAmt'] = $AvlBudget[0]['BudgetAmount'] - $AvlBudget[0]['Totalvalue']; - } + $FYdt = $FYStart." - ".$FYEnd ; + foreach ($ReqDetails as $Rs): + $CostCode = $Rs->CostCenterCode; + endforeach; + $AvlBudget = $this->purchaseorder_model->GetAvailableBudgetAmount($CostCode,$FYdt,$ReqType); + if(count($AvlBudget)>0) + { + $data['AvlBudAmt'] = $AvlBudget[0]['BudgetAmount'] - $AvlBudget[0]['Totalvalue']; + } /* End Here */ $data['POMaster'] = $this->purchaseorder_model->GetServicePurchaseOrder($PONO); - + foreach ($data['POMaster'] as $Exc) { $exRate=$Exc->ExchangeRate; @@ -557,125 +596,152 @@ class purchaseorder extends BaseController $data['FreightType'] = $this->purchaseorder_model->getConfigValue('C018'); - if($POType == IMPORT) + if($POType == IMPORT) { $AvlBudget = $this->purchaseorder_model->GetAvailableImportBudgetAmount($CostCode,$FYdt,'IMPORT'); - if(count($AvlBudget)>0) - { - $data['AvlBudAmt'] = $AvlBudget[0]['BudgetAmount'] - $AvlBudget[0]['Totalvalue']; - } - - $data['POItem'] = $this->purchaseorder_model->GetImportPurchaseOrderDetails($PONO); + + + - $data['Currency']=$this->purchaseorder_model->GetCurrencytype(); - foreach($data['POMaster'] as $CUR) - { - $Currency=$CUR->CurrencyType; - } - - $data['CurrencyDetail']=$this->purchaseorder_model->GetCurrencyDetail($Currency); - $data['PaymentTerms']=$this->purchaseorder_model->GetPaymentTerms($PONO); - $data['PoTypeOptions'] = $this->purchaseorder_model->getConfigValue('C026'); - - $unicode =''; - foreach ($data['CurrencyDetail'] as $Detail) - { - $unicode=$Detail->FontCode2000; - } - foreach ($data['CurrencyDetail'] as $Detail) - { - $currencycode=$Detail->Currency_Code; - } - - $data['unicode']=$unicode; - $data['currencycode']=$currencycode; - $this->global['pageTitle'] = 'Resico : Edit Import Purchase order form'; - $this->loadViews("editimportpo", $this->global, $data, NULL); + + if(count($AvlBudget)>0) + { + $data['AvlBudAmt'] = $AvlBudget[0]['BudgetAmount'] - $AvlBudget[0]['Totalvalue']; } + + $data['POItem'] = $this->purchaseorder_model->GetImportPurchaseOrderDetails($PONO); + + $data['Currency']=$this->purchaseorder_model->GetCurrencytype(); + foreach($data['POMaster'] as $CUR) + { + + $Currency=$CUR->CurrencyType; + } + + $data['CurrencyDetail']=$this->purchaseorder_model->GetCurrencyDetail($Currency); + $data['PaymentTerms']=$this->purchaseorder_model->GetPaymentTerms($PONO); + $data['PoTypeOptions'] = $this->purchaseorder_model->getConfigValue('C026'); + + $unicode =''; + foreach ($data['CurrencyDetail'] as $Detail) + { + $unicode=$Detail->FontCode2000; + } + foreach ($data['CurrencyDetail'] as $Detail) + { + $currencycode=$Detail->Currency_Code; + } + + $data['unicode']=$unicode; + $data['currencycode']=$currencycode; + $this->global['pageTitle'] = 'Resico : Edit Import Purchase order form'; + $this->loadViews("editimportpo", $this->global, $data, NULL); + } + + + + + else if($POType == CAPITAL) { - $CapitalRange = $_GET['CapitalRange']; + $CapitalRange = $_GET['CapitalRange']; - $CapitalAvlBudget = $this->purchaseorder_model->GetAvailableCapitalBudgetAmount($CostCode,$FYdt,$ReqType); + $CapitalAvlBudget = $this->purchaseorder_model->GetAvailableCapitalBudgetAmount($CostCode,$FYdt,$ReqType); - if(count($CapitalAvlBudget)>0) - { - $data['AvlCapitalBudAmt'] = $CapitalAvlBudget[0]['BudgetAmount'] - $CapitalAvlBudget[0]['Totalvalue']; - } + + if(count($CapitalAvlBudget)>0) + { - if($CapitalRange=='0'){ + + $data['AvlCapitalBudAmt'] = $CapitalAvlBudget[0]['BudgetAmount'] - $CapitalAvlBudget[0]['Totalvalue']; + } + + if($CapitalRange=='0'){ $data['POItem'] = $this->purchaseorder_model->getCapitalPurchaseOrderDetails($PONO); - } + } else if($CapitalRange=='1'){ $data['POItem'] = $this->purchaseorder_model->getDomesticCapitalPurchaseOrderDetails($PONO); - } + } $data['requestedBy'] = $this->purchaseorder_model->GetRequesedByDetails($PONO); - foreach($data['POItem'] as $Rate) - { + + + foreach($data['POItem'] as $Rate) + { $exRate=$Rate->ExchangeRate; $CapitalRange=$Rate->CapitalRange; - } - foreach($data['POItem'] as $CUR) - { + } + foreach($data['POItem'] as $CUR) + { + $Currency=$CUR->CurrencyType; - } - - if($CapitalRange=='0'){ + } + + if($CapitalRange=='0'){ $data['CurrencyDetail']=$this->purchaseorder_model->GetCurrencyDetail($Currency); $data['ExchangeRate']=$exRate; $data['Currency']=$this->purchaseorder_model->GetCurrencytype(); - } - else if($CapitalRange=='1'){ - $data['CurrencyDetail']=$this->purchaseorder_model->GetCurrencyDetail('INR'); + } + else if($CapitalRange=='1'){ + $data['CurrencyDetail']=$this->purchaseorder_model->GetCurrencyDetail('INR'); $data['ExchangeRate']=$exRate; $data['Currency']=$this->purchaseorder_model->GetCurrencytype(); - } - $this->global['pageTitle'] = 'Resico : Edit Capital Purchase order form'; - $this->loadViews("editCapitalPo", $this->global, $data, NULL); - } + } + + + $this->global['pageTitle'] = 'Resico : Edit Capital Purchase order form'; + $this->loadViews("editCapitalPo", $this->global, $data, NULL); + } + + } // To get the Material value based on the MaterialCode function getDetailsforReq() - { - $SearchFilter= $this->input->post('id'); + { + + + $SearchFilter= $this->input->post('id'); - $DeptCode = $SearchFilter[0]; - $MatType = $SearchFilter[1]; - $ReqNo = $SearchFilter[2]; - - $CostList = $this->requistion_model->GetCostCenterByDept( $DeptCode); - - $HTML = ""; - $BudAmount = ""; - if(count($CostList) > 0) - { - for ($j = 0; $j < count($CostList); $j++) - { - $Code = $CostList[$j]['CostCenterCode']; - $Name = $CostList[$j]['CostCenterName']; - $HTML .=""; - } - } - $MaterialDetails = $this->purchaseorder_model->getRawMaterialListForPO($MatType,$ReqNo); + $DeptCode = $SearchFilter[0]; + $MatType = $SearchFilter[1]; + $ReqNo = $SearchFilter[2]; - $HTML1 = ""; + + $CostList = $this->requistion_model->GetCostCenterByDept( $DeptCode); + + $HTML = ""; + $BudAmount = ""; + if(count($CostList) > 0) + { + for ($j = 0; $j < count($CostList); $j++) + { + $Code = $CostList[$j]['CostCenterCode']; + $Name = $CostList[$j]['CostCenterName']; + $HTML .=""; + } + } + $MaterialDetails = $this->purchaseorder_model->getRawMaterialListForPO($MatType,$ReqNo); + + $HTML1 = ""; - if(count($MaterialDetails) > 0) - { + if(count($MaterialDetails) > 0) + { for ($j = 0; $j < count($MaterialDetails); $j++) - { - $Code = $MaterialDetails[$j]['MaterialCode']; - $Name = $MaterialDetails[$j]['MaterialName']; - $HTML1 .=""; - } - } + { + $Code = $MaterialDetails[$j]['MaterialCode']; + $Name = $MaterialDetails[$j]['MaterialName']; + $HTML1 .=""; + + } + + } + + die(json_encode(array('MatDetail' =>$HTML1,'Cost'=> $HTML))); - } - - - /** + } + + /** * To get the status based on the Department selection */ function getStatusByDepartment() @@ -694,40 +760,41 @@ class purchaseorder extends BaseController $HTML .=""; } } - + die(json_encode(array('depStaus' => $HTML))); } - - /** - * To get the available Budget Amount - */ + /** + * To get the available Budget Amount + */ function AvilBudgetAmount() { - $SearchFilter= $this->input->post('id'); + $SearchFilter= $this->input->post('id'); + $CostCode = $SearchFilter[0]; $ReqType = $SearchFilter[1]; print_r($SearchFilter); - $CostCode= $this->input->post('id'); - $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); - $Year = $dt->format('Y'); - + $CostCode= $this->input->post('id'); + $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); + + $Year = $dt->format('Y'); $this->load->model('purchaseorder_model'); - $result = $this->purchaseorder_model->GetAvailableBudgetAmount($CostCode,$Year,$ReqType); + $result = $this->purchaseorder_model->GetAvailableBudgetAmount($CostCode,$Year,$ReqType); - $AvilBudAmt = ''; + $AvilBudAmt = ''; if(count($result)>0) { $AvilBudAmt = $result[0]['BudgetAmount'] - $result[0]['Totalvalue']; } - print_r($AvilBudAmt); + + print_r($AvilBudAmt); } /** * To Convert the dateformat (date with time) and stored into DB */ - function getDateformat($Val) + function getDateformat($Val) { $date = new DateTime($Val,new DateTimeZone('Asia/Kolkata')); $retDate = $date->format('Y-m-d H:i:s'); @@ -735,129 +802,136 @@ class purchaseorder extends BaseController } /** - * Method to get the Requistion list based on the search filter + * To get the Requistion list based on the search filter **/ function SearchListofRequistion() - { - $SearchFilter= $this->input->post('id'); + { + $SearchFilter= $this->input->post('id'); - $DEPCode = $SearchFilter[0]; - $Status = $SearchFilter[1]; - $rng = $SearchFilter[2];; + $DEPCode = $SearchFilter[0]; + $Status = $SearchFilter[1]; + $rng = $SearchFilter[2];; - $FromDate =''; - $ToDate = ''; + $FromDate =''; + $ToDate = ''; - $Dt = explode("-",$rng); + $Dt = explode("-",$rng); - if(count( $Dt)>1) - { - $FDate = $Dt[0]; - $TDate = $Dt[1]; - $FromDate = $this->getDateformat($FDate); - $ToDate = $this->getDateformat($TDate); - } + if(count( $Dt)>1) + { + $FDate = $Dt[0]; + $TDate = $Dt[1]; + $FromDate = $this->getDateformat($FDate); + $ToDate = $this->getDateformat($TDate); + } - $result = $this->purchaseorder_model->getRequistionListbySearch($DEPCode,$Status,$FromDate,$ToDate); + $result = $this->purchaseorder_model->getRequistionListbySearch($DEPCode,$Status,$FromDate,$ToDate); - $HTML=""; - for ($i = 0; $i < count($result); $i++) - { - $SNo = $i + 1; - $ReqNo = $result[$i]['ReqNo']; - $ReqType = $result[$i]['ReqType']; - $Reqedby = $result[$i]['FirstName']; - $ReqDate = $result[$i]['ReqDate']; - $Status = $result[$i]['StatusName']; - $Department = $result[$i]['DepartmentName']; - $Designation = $result[$i]['Designation']; - - $HTML.=" - - ". $ReqNo." - - ".$ReqType." - - ".$Reqedby." - ".$ReqDate." - ".$Status." - ".$Department." - ".$Designation." - "; - } - die(json_encode(array('ReqList' =>$HTML))); + $HTML=""; + for ($i = 0; $i < count($result); $i++) + { + $SNo = $i + 1; + $ReqNo = $result[$i]['ReqNo']; + $ReqType = $result[$i]['ReqType']; + $Reqedby = $result[$i]['FirstName']; + $ReqDate = $result[$i]['ReqDate']; + $Status = $result[$i]['StatusName']; + $Department = $result[$i]['DepartmentName']; + $Designation = $result[$i]['Designation']; + + $HTML.=" + + ". $ReqNo." + + ".$ReqType." + + ".$Reqedby." + ".$ReqDate." + ".$Status." + ".$Department." + ".$Designation." + "; + } + die(json_encode(array('ReqList' =>$HTML))); } - /** + /** * To View the request details **/ function ListPORequistion() - { - $ReqNo= $this->input->post('id'); - $result = $this->requistion_model->getRequistItemList($ReqNo); - $ReqList = $this->requistion_model->getRequistDetails($ReqNo); - $DepNo = $ReqList[0]['DEPCode']; - $CostList = $this->requistion_model->GetCostCenterByDept($DepNo); - $HTML=""; - for ($i = 0; $i < count($result); $i++) - { - $SNo = $i + 1; - $MaterialCode = $result[$i]['MaterialCode']; - $MaterialName = $result[$i]['MaterialName']; - $UOM = $result[$i]['UOM']; - $Quantity = $result[$i]['Quantity']; - $HTML.=" - ".$SNo." - ". $MaterialCode." - - ".$MaterialName." - - ".$UOM." - ".$Quantity." - "; - - } + { + $ReqNo= $this->input->post('id'); + $result = $this->requistion_model->getRequistItemList($ReqNo); + $ReqList = $this->requistion_model->getRequistDetails($ReqNo); + $DepNo = $ReqList[0]['DEPCode']; + $CostList = $this->requistion_model->GetCostCenterByDept($DepNo); + $HTML=""; + for ($i = 0; $i < count($result); $i++) + { + $SNo = $i + 1; + $MaterialCode = $result[$i]['MaterialCode']; + $MaterialName = $result[$i]['MaterialName']; + $UOM = $result[$i]['UOM']; + $Quantity = $result[$i]['Quantity']; + $HTML.=" + ".$SNo." + ". $MaterialCode." + + ".$MaterialName." + + ".$UOM." + ".$Quantity." + "; - $CostCenter = ""; - if(count($CostList) > 0) - { - for ($j = 0; $j < count($CostList); $j++) - { - $Code = $CostList[$j]['CostCenterCode']; - $Name = $CostList[$j]['CostCenterName']; - $CostCenter .=""; - } - } + + + } + + $CostCenter = ""; + if(count($CostList) > 0) + { + for ($j = 0; $j < count($CostList); $j++) + { + $Code = $CostList[$j]['CostCenterCode']; + $Name = $CostList[$j]['CostCenterName']; + $CostCenter .=""; + } + } - die(json_encode(array('Items' =>$HTML,'Requist'=>$ReqList,'Cost'=>$CostCenter))); + die(json_encode(array('Items' =>$HTML,'Requist'=>$ReqList,'Cost'=>$CostCenter))); } - /** - * To Create Revenue Purchase Order - */ + + /** + * To store the new Revenue PO datas into DB + */ function addNewPurchaseOrder() { - + + + $POdt =$this->input->post('PODate'); $PODate = $this->getDateformat($POdt); - $SupplierID = $this->input->post('drpSupplier'); + $SupplierID = $this->input->post('drpSupplier'); $DeliveryAddr = $this->input->post('DeliveryAddr'); $dt = $this->input->post('Deliverydt'); $POType = $this->input->post('POType'); - $DeliveryOption = $this->input->post('DateRange'); - - if($DeliveryOption==1){ - $Deliverydt = ''; - $DeliverySchedule = $this->input->post('Scheduleby'); - } - else{ - $Deliverydt = $this->getDateformat($dt); - $DeliverySchedule = ''; - } - - $POType = $this->input->post('POType'); + $DeliveryOption = $this->input->post('DateRange'); + if($DeliveryOption==1){ + $Deliverydt = ''; + $DeliverySchedule = $this->input->post('Scheduleby'); + } + else{ + $Deliverydt = $this->getDateformat($dt); + $DeliverySchedule = ''; + } + + + $POType = $this->input->post('POType'); + + $Modeofshipment=$this->input->post('addmodeofshipment'); $supplierreference=$this->input->post('addsupplierreference'); $supplieroffno=$this->input->post('addsupplierofferno'); @@ -865,45 +939,54 @@ class purchaseorder extends BaseController $fincap=$this->input->post('addfincap'); $revenuetype=$this->input->post('PoTypeOptions'); $insurancestatus=$this->input->post('insurance'); - - if($insurancestatus == 1){ - $insuranceno=$this->input->post('insuranceno'); + if($insurancestatus == 1){ + $insuranceno=$this->input->post('insuranceno'); }else{ - $insuranceno=$this->input->post('insuranceno'); + $insuranceno=$this->input->post('insuranceno'); } $SpcialInstruction = $this->input->post('SpcialInstruction'); $TotalOrderValueSummary = $this->input->post('txtTotalOrderValueSummary'); - $POStatus = $this->input->post('txtStatus'); - $CreateBy = $this->session->userdata ( 'userId' ); + $POStatus = $this->input->post('txtStatus'); + + $CreateBy = $this->session->userdata ( 'userId' ); $RowCount = $this->input->post('txtRowCount'); $DeletedRow = $this->input->post('txtDeletedRow'); + $comma_separated = explode(':', $DeletedRow); + $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $createddt = $dt->format('Y-m-d H:i:s'); + $PaymentTerms=$this->input->post('PaymentTerms'); - $OtherPayment=$this->input->post('Otherpayment'); + $OtherPayment=$this->input->post('Otherpayment'); $Local_Interstate=$this->input->post('Range'); - - // PO Master - $POList = array('SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrderValueSummary,'PODate'=>$PODate,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'Status'=>$POStatus,'PORange'=>$Local_Interstate,'ServiceDescription'=>$SpcialInstruction,'CreatedBy'=>$CreateBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'CreatedDate'=>$createddt,'PaymentTerms'=>$PaymentTerms,'POType'=>$POType,'CapitalRange'=>$Local_Interstate,'PaymentOtherDescription'=>$OtherPayment,'Supplier_Reference'=>$supplierreference,'Mode_Of_Shipment'=>$Modeofshipment,'Supplier_Offer_No'=>$supplieroffno,'Other_Reference'=>$otherreference,'Fincap'=>$fincap,'InsuranceStatus'=>$insurancestatus,'POSubType'=>$revenuetype,'InsuranceNumber'=>$insuranceno); - $POMaster = $this->purchaseorder_model->addPOMaster($POList,$POType,$revenuetype); + // PO Master + $POList = array('SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrderValueSummary,'PODate'=>$PODate,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'Status'=>$POStatus,'PORange'=>$Local_Interstate,'ServiceDescription'=>$SpcialInstruction,'CreatedBy'=>$CreateBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'CreatedDate'=>$createddt,'PaymentTerms'=>$PaymentTerms,'POType'=>$POType,'CapitalRange'=>$Local_Interstate,'PaymentOtherDescription'=>$OtherPayment,'Supplier_Reference'=>$supplierreference,'Mode_Of_Shipment'=>$Modeofshipment,'Supplier_Offer_No'=>$supplieroffno,'Other_Reference'=>$otherreference,'Fincap'=>$fincap,'InsuranceStatus'=>$insurancestatus,'POSubType'=>$revenuetype,'InsuranceNumber'=>$insuranceno); + + + + - $PONO = ''; - if(count($POMaster)>0) - { + $POMaster = $this->purchaseorder_model->addPOMaster($POList,$POType,$revenuetype); + + $PONO = ''; + if(count($POMaster)>0) + { $PONO = $POMaster[0]['PONO']; - } + } - // PO Line Items - $LineItemStatus = REQITEM_NEW; + // PO Line Items + $LineItemStatus = REQITEM_NEW; - for ($i = 1; $i <= $RowCount; $i++) - { + for ($i = 1; $i <= $RowCount; $i++) + { + $MaterialCode = $this->input->post('materialCode'.$i); $Quantity = $this->input->post('quantity'.$i); $Reqnumber = $this->input->post('Reqnumber'.$i); $itemRate = $this->input->post('itemRate'.$i); $per=$this->input->post('per'.$i); + $DiscountType = $this->input->post('DisType'.$i); $DiscountValue = $this->input->post('DisVal'.$i); $AfterDiscount = $this->input->post('AfterDisVal'.$i); @@ -911,38 +994,40 @@ class purchaseorder extends BaseController $PackagingType = $this->input->post('PackType'.$i); $PackagingValue = $this->input->post('PackVal'.$i); $AfterPackagingValue = $this->input->post('AfterPackVal'.$i); + $FreightType = $this->input->post('FreightType'.$i); $FreightValue = $this->input->post('FreightVal'.$i); $AfterFreightValue = $this->input->post('AfterFreightVal'.$i); - $NOOfTrip = $this->input->post('NoOfTrip'.$i); + $NOOfTrip = $this->input->post('NoOfTrip'.$i); $InsuranceValue = $this->input->post('Insval'.$i); $TotalOrderValue = $this->input->post('TotalOrderValue'.$i); $revenuedescription = $this->input->post('Service_Description'.$i); $CostCenter = $this->input->post('costCode'.$i); - $Cgst = $this->input->post('RevenueCgst'.$i); - $Sgst = $this->input->post('RevenueSgst'.$i); - $Igst = $this->input->post('RevenueIgst'.$i); - $AfterCgst = $this->input->post('RevenueAfterCgst'.$i); - $AfterSgst = $this->input->post('RevenueAfterSgst'.$i); - $AfterIgst = $this->input->post('RevenueAfterIgst'.$i); + $Cgst = $this->input->post('RevenueCgst'.$i); + $Sgst = $this->input->post('RevenueSgst'.$i); + $Igst = $this->input->post('RevenueIgst'.$i); + $AfterCgst = $this->input->post('RevenueAfterCgst'.$i); + $AfterSgst = $this->input->post('RevenueAfterSgst'.$i); + $AfterIgst = $this->input->post('RevenueAfterIgst'.$i); $SkipInsert = "False"; - - if( count($comma_separated) > 0) + if( count($comma_separated) > 0) { for($j = 1; $j < count($comma_separated); $j++) { - $deletedRow = $comma_separated[$j] ; + $deletedRow = $comma_separated[$j] ; + if($deletedRow == $i ) { $SkipInsert = "True"; break; } + } } if($SkipInsert == "False") { $POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Per'=>$per,'ServiceMaterialDescription'=>$revenuedescription,'Status'=>$LineItemStatus,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'CostCenterCode'=>$CostCenter); - + $POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList); $LineItemNo = ''; @@ -950,12 +1035,13 @@ class purchaseorder extends BaseController { $LineItemNo = $POLineItem[0]['LineItemNo']; } + if(trim($POType) == REVENUE ) { - + $RevenueTaxList = array('LineItemNo'=>$LineItemNo, 'DiscountType'=>$DiscountType,'DiscountValue'=>$DiscountValue,'AfterDiscount'=>$AfterDiscount,'PackagingType'=>$PackagingType,'PackagingValue'=>$PackagingValue,'PackagingCalulatedOn'=>$PackagingOption,'AfterPackagingValue'=>$AfterPackagingValue,'FreightType'=>$FreightType, 'FreightValue'=>$FreightValue,'AfterFreightValue'=>$AfterFreightValue,'Insurance'=>$InsuranceValue,'TotalValue'=>$TotalOrderValue, 'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'CGST'=>$Cgst,'AfterCGST'=>$AfterCgst,'SGST'=>$Sgst,'AfterSGST'=>$AfterSgst,'IGST'=>$Igst,'AfterIGST'=>$AfterIgst,'NoOfTrip'=>$NOOfTrip); - + $RevenueList = $this->purchaseorder_model->addRevenueTax($RevenueTaxList); } @@ -966,28 +1052,30 @@ class purchaseorder extends BaseController } - /** - * To Edit the Revenue Purchase Order + * To stored new values after edited Revenue datas. */ function EditRevenuePurchaseOrder() { + $PONO =$this->input->post('txtPONO'); $POdt =$this->input->post('PODate'); $PODate = $this->getDateformat($POdt); - $SupplierID = $this->input->post('drpSupplier'); + $SupplierID = $this->input->post('drpSupplier'); $DeliveryAddr = $this->input->post('txtDeliveryAddress'); $dt = $this->input->post('Deliverydt'); + $DeliveryOption = $this->input->post('DateRange'); - - if($DeliveryOption==1){ - $Deliverydt = ''; - $DeliverySchedule = $this->input->post('Scheduleby'); - } - else{ - $Deliverydt = $this->getDateformat($dt); - $DeliverySchedule = ''; - } + if($DeliveryOption==1){ + $Deliverydt = ''; + $DeliverySchedule = $this->input->post('Scheduleby'); + } + else{ + $Deliverydt = $this->getDateformat($dt); + $DeliverySchedule = ''; + } + + $Modeofshipment=$this->input->post('editmodeofshipment'); $supplierreference=$this->input->post('editsupplierreference'); @@ -996,36 +1084,40 @@ class purchaseorder extends BaseController $fincap=$this->input->post('editfincap'); $revenuetype=$this->input->post('PoTypeOptions'); $insurancestatus=$this->input->post('insurancestatus'); - - if($insurancestatus == 1){ - $insuranceno=$this->input->post('insuranceno'); + if($insurancestatus == 1){ + $insuranceno=$this->input->post('insuranceno'); }else{ - $insuranceno=""; + $insuranceno=""; } $POType = $this->input->post('POType'); $PoRange = $this->input->post('txtPoRange'); + $SpcialInstruction = $this->input->post('SpcialInstruction'); $TotalOrderValueSummary = $this->input->post('txtTotalOrderValueSummary'); - $POStatus = $this->input->post('txtStatus'); - $updatedBy = $this->session->userdata ( 'userId' ); + $POStatus = $this->input->post('txtStatus'); + + $updatedBy = $this->session->userdata ( 'userId' ); $RowCount = $this->input->post('txtRowCount'); $DeletedRow = $this->input->post('txtDeletedRow'); + $comma_separated = explode(':', $DeletedRow); $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $updateddt = $dt->format('Y-m-d H:i:s'); + $PaymentTerms=$this->input->post('PaymentTerms'); - $OtherPayment=$this->input->post('Otherpayment'); + $OtherPayment=$this->input->post('Otherpayment'); $Local_Interstate=$this->input->post('Range'); - - // PO Master - + + // PO Master $POList = array('SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrderValueSummary,'PODate'=>$PODate,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'Status'=>$POStatus,'PORange'=>$Local_Interstate,'ServiceDescription'=>$SpcialInstruction,'UpdateBY'=>$updatedBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'UpdatedOn'=>$updateddt,'PaymentTerms'=>$PaymentTerms,'POType'=>$POType,'CapitalRange'=>$Local_Interstate,'PaymentOtherDescription'=>$OtherPayment,'Supplier_Reference'=>$supplierreference,'Mode_Of_Shipment'=>$Modeofshipment,'Supplier_Offer_No'=>$supplieroffno,'Other_Reference'=>$otherreference,'Fincap'=>$fincap,'InsuranceStatus'=>$insurancestatus,'POSubType'=>$revenuetype,'InsuranceNumber'=>$insuranceno); - $POMaster = $this->purchaseorder_model->updatePOMaster($PONO,$POList); + $POMaster = $this->purchaseorder_model->updatePOMaster($PONO,$POList); - $LineItemStatus = REQITEM_NEW; - for ($i = 1; $i <= $RowCount; $i++) - { + $LineItemStatus = REQITEM_NEW; + + + for ($i = 1; $i <= $RowCount; $i++) + { $MaterialCode = $this->input->post('materialCode'.$i); $Quantity = $this->input->post('quantity'.$i); @@ -1040,47 +1132,50 @@ class purchaseorder extends BaseController $PackagingValue = $this->input->post('PackVal'.$i); $AfterPackagingValue = $this->input->post('AfterPackVal'.$i); $Cgst = $this->input->post('RevenueCgst'.$i); - $Sgst = $this->input->post('RevenueSgst'.$i); - $Igst = $this->input->post('RevenueIgst'.$i); - $AfterCgst = $this->input->post('RevenueAfterCgst'.$i); - $AfterSgst = $this->input->post('RevenueAfterSgst'.$i); - $AfterIgst = $this->input->post('RevenueAfterIgst'.$i); + $Sgst = $this->input->post('RevenueSgst'.$i); + $Igst = $this->input->post('RevenueIgst'.$i); + $AfterCgst = $this->input->post('RevenueAfterCgst'.$i); + $AfterSgst = $this->input->post('RevenueAfterSgst'.$i); + $AfterIgst = $this->input->post('RevenueAfterIgst'.$i); $FreightType = $this->input->post('FreightType'.$i); $FreightValue = $this->input->post('FreightVal'.$i); $AfterFreightValue = $this->input->post('AfterFreightVal'.$i); $NOOfTrip = $this->input->post('NoOfTrip'.$i); - $revenuedescription = $this->input->post('service_description'.$i); $InsuranceValue = $this->input->post('Insval'.$i); + $revenuedescription = $this->input->post('service_description'.$i); $InsuranceValue = $this->input->post('Insval'.$i); $TotalOrderValue = $this->input->post('TotalOrderValue'.$i); $POLineItemNo = $this->input->post('LineItemNo'.$i); $CostCenter = $this->input->post('costCode'.$i); $LineItemNo = ''; - $SkipInsert = "False"; - if( count($comma_separated) > 0) - { + $SkipInsert = "False"; + if( count($comma_separated) > 0) + { for($j = 1; $j < count($comma_separated); $j++) { $deletedRow = $comma_separated[$j] ; - + if($deletedRow == $i ) { $SkipInsert = "True"; break; - } + } + } - } + } - if($SkipInsert == "False") - { - if(strlen($POLineItemNo) == 0) - { - $POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Per'=>$per,'ServiceMaterialDescription'=>$revenuedescription,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'CreatedBy'=>$updatedBy,'CreatedDate'=>$updateddt,'CostCenterCode'=>$CostCenter); - $POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList); - if(count($POLineItem)>0) - { - $LineItemNo = $POLineItem[0]['LineItemNo']; - } + if($SkipInsert == "False") + { + + if(strlen($POLineItemNo) == 0) + { + $POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Per'=>$per,'ServiceMaterialDescription'=>$revenuedescription,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'CreatedBy'=>$updatedBy,'CreatedDate'=>$updateddt,'CostCenterCode'=>$CostCenter); + + $POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList); + if(count($POLineItem)>0) + { + $LineItemNo = $POLineItem[0]['LineItemNo']; + } } else @@ -1089,6 +1184,7 @@ class purchaseorder extends BaseController $LineItemNo = $POLineItemNo; $POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'UpdateBY'=>$updatedBy,'UpdatedOn'=>$updateddt,'CostCenterCode'=>$CostCenter); + $POLineItem = $this->purchaseorder_model->updatePOLineItem($PONO,$POLineItemNo,$POLineItemList); } @@ -1096,6 +1192,7 @@ class purchaseorder extends BaseController if(count($isExists) == 0) { $RevenueTaxList = array('LineItemNo'=>$LineItemNo, 'DiscountType'=>$DiscountType,'DiscountValue'=>$DiscountValue,'AfterDiscount'=>$AfterDiscount,'PackagingType'=>$PackagingType,'PackagingValue'=>$PackagingValue,'PackagingCalulatedOn'=>$PackagingOption,'AfterPackagingValue'=>$AfterPackagingValue,'FreightType'=>$FreightType, 'FreightValue'=>$FreightValue,'AfterFreightValue'=>$AfterFreightValue,'Insurance'=>$InsuranceValue,'TotalValue'=>$TotalOrderValue, 'CreatedBy'=>$updatedBy,'CreatedDate'=>$updateddt,'CGST'=>$Cgst,'AfterCGST'=>$AfterCgst,'SGST'=>$Sgst,'AfterSGST'=>$AfterSgst,'IGST'=>$Igst,'AfterIGST'=>$AfterIgst,'NoOfTrip'=>$NOOfTrip); + $RevenueList = $this->purchaseorder_model->addRevenueTax($RevenueTaxList); } @@ -1103,18 +1200,18 @@ class purchaseorder extends BaseController { $RevenueTaxList = array('DiscountType'=>$DiscountType,'DiscountValue'=>$DiscountValue,'AfterDiscount'=>$AfterDiscount,'PackagingType'=>$PackagingType,'PackagingValue'=>$PackagingValue,'PackagingCalulatedOn'=>$PackagingOption,'AfterPackagingValue'=>$AfterPackagingValue,'FreightType'=>$FreightType, 'FreightValue'=>$FreightValue,'AfterFreightValue'=>$AfterFreightValue,'Insurance'=>$InsuranceValue,'TotalValue'=>$TotalOrderValue, 'UpdateBY'=>$updatedBy,'UpdatedOn'=>$updateddt,'CGST'=>$Cgst,'AfterCGST'=>$AfterCgst,'SGST'=>$Sgst,'AfterSGST'=>$AfterSgst,'IGST'=>$Igst,'AfterIGST'=>$AfterIgst,'CreatedBy'=>$updatedBy,'NoOfTrip'=>$NOOfTrip); - + $this->purchaseorder_model->updateRevenueTax($LineItemNo,$RevenueTaxList); - } - } + } + } - } + } echo 'Purchase Order Updated Successfully! PO Number Is: '.$PONO ; - } - - /** + } + + /** * To load pagenotfound view */ function pageNotFound() @@ -1124,148 +1221,194 @@ class purchaseorder extends BaseController $this->loadViews("404", $this->global, NULL, NULL); } - /** + /** * To load revenue po datas for pdf */ - public function revenuepoprint($PONO) + public function revenuepoprint($PONO) { - // Load all views as normal + // Load all views as normal + + + $PoStatus=''; - $data['CompanyDetails'] = $this->purchaseorder_model->getCompanyInformationforPDF(); - $data['GetPoFormat'] = $this->purchaseorder_model->GetPoFormat($PONO); - $data['POItem'] = $this->purchaseorder_model->GetRevenuePurchaseOrderDetailsForPDF($PONO); - $data['releasedetails'] = $this->purchaseorder_model->GetReleasedDetails($PONO); - $data['CurrencySymbol']=$this->purchaseorder_model->GerCurrencyCodeName('INR'); - $data['reveuetax']=$this->purchaseorder_model->getRevenueTaxinforforpdf($PONO); - $Currencycode=''; + $data['CompanyDetails'] = $this->purchaseorder_model->getCompanyInformationforPDF(); + $data['GetPoFormat'] = $this->purchaseorder_model->GetPoFormat($PONO); + $data['POItem'] = $this->purchaseorder_model->GetRevenuePurchaseOrderDetailsForPDF($PONO); + $data['releasedetails'] = $this->purchaseorder_model->GetReleasedDetails($PONO); + $data['CurrencySymbol']=$this->purchaseorder_model->GerCurrencyCodeName('INR'); + $data['reveuetax']=$this->purchaseorder_model->getRevenueTaxinforforpdf($PONO); + $Currencycode=''; - $TotalOrderValue=$data['POItem'][0]->TotalOrderValue; - $AdvanceAmount=0.00; - - foreach ($data['POItem'] as $POI) - { + $TotalOrderValue=$data['POItem'][0]->TotalOrderValue; +$AdvanceAmount=0.00; + foreach ($data['POItem'] as $POI) + { $AdvanceAmount=$POI->AdvanceAmount; $PoStatus=$POI->Status; - } + } - $TotaltoPay=0.00; - $TotaltoPay=$TotalOrderValue-$AdvanceAmount; - $totalAmt=sprintf("%.2f", $TotalOrderValue); + $TotaltoPay=0.00; + $TotaltoPay=$TotalOrderValue-$AdvanceAmount; + $totalAmt=sprintf("%.2f", $TotalOrderValue); - $data['TotalAmountInWords']= $this->convertNumber($totalAmt); - $data['RequistionDetails'] = $this->purchaseorder_model->GetPdfRequistionDetails($PONO); + + + $data['TotalAmountInWords']= $this->convertNumber($totalAmt); + $data['RequistionDetails'] = $this->purchaseorder_model->GetPdfRequistionDetails($PONO); + + + + + + $mpdf=new mPDF('utf-8','A4-P',7, 10,10, 10, 82, 38, 4, 6); - $mpdf=new mPDF('utf-8','A4-P',7, 10,10, 10, 82, 38, 4, 6); + $HtmlHeading = $this->load->view('includes/pdfheader',$data, true); $HTMLFooter = $this->load->view('includes/pdffooter',$data, true); $mpdf->SetWatermarkImage('./assets/images/mpdf.png', 8, 10 ); $mpdf->showWatermarkImage = true; - $mpdf->SetDisplayMode('fullpage'); + $mpdf->SetDisplayMode('fullpage'); if($PoStatus == PO_RELEASED || $PoStatus == PO_SERVICE_COMPLETED || $PoStatus == MRIR_APPROVED || $PoStatus == MRIR_REJECTED || $PoStatus == IGR_CREATED || $PoStatus==''){ $mpdf->SetWatermarkText(''); + } else{ + $mpdf->SetWatermarkText('DRAFT'); } $mpdf->watermark_font = 'DejaVuSansCondensed'; $mpdf->showWatermarkText = true; + $mpdf->SetHTMLHeader($HtmlHeading); $html = $this->load->view('revenuepopdf',$data,true); + $mpdf->SetDisplayMode('fullpage'); $mpdf->setFooter($HTMLFooter . "Page {PAGENO} of {nb}"); + $mpdf->list_indent_first_level = 1; - $mpdf->setAutoTopMargin = 'stretch'; + $mpdf->setAutoTopMargin = 'stretch'; $mpdf->setAutoBottomMargin = 'stretch'; $mpdf->WriteHTML($html); - $mpdf->Output('RevenuePOReport'.$PONO.'.pdf','I'); - } + + + $mpdf->Output('RevenuePOReport'.$PONO.'.pdf','I'); + +} + + + +/** + * To load service po datas for pdf + */ + public function servicepoprint($PONO) + { + + $PoStatus=''; + $data['CompanyDetails'] = $this->purchaseorder_model->getCompanyInformationforPDF(); + $data['GetPoFormat'] = $this->purchaseorder_model->GetPoFormat($PONO); + $data['POItem'] = $this->purchaseorder_model->GetServicePurchaseOrderDetailsForpdf($PONO); + + + $data['releasedetails'] = $this->purchaseorder_model->GetReleasedDetails($PONO); + $data['serviceTaxList'] = $this->purchaseorder_model->GetServiceTaxDetails($PONO); + + $data['CurrencySymbol']=$this->purchaseorder_model->GerCurrencyCodeName('INR'); + + + + $TotalOrderValue=0; + $Currencycode=''; + foreach ($data['POItem'] as $POValue) + { + + $TotalOrderValue=$TotalOrderValue + $POValue->TotalValue; + + + } + $Advance=0.00; + foreach ($data['POItem'] as $PO) + { + $Advance=$PO->AdvanceAmount; + $PoStatus=$PO->Status; + } + $TotaltoPay=0.00; + $TotaltoPay=$TotalOrderValue-$Advance; + + + + $totalAmt=sprintf("%.2f", $TotalOrderValue); + + $data['TotalAmountInWords']= $this->convertNumber($totalAmt); + + $data['RequistionDetails'] = $this->purchaseorder_model->GetPdfRequistionDetails($PONO); + + + $mpdf=new mPDF('utf-8','A4-P',7, 10,10, 10, 82, 38, 4, 6); + + + $HtmlHeading = $this->load->view('includes/pdfheader',$data, true); + $HTMLFooter = $this->load->view('includes/pdffooter',$data, true); + $mpdf->SetWatermarkImage('./assets/images/mpdf.png', 8, 10 ); + $mpdf->showWatermarkImage = true; + + $mpdf->SetDisplayMode('fullpage'); + if($PoStatus == PO_RELEASED || $PoStatus == PO_SERVICE_COMPLETED || $PoStatus == MRIR_APPROVED || $PoStatus == MRIR_REJECTED || $PoStatus == IGR_CREATED || $PoStatus==''){ + $mpdf->SetWatermarkText(''); + + } + else{ + + $mpdf->SetWatermarkText('DRAFT'); + } + + $mpdf->watermark_font = 'DejaVuSansCondensed'; + $mpdf->showWatermarkText = true; + + $mpdf->SetHTMLHeader($HtmlHeading); + $html = $this->load->view('servicepopdf',$data,true); + + $mpdf->SetDisplayMode('fullpage'); + $mpdf->setFooter($HTMLFooter . "Page {PAGENO} of {nb}"); + + $mpdf->list_indent_first_level = 1; + $mpdf->setAutoTopMargin = 'stretch'; + $mpdf->setAutoBottomMargin = 'stretch'; + $mpdf->WriteHTML($html); + + + + $mpdf->Output('ServicePOReport'.$PONO.'.pdf','I'); + +} + + + /** - * To load service po datas for pdf + * To load import po datas for pdf */ - public function servicepoprint($PONO) - { - $PoStatus=''; - $data['CompanyDetails'] = $this->purchaseorder_model->getCompanyInformationforPDF(); - $data['GetPoFormat'] = $this->purchaseorder_model->GetPoFormat($PONO); - $data['POItem'] = $this->purchaseorder_model->GetServicePurchaseOrderDetailsForpdf($PONO); - $data['releasedetails'] = $this->purchaseorder_model->GetReleasedDetails($PONO); - $data['serviceTaxList'] = $this->purchaseorder_model->GetServiceTaxDetails($PONO); - $data['CurrencySymbol']=$this->purchaseorder_model->GerCurrencyCodeName('INR'); - - $TotalOrderValue=0; - $Currencycode=''; - foreach ($data['POItem'] as $POValue) - { - $TotalOrderValue=$TotalOrderValue + $POValue->TotalValue; - } - $Advance=0.00; - - foreach ($data['POItem'] as $PO) - { - $Advance=$PO->AdvanceAmount; - $PoStatus=$PO->Status; - } - $TotaltoPay=0.00; - $TotaltoPay=$TotalOrderValue-$Advance; - $totalAmt=sprintf("%.2f", $TotalOrderValue); - $data['TotalAmountInWords']= $this->convertNumber($totalAmt); - $data['RequistionDetails'] = $this->purchaseorder_model->GetPdfRequistionDetails($PONO); - - $mpdf=new mPDF('utf-8','A4-P',7, 10,10, 10, 82, 38, 4, 6); - - $HtmlHeading = $this->load->view('includes/pdfheader',$data, true); - $HTMLFooter = $this->load->view('includes/pdffooter',$data, true); - $mpdf->SetWatermarkImage('./assets/images/mpdf.png', 8, 10 ); - $mpdf->showWatermarkImage = true; - - $mpdf->SetDisplayMode('fullpage'); - if($PoStatus == PO_RELEASED || $PoStatus == PO_SERVICE_COMPLETED || $PoStatus == MRIR_APPROVED || $PoStatus == MRIR_REJECTED || $PoStatus == IGR_CREATED || $PoStatus==''){ - $mpdf->SetWatermarkText(''); - } - else{ - $mpdf->SetWatermarkText('DRAFT'); - } - $mpdf->watermark_font = 'DejaVuSansCondensed'; - $mpdf->showWatermarkText = true; - - $mpdf->SetHTMLHeader($HtmlHeading); - $html = $this->load->view('servicepopdf',$data,true); - - $mpdf->SetDisplayMode('fullpage'); - $mpdf->setFooter($HTMLFooter . "Page {PAGENO} of {nb}"); - - $mpdf->list_indent_first_level = 1; - $mpdf->setAutoTopMargin = 'stretch'; - $mpdf->setAutoBottomMargin = 'stretch'; - $mpdf->WriteHTML($html); - - $mpdf->Output('ServicePOReport'.$PONO.'.pdf','I'); - - } - -/** - * Index Page for this controller (default function of the class) - */ - public function importpoprint($PONO) +public function importpoprint($PONO) { - $Requester=''; + + + // Load the pdf page with multiviews + $Requester=''; $Depcode=''; $Currencycode=''; $PoStatus=''; - $data['CompanyDetails'] = $this->purchaseorder_model->getCompanyInformationforPDF(); $data['GetPoFormat'] = $this->purchaseorder_model->GetPoFormat($PONO); $data['POItem'] = $this->purchaseorder_model->GetImportPurchaseOrderDetailsForPDF($PONO); $data['releasedetails'] = $this->purchaseorder_model->GetReleasedDetails($PONO); + $data['RequistionDetails'] = $this->purchaseorder_model->GetPdfRequistionDetails($PONO); - + foreach ($data['POItem'] as $Reqdby) { $Requester=$Reqdby->Requestedby; @@ -1273,6 +1416,7 @@ class purchaseorder extends BaseController } + foreach ($data['POItem'] as $CURTYPE) { $Currencycode=$CURTYPE->CurrencyType; @@ -1286,30 +1430,33 @@ class purchaseorder extends BaseController } $data['DEPCODE']=$this->purchaseorder_model->GerRequesterDep($Depcode); + $data['Currencytype']=$this->purchaseorder_model->GerCurrencyCodeName($Currencycode); $ProductPrice=''; - $TotalOrderValue = 0.0; - + $TotalOrderValue = 0.0; foreach ($data['POItem'] as $PO ) { $TotalOrderValue=$PO->TotalOrderValue; } - $AdvanceAmount=0.0; - - foreach ($data['POItem'] as $POI) + $AdvanceAmount=0.0; + foreach ($data['POItem'] as $POI) { $AdvanceAmount=$POI->AdvanceAmount; } - $TotaltoPay=0.00; + $TotaltoPay=0.00; $TotaltoPay=$TotalOrderValue-$AdvanceAmount; - $CurrencyType=''; - - if(!empty($data['POItem'])){ - $CurrencyType=$data['POItem'][0]->CurrencyType; - } - if($CurrencyType=='') - { + + + + $CurrencyType=''; + if(!empty($data['POItem'])){ + $CurrencyType=$data['POItem'][0]->CurrencyType; + } + + + if($CurrencyType=='') + { $data['CurrencySymbol']=$this->purchaseorder_model->GerCurrencyCodeName('INR'); } else @@ -1317,11 +1464,15 @@ class purchaseorder extends BaseController $data['CurrencySymbol']=$this->purchaseorder_model->GerCurrencyCodeName($CurrencyType); } - $totalAmt=sprintf("%.2f", $TotalOrderValue); + + $totalAmt=sprintf("%.2f", $TotalOrderValue); - $data['TotalAmountInWords']= $this->convertNumber($totalAmt); + $data['TotalAmountInWords']= $this->convertNumber($totalAmt); - $SymbolCurrency = ''; + + + + $SymbolCurrency = ''; $SymbolCurrencyName =''; $PaiseVal = ''; if(!empty($data['CurrencySymbol']) >0) @@ -1330,42 +1481,42 @@ class purchaseorder extends BaseController $SymbolCurrencyName=$data['CurrencySymbol'][0]->Currency; $PaiseVal=$data['CurrencySymbol'][0]->PaiseVal; } - $TotalOrderValue=$data['POItem'][0]->TotalOrderValue; + $TotalOrderValue=$data['POItem'][0]->TotalOrderValue; - $totalAmt=sprintf("%.2f", $TotaltoPay); + $totalAmt=sprintf("%.2f", $TotaltoPay); - $mpdf=new mPDF('utf-8','A4-P',7, 10,10, 10, 82, 38, 4, 6); - - $HtmlHeading = $this->load->view('includes/pdfheader',$data, true); - $HTMLFooter = $this->load->view('includes/pdffooter',$data, true); - $mpdf->SetWatermarkImage('./assets/images/mpdf.png', 8, 10 ); - $mpdf->showWatermarkImage = true; - $mpdf->SetDisplayMode('fullpage'); - - if($PoStatus == PO_RELEASED || $PoStatus == PO_SERVICE_COMPLETED || $PoStatus == MRIR_APPROVED || $PoStatus == MRIR_REJECTED || $PoStatus == IGR_CREATED || $PoStatus==''){ - - $mpdf->SetWatermarkText(''); + $mpdf=new mPDF('utf-8','A4-P',7, 10,10, 10, 82, 38, 4, 6); + - } - else{ - $mpdf->SetWatermarkText('DRAFT'); - } - $mpdf->watermark_font = 'DejaVuSansCondensed'; - $mpdf->showWatermarkText = true; + $HtmlHeading = $this->load->view('includes/pdfheader',$data, true); + $HTMLFooter = $this->load->view('includes/pdffooter',$data, true); + $mpdf->SetWatermarkImage('./assets/images/mpdf.png', 8, 10 ); + $mpdf->showWatermarkImage = true; + + $mpdf->SetDisplayMode('fullpage'); + if($PoStatus == PO_RELEASED || $PoStatus == PO_SERVICE_COMPLETED || $PoStatus == MRIR_APPROVED || $PoStatus == MRIR_REJECTED || $PoStatus == IGR_CREATED || $PoStatus==''){ + $mpdf->SetWatermarkText(''); + + } + else{ + + $mpdf->SetWatermarkText('DRAFT'); + } + + $mpdf->watermark_font = 'DejaVuSansCondensed'; + $mpdf->showWatermarkText = true; $mpdf->SetHTMLHeader($HtmlHeading); $html = $this->load->view('importpopdf',$data,true); - //$mpdf=new mPDF('utf-8', array(500,500)); + $mpdf->SetDisplayMode('fullpage'); $mpdf->setFooter($HTMLFooter . "Page {PAGENO} of {nb}"); - //$mpdf->setFooter("Page {PAGENO} of {nb}"); + $mpdf->list_indent_first_level = 1; $mpdf->setAutoTopMargin = 'stretch'; $mpdf->setAutoBottomMargin = 'stretch'; - //$stylesheet = file_get_contents('assets/css/mpdfstyletables.css'); - //$mpdf->WriteHTML($stylesheet, 1); $mpdf->WriteHTML($html); - //$mpdf->writeHTMLHeaders(); + $mpdf->Output('ImportPOReport'.$PONO.'.pdf','I'); @@ -1379,6 +1530,9 @@ class purchaseorder extends BaseController /** * This function used to load the Delete the Requistion Items */ + /** + * Its handles delete PO Line-item details operation. + */ function DeletePODetails() { @@ -1418,12 +1572,11 @@ class purchaseorder extends BaseController } - /** - * Index Page for this controller (default function of the class) + * To store the new import PO datas into DB */ function addNewImportPurchaseOrder() - {//echo ("ggh"); + { $POdt =$this->input->post('PODate'); $PODate = $this->getDateformat($POdt); @@ -1435,8 +1588,6 @@ function addNewImportPurchaseOrder() $DeliveryOption = $this->input->post('DateRange'); - //echo $DeliveryOption; - //die(); $DeliverySchedule=''; $Dispatch=''; if($DeliveryOption==1) @@ -1475,7 +1626,7 @@ function addNewImportPurchaseOrder() $PaymentTerms=$this->input->post('PaymentTerms'); $OtherPayment=$this->input->post('Otherpayment'); $Palaceoforigin=$this->input->post('PlaceOforigin'); - // $Payableat=$this->input->post('PayableAT'); + $Shipmentmode=$this->input->post('addmodeofshipment'); $SupplierRef=$this->input->post('addsupplierreference'); @@ -1484,8 +1635,7 @@ function addNewImportPurchaseOrder() $finCap=$this->input->post('addfincap'); $importoption=$this->input->post('Importoption'); - // echo $importoption; - // die(); + $Insurance=$this->input->post('Insurance'); if($Insurance==1) @@ -1498,13 +1648,11 @@ function addNewImportPurchaseOrder() $Insurancenumber=''; } - // $POList = array('SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrder,'PODate'=>$PODate,'Status'=>$POStatus,'PORange'=>$PoRange,'ServiceDescription'=>$SpcialInstruction,'CreatedBy'=>$CreateBy,'DeliveryAddress'=>$DeliveryAddr,'CreatedDate'=>$createddt,'ExchangeRate'=>$Exchangerate,'ExchangeRateCalculatedon'=>$ExchangeRateCalculatedon,'CurrencyType'=>$CurrencyType,'PaymentTerms'=>$PaymentTerms,'POType'=>$POType); + $POList = array('SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrder,'PODate'=>$PODate,'Status'=>$POStatus,'PORange'=>$PoRange,'ServiceDescription'=>$SpcialInstruction,'CreatedBy'=>$CreateBy,'DeliveryAddress'=>$DeliveryAddr,'Import_DispatchDetails'=>$Dispatch,'CreatedDate'=>$createddt,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'ExchangeRate'=>$Exchangerate,'ExchangeRateCalculatedon'=>$ExchangeRateCalculatedon,'CurrencyType'=>$CurrencyType,'PaymentTerms'=>$PaymentTerms,'POType'=>$POType,'Import_PlaceofOrgin'=>$Palaceoforigin,'PaymentOtherDescription'=>$OtherPayment,'Mode_Of_Shipment'=>$Shipmentmode,'Supplier_Reference'=>$SupplierRef,'Supplier_Offer_No'=>$SupplierOffer,'Other_Reference'=>$otherRef,'Fincap'=>$finCap,'InsuranceStatus'=>$Insurance,'InsuranceNumber'=>$Insurancenumber,'POSubType'=>$importoption); - //print_r($POList); - //die(); $POMaster = $this->purchaseorder_model->addPOMaster($POList,$POType,$importoption); $PONO = ''; @@ -1512,22 +1660,17 @@ function addNewImportPurchaseOrder() { $PONO = $POMaster[0]['PONO']; } - //echo $PONO; - //echo $POType; - // PO Line Items $LineItemStatus = REQITEM_NEW; - //echo ' test:'.REVENUE; - //echo $RowCount; for ($i = 1; $i <= $RowCount; $i++) { - //echo "AS"; + $MaterialCode = $this->input->post('materialCode'.$i); $Quantity = $this->input->post('quantity'.$i); - //echo $Quantity; + $Reqnumber = $this->input->post('Reqnumber'.$i); $itemRate = $this->input->post('itemRate'.$i); - //$Exchangerate = $this->input->post('Exchangerate'.$i); + $BasicPriceinmton = $this->input->post('BasicPriceinUS'.$i); $Productprice = $this->input->post('BasicAmt'.$i); $LandingCharge = $this->input->post('LandingChargee'.$i); @@ -1543,10 +1686,10 @@ function addNewImportPurchaseOrder() $QuantityKG = $this->input->post('PurQuantity'.$i); - //$currencytypeID = $this->input->post('currencytype'); + $Totalvalueitem=$this->input->post('TotalExp'.$i); - //echo $BasicPriceinmton; + $CostCenter = $this->input->post('costCode'.$i); $AssessableValue=$this->input->post('AfterAssessable'.$i); @@ -1564,11 +1707,11 @@ function addNewImportPurchaseOrder() $Freightrate=$this->input->post('FreightRate'.$i); $Freightamount=$this->input->post('AfterFreightRate'.$i); - //echo $Freightamount; + $specialinstruction=$this->input->post('Addinstruction'.$i); - //echo $specialinstruction; + $per=$this->input->post('Per'.$i); @@ -1594,8 +1737,6 @@ function addNewImportPurchaseOrder() { $POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'CostCenterCode'=>$CostCenter,'Per'=>$per,'ServiceMaterialDescription'=>$specialinstruction); - //print_r($POLineItemList); - //die(); $POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList); @@ -1605,15 +1746,12 @@ function addNewImportPurchaseOrder() { $LineItemNo = $POLineItem[0]['LineItemNo']; } - //echo $LineItemNo; + if(trim($POType) == IMPORT ) { - // echo 'Success'; + $ImportTaxList = array('LineItemNo'=>$LineItemNo,'BasicPriceInMTon'=>$BasicPriceinmton,'ProductPrice'=>$Productprice,'LandingCharge'=>$LandingCharge,'AfterLandingCharge'=>$AfterLandingCharge,'CustomDuty'=>$CustomDuty,'AfterCustomDuty'=>$AfterCustomDuty,'CustomEdCess'=>$CustomEd,'CustomSHCess'=>$CustomSH,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'Grossdutypayable'=>$Grossdutypayable,'CustomDutyExpensesPerKG'=>$CustomDutyExpensesPerKG,'QuantityKG'=>$QuantityKG,'AfterCustomSHCess'=>$AfterCustomSH,'AfterCustomEdCess'=>$AfterCustomEd,'TotalValue'=>$Totalvalueitem,'FreightType'=>$FreightType,'NoOfTrip'=>$nooftrip,'FreightValue'=>$Freightrate,'AfterFreightValue'=>$Freightamount,'AssessableValue'=>$AssessableValue,'SubTotal'=>$Subtotal,'IGST'=>$Igst,'AfterIGST'=>$AfterIgst,'DutyImpact'=>$Dutyimpact,'ClearingCharge'=>$Clearingcharge,'NetValue'=>$Nettvalue); - //print_r($ImportTaxList); - //die();$Nettvalue - $ImportList = $this->purchaseorder_model->addImportTax($ImportTaxList); @@ -1625,14 +1763,12 @@ function addNewImportPurchaseOrder() echo 'Purchase Order Created Successfully! PO Number Is: '.$PONO ; } -/** - * Index Page for this controller (default function of the class) + /** + * To stored new values after edited import po. */ function EditImportPurchaseOrder() { - //echo "dfds"; - //die(); $PONO =$this->input->post('txtPONO'); $POdt = ''; $createddt=''; @@ -1643,20 +1779,16 @@ function addNewImportPurchaseOrder() $dt = $this->input->post('Deliverydt'); $Deliverydt = $this->getDateformat($dt); $POType = $this->input->post('POType'); - //$PoRange = $this->input->post('txtPoRange'); - //$DeliveryOption = $this->input->post('DateRange'); - + $Exchangerate=$this->input->post('ExchangeRate'); $Edt=$this->input->post('Exchangerateon'); $ExchangeRateCalculatedon=$this->getDateformat($Edt); - // $ExchangeRateCalculatedon=$this->input->post('Exchangerateon'); + $CurrencyType=$this->input->post('currencytype'); $DeliveryOption = $this->input->post('DateRange'); - //echo $DeliveryOption; - //die(); $DeliverySchedule=''; $Dispatch=''; if($DeliveryOption==1) @@ -1674,10 +1806,9 @@ function addNewImportPurchaseOrder() $SpcialInstruction = $this->input->post('txtSpcialInstruction'); - //$TotalOrder = $this->input->post('txtToatlOrder'); + $TotalOrder = $this->input->post('txttot'); - // echo $TotalOrder; - //die(); + $POStatus = $this->input->post('txtStatus'); $CreateBy = $this->session->userdata ( 'userId' ); @@ -1691,8 +1822,6 @@ function addNewImportPurchaseOrder() $PaymentTerms=$this->input->post('PaymentTerms'); $OtherPayment=$this->input->post('Otherpayment'); $Palaceoforigin=$this->input->post('PlaceOforigin'); - // $Payableat=$this->input->post('PayableAT'); - $Shipmentmode=$this->input->post('editmodeofshipment'); $SupplierRef=$this->input->post('editsupplierreference'); @@ -1703,11 +1832,10 @@ function addNewImportPurchaseOrder() $importoption=$this->input->post('Importoption'); - // echo $importoption; - // die(); + $Insurance=$this->input->post('Insurance'); - //echo $Insurance; + if($Insurance=='YES') { @@ -1720,43 +1848,27 @@ function addNewImportPurchaseOrder() $Insurancenumber=''; $insurestatus='0'; } - // PO Master - // PO Master - // $POList = array('SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrder,'PODate'=>$PODate,'Status'=>$POStatus,'ServiceDescription'=>$SpcialInstruction,'CreatedBy'=>$CreateBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'CreatedDate'=>$updateddt,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'ExchangeRate'=>$Exchangerate,'ExchangeRateCalculatedon'=>$ExchangeRateCalculatedon,'CurrencyType'=>$CurrencyType,'PaymentTerms'=>$PaymentTerms); - - - + $POList = array('SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrder,'PODate'=>$PODate,'Status'=>$POStatus,'ServiceDescription'=>$SpcialInstruction,'CreatedBy'=>$CreateBy,'DeliveryAddress'=>$DeliveryAddr,'Import_DispatchDetails'=>$Dispatch,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'ExchangeRate'=>$Exchangerate,'ExchangeRateCalculatedon'=>$ExchangeRateCalculatedon,'CurrencyType'=>$CurrencyType,'PaymentTerms'=>$PaymentTerms,'POType'=>$POType,'Import_PlaceofOrgin'=>$Palaceoforigin,'PaymentOtherDescription'=>$OtherPayment,'Mode_Of_Shipment'=>$Shipmentmode,'Supplier_Reference'=>$SupplierRef,'Supplier_Offer_No'=>$SupplierOffer,'Other_Reference'=>$otherRef,'Fincap'=>$finCap,'InsuranceStatus'=>$insurestatus,'InsuranceNumber'=>$Insurancenumber,'POSubType'=>$importoption); - //echo $PONO; - //echo $TotalOrder; - //print_r($POList); - //die(); $POMaster = $this->purchaseorder_model->updatePOMaster($PONO,$POList); - //echo "sdasds"; - $LineItemStatus = REQITEM_NEW; - //echo $LineItemStatus; - - - //echo $RowCount; + $LineItemStatus = REQITEM_NEW; for ($i = 1; $i <= $RowCount; $i++) { $MaterialCode = $this->input->post('materialCode'.$i); $Quantity = $this->input->post('quantity'.$i); - //echo $Quantity; + $Reqnumber = $this->input->post('Reqnumber'.$i); $itemRate = $this->input->post('itemRate'.$i); - ; - //die(); + + - //$Exchangerate = $this->input->post('Exchangerate'.$i); + $BasicPriceinmton = $this->input->post('BasicPriceInMTon'.$i); $Productprice = $this->input->post('TotalValue'.$i); - //echo $ProductPrice; - //die(); $LandingCharge = $this->input->post('LandingCharge'.$i); $AfterLandingCharge = $this->input->post('AfterLandingCharge'.$i); $HighSeas = $this->input->post('HighSeasSalesCharge'.$i); @@ -1783,9 +1895,7 @@ function addNewImportPurchaseOrder() $AfterAddAdtional = $this->input->post('AfterAddlExciseDuty'.$i); $Grossdutypayable = $this->input->post('Grossdutypayable'.$i); - //echo $Grossdutypayable; - //die(); - + $AvailableModvat = $this->input->post('AvailableModvat'.$i); $Grossexpensesduetocustomduty = $this->input->post('Grossexpensesduetocustomduty'.$i); @@ -1803,7 +1913,7 @@ function addNewImportPurchaseOrder() $CostCenter = $this->input->post('costCode'.$i); - //$ExciseDutySH = $this->input->post('ExcisedutySH'.$i); + $Totalvalueitem=$this->input->post('TotalValue'.$i); @@ -1818,7 +1928,7 @@ function addNewImportPurchaseOrder() $AssessableValue=$this->input->post('AssessableValue'.$i); - //echo $AssessableValue; + $Subtotal=$this->input->post('SubTotal'.$i); $Igst=$this->input->post('IGST'.$i); $AfterIgst=$this->input->post('AfterIGST'.$i); @@ -1826,17 +1936,15 @@ function addNewImportPurchaseOrder() $Clearingcharge=$this->input->post('ClearingCharge'.$i); $Nettvalue=$this->input->post('NetValue'.$i); - //echo $FreightAmount; + $specialinstruction=$this->input->post('Addinstruction'.$i); $per=$this->input->post('Per'.$i); - // echo $per; - //die(); + $LineItemNo = ''; - //echo "sdsfsd"; - //die(); + $currencytypeID = $this->input->post('currencytype'); $SkipInsert = "False"; @@ -1872,40 +1980,28 @@ function addNewImportPurchaseOrder() $LineItemNo = $POLineItemNo; - //echo $LineItemNo; - //die(); + $POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'UpdatedOn'=>$updateddt,'CostCenterCode'=>$CostCenter,'Per'=>$per,'ServiceMaterialDescription'=>$specialinstruction); $POLineItem = $this->purchaseorder_model->updatePOLineItem($PONO,$POLineItemNo,$POLineItemList); } $isExists = $this->purchaseorder_model->LineItemExistsinImportTax($LineItemNo); - //echo $isExists; - - //die(); + if(count($isExists) == 0) { - // print_r(count($isExists)); - //echo $isExists; - //die(); + + $ImportTaxList = array('LineItemNo'=>$LineItemNo,'BasicPriceInMTon'=>$BasicPriceinmton,'ProductPrice'=>$Productprice,'LandingCharge'=>$LandingCharge,'AfterLandingCharge'=>$AfterLandingCharge,'CustomDuty'=>$CustomDuty,'AfterCustomDuty'=>$AfterCustomDuty,'CustomEdCess'=>$CustomEd,'CustomSHCess'=>$CustomSH,'CreatedBy'=>$CreateBy,'UpdatedOn'=>$updateddt,'Grossdutypayable'=>$Grossdutypayable,'CustomDutyExpensesPerKG'=>$CustomDutyExpensesPerKG,'QuantityKG'=>$QuantityKG,'AfterCustomSHCess'=>$AfterCustomSH,'AfterCustomEdCess'=>$AfterCustomEd,'TotalValue'=>$Totalvalueitem,'FreightType'=>$FreightType,'NoOfTrip'=>$Nosoftrip,'FreightValue'=>$FreightRate,'AfterFreightValue'=>$FreightAmount,'AssessableValue'=>$AssessableValue,'SubTotal'=>$Subtotal,'IGST'=>$Igst,'AfterIGST'=>$AfterIgst,'DutyImpact'=>$Dutyimpact,'ClearingCharge'=>$Clearingcharge,'NetValue'=>$Nettvalue); - - - //print_r($ImportTaxList); - //die(); - $ImportList = $this->purchaseorder_model->addImportTax($ImportTaxList); + $ImportList = $this->purchaseorder_model->addImportTax($ImportTaxList); } else { - //echo "xxcx"; - //die(); + $ImportTaxList = array('LineItemNo'=>$LineItemNo,'BasicPriceInMTon'=>$BasicPriceinmton,'ProductPrice'=>$Productprice,'LandingCharge'=>$LandingCharge,'AfterLandingCharge'=>$AfterLandingCharge,'CustomDuty'=>$CustomDuty,'AfterCustomDuty'=>$AfterCustomDuty,'CustomEdCess'=>$CustomEd,'CustomSHCess'=>$CustomSH,'CreatedBy'=>$CreateBy,'UpdatedOn'=>$updateddt,'Grossdutypayable'=>$Grossdutypayable,'CustomDutyExpensesPerKG'=>$CustomDutyExpensesPerKG,'QuantityKG'=>$QuantityKG,'AfterCustomSHCess'=>$AfterCustomSH,'AfterCustomEdCess'=>$AfterCustomEd,'TotalValue'=>$Totalvalueitem,'FreightType'=>$FreightType,'NoOfTrip'=>$Nosoftrip,'FreightValue'=>$FreightRate,'AfterFreightValue'=>$FreightAmount,'AssessableValue'=>$AssessableValue,'SubTotal'=>$Subtotal,'IGST'=>$Igst,'AfterIGST'=>$AfterIgst,'DutyImpact'=>$Dutyimpact,'ClearingCharge'=>$Clearingcharge,'NetValue'=>$Nettvalue); - //echo "cxvc "; - //die(); - //print_r($ImportTaxList); - //die(); + $this->purchaseorder_model->updateImportTax($LineItemNo,$ImportTaxList); @@ -1921,13 +2017,16 @@ function addNewImportPurchaseOrder() - /* All Function following This command for FINANCE TEAM PO APPROVAL SCREEN*/ + /* All Function following This command for FINANCE TEAM PO APPROVAL SCREEN*/ + /** + * For po approval. functionalities handles by Finances dept. + **/ function poapproval(){ $q="APPROVAL"; $this->global['pageTitle'] = 'Resico : Purchase Order Approval'; - // $data['Status']= $this->purchaseorder_model->getStatus(); + $userID = $this->session->userdata ( 'userId' ); - //print_r($data['Status']);echo "CON"; + $data['AppList'] = $this->purchaseorder_model->getPOList($q); if($this->DEPCode == FINANCE) { @@ -1939,8 +2038,11 @@ function addNewImportPurchaseOrder() $this->loadViews("access", $this->global, $data, NULL); } - } - + } + + /** + * To Convert the dateformat (date with time) and stored into DB + */ function getDateformat2($Val) { $date = new DateTime($Val); @@ -1948,9 +2050,9 @@ function addNewImportPurchaseOrder() return $retDate; } - /** - * Index Page for this controller (default function of the class) - */ + /** + * To change the approval po status + */ function ApprovePO() { $StatusCode= Trim($_POST['SCode']); @@ -1985,15 +2087,17 @@ function addNewImportPurchaseOrder() /* FOLLOWING CODES FOR PO RELEASE SCREEN FUNCTIONALITIES*/ - - + /** + * For po release. functionalities handles by management dept. + **/ + function porelease(){ $q="RELEASE"; $this->global['pageTitle'] = 'Resico: Purchase Order Release'; - // $data['Status']= $this->purchaseorder_model->getStatus(); + $userID = $this->session->userdata ( 'userId' ); - //print_r($data['Status']);echo "CON"; + $data['AppList'] = $this->purchaseorder_model->getPOList($q); if($this->DEPCode == MANAGEMENT) { @@ -2006,10 +2110,10 @@ function addNewImportPurchaseOrder() } - /** - * Index Page for this controller (default function of the class) - */ - function ReleasePO() + /** + * To change the release po status + */ + function ReleasePO() { $StatusCode= Trim($_POST['SCode']); @@ -2034,7 +2138,9 @@ function addNewImportPurchaseOrder() } } -/* Add capital Po*/ +/** + * To store the new Capital PO datas into DB + */ function addNewCapitalPurchaseOrder() { @@ -2048,16 +2154,6 @@ function addNewImportPurchaseOrder() $POType = $this->input->post('POType'); $PoRange = $this->input->post('txtPoRange'); - /* $DeliveryOption = $this->input->post('DateRange'); - if($DeliveryOption==1){ - $Deliverydt = ''; - $DeliverySchedule = $this->input->post('Scheduleby'); - } - else{ - $Deliverydt = $this->getDateformat($dt); - $DeliverySchedule = ''; - } */ - $DeliveryOption = $this->input->post('DateRange'); @@ -2131,7 +2227,7 @@ function addNewImportPurchaseOrder() $POList = array('SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrder,'PODate'=>$PODate,'Status'=>$POStatus,'PORange'=>$PoRange,'ExchangeRateCalculatedon'=>$ExchangeRateOn,'ExchangeRate'=>$ExchangeRate,'PaymentTerms'=>$PaymentMethod,'ServiceDescription'=>$SpcialInstruction,'CreatedBy'=>$CreateBy,'DeliveryAddress'=>$DeliveryAddr,'CreatedDate'=>$createddt,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'CapitalRange'=>$CapitalRange,'POType'=>$POType,'CurrencyType'=>$currencytypeID,'DeliverySchedule'=>$DeliverySchedule,'Import_PlaceofOrgin'=>$Palaceoforigin,'Import_DispatchDetails'=>$Dispatch,'DeliveryDate'=>$Deliverydt,'PaymentOtherDescription'=>$OtherPayment,'Supplier_Reference'=>$SupplierReference,'Mode_Of_Shipment'=>$ModeOfShipment,'Supplier_Offer_No'=>$SuppliersOfferNo,'Other_Reference'=>$OtherReferences,'Fincap'=>$Fincap,'InsuranceStatus'=>$InsuranceOptions,'InsuranceNumber'=>$InsuranceNo,'POSubType'=>$ServiceTypeOptions); - // $POList = array('SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrder,'PODate'=>$PODate,'Status'=>$POStatus,'PORange'=>$PoRange,'ServiceDescription'=>$SpcialInstruction,'CreatedBy'=>$CreateBy,'DeliveryAddress'=>$DeliveryAddr,'Import_DispatchDetails'=>$Dispatch,'CreatedDate'=>$createddt,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'ExchangeRate'=>$Exchangerate,'ExchangeRateCalculatedon'=>$ExchangeRateCalculatedon,'CurrencyType'=>$CurrencyType,'PaymentTerms'=>$PaymentTerms,'POType'=>$POType,'Import_PlaceofOrgin'=>$Palaceoforigin); + $POMaster = $this->purchaseorder_model->addPOMaster($POList,$POType,$ServiceTypeOptions); @@ -2182,7 +2278,7 @@ function addNewImportPurchaseOrder() $Totalvalueitem=$this->input->post('PerKgExpense'.$i); - //echo $BasicPriceinmton; + $CostCenter = $this->input->post('CPCostCode'.$i); $TotalOrderValue = $this->input->post('basicvalInINR'.$i); @@ -2283,7 +2379,9 @@ function addNewImportPurchaseOrder() -/*Edit Capital po*/ +/** + * To store the new Capital PO datas into DB + */ function EditCapitalPurchaseOrder() { @@ -2298,18 +2396,7 @@ function addNewImportPurchaseOrder() $POType = $this->input->post('POType'); $PoRange = $this->input->post('txtPoRange'); - /* $DeliveryOption = $this->input->post('DateRange'); - if($DeliveryOption==1){ - $Deliverydt = ''; - $DeliverySchedule = $this->input->post('Scheduleby'); - } - else{ - //$Deliverydt = $this->getDateformat($dt); - $Deliverydt = ''; - $DeliverySchedule = ''; - } */ - - + $DeliveryOption = $this->input->post('DateRange'); $DeliverySchedule=''; @@ -2438,7 +2525,7 @@ function addNewImportPurchaseOrder() $Totalvalueitem=$this->input->post('PerKgExpense'.$i); - //echo $BasicPriceinmton; + $CostCenter = $this->input->post('CPCostCode'.$i); $TotalOrderValue = $this->input->post('basicvalInINR'.$i); @@ -2475,15 +2562,7 @@ function addNewImportPurchaseOrder() $Freightrateloc=$this->input->post('Fvalue'.$i); $FreightAmountloc=$this->input->post('Afvalue'.$i); - // echo $FreightTypeloc; - // echo 'n'; - // echo $FreightNoofTriploc; - // echo 'n'; - // echo $Freightrateloc; - // echo 'n'; - // echo $FreightAmountloc; - - // die(); + @@ -2571,8 +2650,9 @@ function addNewImportPurchaseOrder() } - /* capital po print/pdf*/ - + /** + * To load capital po datas for pdf + */ public function CapitalPoPrint($PONO) { @@ -2598,10 +2678,6 @@ function addNewImportPurchaseOrder() $TotalOrderValue=$data['POItem'][0]->TotalOrderValue; - // $totalAmt=sprintf("%.2f", $TotalOrderValue); - - // $data['TotalAmountInWords']= $this->convertNumber($totalAmt); - // } $AdvanceAmount=0.0; @@ -2645,31 +2721,9 @@ function addNewImportPurchaseOrder() - // $this->load->View("capitalpopdf", $data); - - // Add header to pdf - //$this->load->view('includes/pdffooter'); - - // Get output html - // $php = $this->output->get_output(); - - // Load library - // $this->load->library('dompdf_gen'); - // $paper_orientation = 'portrait'; - // $customPaper = array(0,0,750,950); - // $this->dompdf->set_paper($customPaper,$paper_orientation); - - // Convert to PDF - // $this->dompdf->load_html($php); - // $this->dompdf->render(); - // $data['Attachment'] = FALSE; - // $this->dompdf->stream("CapitalPOReport".$PONO.".pdf",$data,$php); - - - - + $mpdf=new mPDF('utf-8','A4-P',7, 10,10, 10, 82, 38, 4, 6); - //$mpdf=new mPDF('utf-8', array(190,236)); + $HtmlHeading = $this->load->view('includes/pdfheader',$data, true); $HTMLFooter = $this->load->view('includes/pdffooter',$data, true); @@ -2688,20 +2742,18 @@ function addNewImportPurchaseOrder() $mpdf->watermark_font = 'DejaVuSansCondensed'; $mpdf->showWatermarkText = true; - //$mpdf->Image('files/images/frontcover.jpg', 0, 0, 210, 297, 'jpg', '', true, false); + $mpdf->SetHTMLHeader($HtmlHeading); $html = $this->load->view('capitalpopdf',$data,true); - //$mpdf=new mPDF('utf-8', array(500,500)); + $mpdf->SetDisplayMode('fullpage'); $mpdf->setFooter($HTMLFooter . "Page {PAGENO} of {nb}"); - //$mpdf->setFooter("Page {PAGENO} of {nb}"); + $mpdf->list_indent_first_level = 1; $mpdf->setAutoTopMargin = 'stretch'; $mpdf->setAutoBottomMargin = 'stretch'; - //$stylesheet = file_get_contents('assets/css/mpdfstyletables.css'); - //$mpdf->WriteHTML($stylesheet, 1); $mpdf->WriteHTML($html); - //$mpdf->writeHTMLHeaders(); + $mpdf->Output('CapitalPOReport'.$PONO.'.pdf','I'); @@ -2716,10 +2768,11 @@ function addNewImportPurchaseOrder() - /*This function is used to convert amount(digit) into words*/ - + /** + * To convert amount(digit) into words + * */ public function convertNumber($amt){ - //echo $amt;die(); + $ShowPaise='0'; $totalAmt=explode(".",$amt); @@ -2768,9 +2821,9 @@ $point=0; $i += ($divider == 10) ? 1 : 2; if ($number) { $plural = (($counter = count($str)) && $number > 1) ? 's' : null; - //print_r($plural); + $hundred = ($counter == 1 && $str[0]) ? ' and ' : null; - //print_r($hundred); + $str [] = ($number < 21) ? $words[$number] . " " . $digits[$counter] . $plural . " " . $hundred : @@ -2810,6 +2863,9 @@ $amountInWords = "Rupees " . $result ." Paise ". $points." Only"; return $amountInWords; } + /** + * To convert the number into round off values and Get currentcy symbols + * */ public function convertNumberSymbol($amt,$symbol,$name,$paise){ $ShowPaise='0'; $totalAmt=explode(".",$amt); @@ -2856,9 +2912,9 @@ $point=0; $i += ($divider == 10) ? 1 : 2; if ($number) { $plural = (($counter = count($str)) && $number > 1) ? 's' : null; - //print_r($plural); + $hundred = ($counter == 1 && $str[0]) ? ' and ' : null; - //print_r($hundred); + $str [] = ($number < 21) ? $words[$number] . " " . $digits[$counter] . $plural . " " . $hundred : @@ -2899,8 +2955,8 @@ $amountInWords = $name." " . $result.$paise ." ". $points." Only"; /** - * Index Page for this controller (default function of the class) - */ + * To add advance po. + */ function addadvancerequest() { @@ -2931,7 +2987,7 @@ function addadvancerequest() if($advance > 0) { - // $this->session->set_flashdata('success', 'New Asset created successfully'); + echo ""; redirect('purchaseorder/advancerequest','refresh'); @@ -2943,4 +2999,4 @@ if($advance > 0) } -?> +?> \ No newline at end of file diff --git a/application/controllers/user.php b/application/controllers/user.php index ca2bcacd..673dfa18 100644 --- a/application/controllers/user.php +++ b/application/controllers/user.php @@ -40,10 +40,10 @@ class user extends BaseController $data['pendingpo']=$this->dahsboard_Model->pendingpo(); - $data['totalserviceamount']=$this->dahsboard_Model->totalserviceamount(); - $data['totalcapitalamount']=$this->dahsboard_Model->totalcapitalamount(); - $data['totalimportamount']=$this->dahsboard_Model->totalimportamount(); - $data['totalrevenueamount']=$this->dahsboard_Model->totalrevenueamount(); + // $data['totalserviceamount']=$this->dahsboard_Model->totalserviceamount(); + // $data['totalcapitalamount']=$this->dahsboard_Model->totalcapitalamount(); + // $data['totalimportamount']=$this->dahsboard_Model->totalimportamount(); + // $data['totalrevenueamount']=$this->dahsboard_Model->totalrevenueamount(); $data['totalimportpo']=$this->dahsboard_Model->totalimportpo(); diff --git a/application/models/assetdetails_model.php b/application/models/assetdetails_model.php index a1181fbd..c4601f2b 100644 --- a/application/models/assetdetails_model.php +++ b/application/models/assetdetails_model.php @@ -5,7 +5,7 @@ class assetdetails_model extends CI_Model /** * To get the Asset data for listing - * @return array $result : This is result + * @return array $result : result of the query */ function assetListing() { @@ -20,8 +20,8 @@ class assetdetails_model extends CI_Model /** * To get the actived department information - * @param $Department : Optional : To get department code - * @return $query->result() : This is result of the query (department information) + * @param $Department : Optional : This is department code + * @return $query->result() : result of the query (returns department information) * * Note : This function Temporary not in use */ @@ -42,8 +42,8 @@ class assetdetails_model extends CI_Model /** * To get the actived supplier information - * @param $SupplierID : Optional : To get Supplier id - * @return $query->result() : This is result of the query (supplier information) + * @param $SupplierID : Optional : This is Supplier id + * @return $query->result() : result of the query (returns supplier information) */ function getSupplierName($SupplierID = '') { @@ -61,10 +61,9 @@ class assetdetails_model extends CI_Model /** * To get the MRIR Approved PO details - * @param $PO : To get PO number from the controller - * @return $query->result() : This is result of the query (po details) + * @param $PO : This is PO number + * @return $query->result() : result of the query (returns po details) */ - function getpodetails($PO) { @@ -83,9 +82,9 @@ class assetdetails_model extends CI_Model } /** - * To get the MRIR Approved PO number (listed on dropdown) - * @param $PO :Optional : To get PO number - * @return $query->result() : This is result of the query (po no) + * To get the MRIR Approved PO (listed on dropdown) + * @param $PO :Optional : This is PO number + * @return $query->result() : result of the query (returns po number) */ function getPO($PO='') { @@ -103,8 +102,8 @@ class assetdetails_model extends CI_Model /** * To get the PO lineitem details for revenue po. - * @param $line : To get PO lineitem number from the controller - * @return $result : This is result of the query (po lineitem no) + * @param $line : This is PO lineitem number + * @return $result : result of the query (returns po lineitem details) */ function getlineitemre($line){ $this->db->select('POL.LineItemNo,POL.MaterialCode,MM.MaterialName,MM.UOM,POL.Quantity,POM.POType,re.TotalValue,req.ReqNo,emp.firstname,emp.Departmentcode,dep.DepartmentName,sup.SupplierName,date(POM.DeliveryDate) as DeliveryDate,POM.PODate,POM.SupplierID'); @@ -126,8 +125,8 @@ class assetdetails_model extends CI_Model /** * To get the PO lineitem details for service po. - * @param $line : To get PO lineitem number from the controller - * @return $result : This is result of the query (po lineitem no) + * @param $line : This is PO lineitem number + * @return $result : This is result of the query (returns po lineitem details) */ function getlineitemser($line){ $this->db->select('POL.LineItemNo,POL.MaterialCode,MM.MaterialName,MM.UOM,POM.POType,POL.Quantity,ser.TotalValue,req.ReqNo,emp.firstname,dep.DepartmentName,emp.Departmentcode,sup.SupplierName,date(POM.DeliveryDate) as DeliveryDate,POM.PODate,POM.SupplierID'); @@ -149,8 +148,8 @@ class assetdetails_model extends CI_Model /** * To get the PO lineitem details for import po. - * @param $line : To get PO lineitem number from the controller - * @return $result : This is result of the query (po lineitem no) + * @param $line : This is PO lineitem number + * @return $result : result of the query (returns po lineitem details) */ function getlineitemimport($line){ $this->db->select('POL.LineItemNo,POL.MaterialCode,MM.MaterialName,MM.UOM,POM.POType,POL.Quantity,ser.TotalValue,req.ReqNo,emp.firstname,dep.DepartmentName,emp.Departmentcode,sup.SupplierName,date(POM.DeliveryDate) as DeliveryDate,POM.PODate,POM.SupplierID'); @@ -173,7 +172,7 @@ class assetdetails_model extends CI_Model /** * To get the PO lineitem details for capital po. * @param $line : To get PO lineitem number from the controller - * @return $result : This is result of the query (po lineitem no) + * @return $result : This is result of the query (returns po lineitem details) */ function getlineitemcap($line){ @@ -195,8 +194,8 @@ class assetdetails_model extends CI_Model /** * To get the PO lineitem details revalant po. - * @param $type : To get PO type from the controller - * @return $result : This is result of the query (po lineitem no) + * @param $type : This is PO type + * @return $result : result of the query (returns po lineitem detail) */ function gettyp($type) { @@ -212,9 +211,9 @@ class assetdetails_model extends CI_Model /** * To get the Config value from configuration table - * @param $ConfigID : To get Configid from the controller - * @param $ConfigValue : Optional : To get PO type - * @return array $query->result() : This is result of the query(config details) + * @param $ConfigID : This is Configid + * @param $ConfigValue : Optional : This is PO type + * @return array $query->result() : result of the query(returns config details) */ function getConfigValue($ConfigID ,$ConfigValue = '') { @@ -232,8 +231,8 @@ class assetdetails_model extends CI_Model } /** - * To Store the values - * @param number $asset : To get all the information of asset from the controller + * To Store the asset information + * @param $asset : This have all the asset details datas. * @return $Asset_Code : This will return how many value are inserted (return as number/count) */ function addNewasset($asset) @@ -246,9 +245,9 @@ class assetdetails_model extends CI_Model } /** - * To get Asset details on respective Asset Code - * @param number $Asset_Code : To get asset code from the controller - * @return array $query->result() : This is result of the query(asset data) + * To get Asset details from respective Asset Code + * @param number $Asset_Code : This is asset code + * @return array $query->result() : result of the query(returns asset details) */ function getAssetDetails($Asset_Code) { @@ -266,9 +265,9 @@ class assetdetails_model extends CI_Model } /** - * To Stored edited Asset details in respective Asset Code - * @param number $asset : To get all the information of asset from the controller - * @param number $Asset_Code : To get asset code from the controller + * To Stored edited Asset details from respective Asset Code + * @param $asset : This have all the information of asset + * @param $Asset_Code : This is asset code */ function editasset($asset, $Asset_Code) { @@ -278,9 +277,9 @@ class assetdetails_model extends CI_Model } /** - * To Stored edited Asset details in respective Asset Code - * @param number $asset : To get all the information of asset from the controller - * @param number $Asset_Code : To get asset code from the controller + * To Store edited Asset details in respective Asset Code + * @param $asset : This have all the information of asset details + * @param $Asset_Code : This is asset code * * Note : This function Temporary not in use */ diff --git a/application/models/cashbook_model.php b/application/models/cashbook_model.php index 3ef6f47d..f4e5c608 100755 --- a/application/models/cashbook_model.php +++ b/application/models/cashbook_model.php @@ -2,7 +2,10 @@ class cashbook_model extends CI_Model { - + /** + * To get Account status + * @return array $r->result() : result of the query + */ function getAccounTypes() { $this->db->where('status',1); @@ -11,6 +14,11 @@ class cashbook_model extends CI_Model } + /** + * To get Account status + * @param number $data : This will have all the information of asset details. + * @return array $r : This will return how many value are inserted (return as number/count) + */ function saveIncomeExpense($data) { $this->db->insert('t_income_expense',$data); @@ -18,6 +26,11 @@ class cashbook_model extends CI_Model return $r; } + /** + * To get Income and expense List + * @param number $i : Optional : This is incomeandexpense's id + * @return array $r->result() : result of the query + */ function getIncomeExpenseList($i="") { $this->db->select('t_accountcode.name,T_Employee_Details.FirstName,T_Employee_Details.LastName,t_income_expense.*'); @@ -34,25 +47,35 @@ class cashbook_model extends CI_Model return $r->result(); } + /** + * To get Company details + * @return array $r->result() : result of the query + */ function getCompany() { $r = $this->db->get('T_Company_Details'); - return $r->result(); - - + return $r->result(); } + /** + * To get Account Information + * @param number $i + * @return array $r->result() : result of the query + */ function getAccounutInfo($i) { $this->db->select('t_accountcode.name,t_income_expense.*'); $this->db->from('t_income_expense'); $this->db->join('t_accountcode','t_income_expense.account_code=t_accountcode.code'); - //$this->db->where('t_income_expense.id') $r = $this->db->get(); return $r->result(); } + /** + * To get Account Information + * @return array $result : result of the query + */ function Selectcash() { $this->db->select('*'); @@ -63,6 +86,13 @@ class cashbook_model extends CI_Model } + /** + * To store cashbook Information (its insertion and updation operation) + * @param array $cashbookdatas : this will have all cashbook details + * @var number $res : gets count + * @return array $cbi : result of the query (for insertion) + * @return array $cbu : result of the query (for updation) + */ function Cashbook($cashbookdatas) { $code=$cashbookdatas['code']; diff --git a/application/models/companydetailsmodel.php b/application/models/companydetailsmodel.php index 9cabf1d7..e94e013a 100644 --- a/application/models/companydetailsmodel.php +++ b/application/models/companydetailsmodel.php @@ -3,9 +3,9 @@ class companydetailsmodel extends CI_Model { /** - * To Store the values - * @param number $Company : To get all the information of company - * @return $CompID : This will return how many value are inserted (return as number/count) + * To Store the Company details + * @param array $Company : This have all the company details data + * @return number $CompID : This will return how many value are inserted (return as number/count) */ function Companyadd($Company) { @@ -15,9 +15,9 @@ class companydetailsmodel extends CI_Model } /** - * To Store the values - * @param number $myfile : To get all the information of company's file - * @return $CompID : This will return how many value are inserted (return as number/count) + * To Store Company related files + * @param array $myfile : This have all the company's file datas + * @return number $CompID : This will return how many value are inserted (return as number/count) */ function filedetails($myfile) { @@ -29,7 +29,7 @@ class companydetailsmodel extends CI_Model /** * To get the company files for listing - * @return array $query->result() : This is result of the query (company files's information) + * @return array $query->result() : result of the query (company files's information) */ function filelist() { @@ -41,9 +41,9 @@ class companydetailsmodel extends CI_Model /** * To update the company files as inactive(if deleted means) - * @param number $ID : - * @param number $userInfo : To get all the information of company's files - * @return array $this->db->affected_rows() : This will return how many value are changed (return as number/count) + * @param number $ID : this is file ID + * @param array $userInfo : This have all the company's files information + * @return number $this->db->affected_rows() : This will return how many value are changed (return as number/count) */ function deletefile($ID,$userInfo) { @@ -55,9 +55,9 @@ class companydetailsmodel extends CI_Model /** * To update the company related files information - * @param number $compID : To get the company ID - * @param number $Comp : To get all the modified information of company - * @return array $this->db->last_query() : this will return changes in last executed query + * @param number $compID : This is company ID + * @param array $Comp : This have all the modified company datas + * @return array $this->db->last_query() : This will return changes in last executed query */ function Updatecompany($Comp, $CompID) { @@ -68,9 +68,9 @@ class companydetailsmodel extends CI_Model } /** - * To Check the company images and files. if exists are not - * @param number $Pic: To get the images name from the controller - * @return array $query->result_array() : This is result of the query + * To Check the company images and files are exists are not + * @param number $Pic: This have images name + * @return array $query->result_array() : result of the query */ function checkPhotoExists($Pic) { @@ -113,9 +113,9 @@ class companydetailsmodel extends CI_Model } /** - * To get filedescription information by config value(dropdown for file description) + * To get filedescription information by config value (dropdown for file description) * @param number $Configvalue :Optional : To get config value - * @return $query->result() : This is result of the query (config information) + * @return $query->result() : result of the query (returns config details) */ function getfilename($Configvalue = '') { @@ -129,8 +129,8 @@ class companydetailsmodel extends CI_Model /** - * To get bank details for company. - * @return $result : This is result of the query (bank details) + * To get bank details for company. + * @return array $result : This is result of the query (returns bank details) */ function getBankDetails() { @@ -144,8 +144,9 @@ class companydetailsmodel extends CI_Model /** * To store and modified bank details for company. - * @param array $Bank : To get bank details from the controller using array - * @return array $isExits->result_array() : This is result of the query (bank details) + * @param array $Bank : This will have bank details + * @return array $isExits->result_array() : result of the query (returns bank details count) + * @return number $i : returns count that is how many rows get affected. */ function BankDetails($Bank) { diff --git a/application/models/configmodel.php b/application/models/configmodel.php index 62f3dfe0..22e2aeff 100644 --- a/application/models/configmodel.php +++ b/application/models/configmodel.php @@ -4,71 +4,53 @@ class configmodel extends CI_Model { /** - * This function is used to get the user listing count - * @param string $searchText : This is optional search text - * @param number $page : This is pagination offset - * @param number $segment : This is pagination limit - * @return array $result : This is result + * To get the Config listing + * @return array $result : This is result of the query */ function Configlisting() { - $this->db->select('Config.Config_ID, Config.ConfigName ,Config.Comments,Config.CreatedDate'); - $this->db->from('T_ConfigMaster as Config'); - // $this->db->join('t_configdetails as Con','Con.Config_ID=Config.Config_ID'); - - - $query = $this->db->get(); + $this->db->from('T_ConfigMaster as Config'); + $query = $this->db->get(); $result = $query->result(); - - return $result; + return $result; } + + /** - * This function used to get user information by id - * @param number $userId : This is user id - * @return array $result : This is user information + * To store config master information by configid + * @param number $config : This will have all the config information + * @var $insert_id : This will return how many value are inserted (return as number/count) + * @return array $res->result_array() :This will return maximum of Configid for config lineitem table */ - -function addconfigmaster($config) + function addconfigmaster($config) { $this->db->trans_start(); - $this->db->insert('T_ConfigMaster', $config); - + $this->db->insert('T_ConfigMaster', $config); $insert_id = $this->db->affected_rows(); - $this->db->trans_complete(); - - //return $insert_id; + $sql='SELECT MAX(Config_ID) as Config_ID FROM T_ConfigMaster'; $res = $this->db->query($sql); return $res->result_array(); } - + /** + * To store config details information + * @param number $configvalue : This will have all the config information + * @return array $insert_id : This will return how many value are inserted (return as number/count) + */ function addconfigdetails($configvalue) { - //print_r($configvalue); - // $this->db->trans_start(); - $this->db->insert('T_ConfigDetails', $configvalue); - + $this->db->insert('T_ConfigDetails', $configvalue); $insert_id = $this->db->affected_rows(); - - // $this->db->trans_complete(); - // print_r( $this->db->last_query()); - //print_r ($insert_id);die(); return $insert_id; } - - - - - - - - /* This function used to Department list which is not available in the Costcenter master - * @param number $CostCenterCode : CostCenterCode as Parameter - * @return array $result : This is user information + /** + * To get department list which is not available in the Costcenter master + * @param number $CostCenterCode : This is CostCode + * @return array $query->result() : This is result of the query */ function GetBudgetTypeNotinCostCenter($CostCenterCode,$ConfigID) { @@ -77,48 +59,60 @@ function addconfigmaster($config) (select BudgetType from T_CostCenter_Budget where CostCenterCode=? and BudgetYear=(select max(BudgetYear) from T_CostCenter_Budget)) and Config_ID=?'; $query = $this->db->query($subQuery, array($CostCenterCode,$ConfigID)); - - // print_r($this->db->last_query()); - - return $query->result(); + return $query->result(); } - + + /** + * To get the config master values + * @param number $ConfigID : This is ConfigID + * @return array $query->result() : This is result of the query + */ function GetConfigCenterMaster($ConfigID='') { - //echo $ConfigID ;die(); + $this->db->select('*' ); $this->db->from('T_ConfigMaster '); - //$this->db->join('T_ConfigDetails con','con.Config_ID = COM.Config_ID','left'); - $this->db->where('Config_ID', $ConfigID); - - + $this->db->where('Config_ID', $ConfigID); $query = $this->db->get(); - return $query->result(); } - + + /** + * To get the config detail values + * @param number $ConfigID : This is ConfigID + * @return array $query->result() : This is result of the query (config master information) + */ function GetConfigCenterDetails($ConfigID='') { - //echo $ConfigID ;die(); + $this->db->select('*' ); $this->db->from('T_ConfigMaster COM'); $this->db->join('T_ConfigDetails con','con.Config_ID = COM.Config_ID','left'); - $this->db->where('COM.Config_ID', $ConfigID); $query = $this->db->get(); return $query->result(); } - + + /** + * To update the config master information + * @param number $configid : This is ConfigID + * @param array $Config : This will have all the edited config information + */ function updateconfig($config,$Configid) { - $this->db->where('Config_ID', $Configid); - + $this->db->where('Config_ID', $Configid); $this->db->update('T_ConfigMaster', $config); return TRUE; } + + /** + * To update the config detail information + * @param number $Key : This is key value + * @param array $Configval : This will have all the edited config information + */ function updateconfigvalue($configval,$Key) { $this->db->where('Key', $Key); @@ -128,36 +122,55 @@ function addconfigmaster($config) return TRUE; } - + /** + * To store the costcenters budget detail + * @param number $Budget : This will have all edited budget datas + * @return number $insert_id : This will return how many value are inserted (return as number/count) + */ function EditBudget($Budget) { $this->db->trans_start(); $this->db->insert('T_CostCenter_Budget', $Budget); - $insert_id = $this->db->affected_rows(); - $this->db->trans_complete(); - // print_r( $this->db->last_query()); + return $insert_id; } - + + /** + * To delete costcenter's budget information by using budget type , budget year and costcenter id + * @param number $BudgetType : This is budget type + * @param number $BudgetYear : This is budget year + * @param number $CostCenterCode : This is cost code + */ function DeleteBudget($BudgetType='',$BudgetYear='',$CostCenterCode ='') { - $this->db->where("BudgetType", $BudgetType); + $this->db->where("BudgetType", $BudgetType); $this->db->where("BudgetYear", $BudgetYear); $this->db->where("CostCenterCode", $CostCenterCode); $this->db->delete('T_CostCenter_Budget'); - //print_r( $this->db->last_query()); + } - + + /** + * To delete costcenter's department information by using department code and costcenter id + * @param number $Depcode : Optional : This is department code + * @param number $CostCode : Optional :This is costcenter code + */ function DeleteDepartment($DepCode='',$CostCode='') { - $this->db->where("DEPCode", $DepCode); + $this->db->where("DEPCode", $DepCode); $this->db->where("CostCenterCode", $CostCode); $this->db->delete('T_CostCenter_Departments'); - //print_r( $this->db->last_query()); + } - + + /** + * To get costcenter department information by using department code and costcenter id + * @param number $Depcode : Optional : This is department code + * @param number $CostCode : Optional : This is cost code + * @return array $query->result_array() : This is result of the query (config master information) + */ function checkDeptCostExists($DepCode='',$CostCode='') { $this->db->select('CostCenterCode,DEPCode'); @@ -174,15 +187,16 @@ function addconfigmaster($config) /** - * This function is used to get the Config value from configuration table + * To get the Config value from configuration table + * @param number @ConfigID : This is ConfigID * @return array $result : This is result of the query */ - function getConfigValue($ConfigID ) + function getConfigValue($ConfigID) { $this->db->select('ConfigValue'); $this->db->from('T_ConfigDetails'); - $this->db->where('Config_id ',$ConfigID ); + $this->db->where('Config_id ',$ConfigID ); $query = $this->db->get(); return $query->result(); diff --git a/application/models/costcenter_model.php b/application/models/costcenter_model.php index 7ca4e2ce..96f6c047 100644 --- a/application/models/costcenter_model.php +++ b/application/models/costcenter_model.php @@ -4,11 +4,8 @@ class costcenter_model extends CI_Model { /** - * This function is used to get the user listing count - * @param string $searchText : This is optional search text - * @param number $page : This is pagination offset - * @param number $segment : This is pagination limit - * @return array $result : This is result + * To get the Cost listing + * @return array $result : This is result of the query */ function CostListing() { @@ -17,30 +14,31 @@ class costcenter_model extends CI_Model $this->db->from('T_CostCenter_Master as Cost'); $this->db->join('T_Employee_Details as Emp', 'Emp.EmpID=Cost.ApprovedBy'); - - $query = $this->db->get(); + $query = $this->db->get(); $result = $query->result(); - return $result; + return $result; } + /** - * This function used to get user information by id - * @param number $userId : This is user id - * @return array $result : This is user information + * To store cost information by id + * @param number $Cost : This will have cost + * @return number $insert_id : This will return how many value are inserted */ - -function addNewcost($Cost) + function addNewcost($Cost) { $this->db->trans_start(); - $this->db->insert('T_CostCenter_Master', $Cost); - + $this->db->insert('T_CostCenter_Master', $Cost); $insert_id = $this->db->affected_rows(); - $this->db->trans_complete(); return $insert_id; } + /** + * To get fiscalyear information from company table + * @return $query->result() : This is result of the query + */ function getFiscalYear() { $this->db->select('year(FiscalYearStartOn) as StartYear,year(FiscalYearEndsOn) as EndYear'); @@ -50,20 +48,27 @@ function addNewcost($Cost) return $query->result(); } - + + /** + * To store costcenter department information + * @param array $Dept : This will have all the information of costcenter's department + * @return number $insert_id : This will return how many value are inserted (return as number/count) + */ function addCostCenterDepartment($Dept) { $this->db->trans_start(); $this->db->insert('T_CostCenter_Departments', $Dept); - $insert_id = $this->db->affected_rows(); - $this->db->trans_complete(); - // print_r( $this->db->last_query()); - return $insert_id; + + return $insert_id; } - + /** + * To store costcenter Budget information + * @param array $Budget : this will have all the information of costcenter's department + * @return number $insert_id : This will return how many value are inserted (return as number/count) + */ function addBudget($Budget) { $this->db->trans_start(); @@ -72,10 +77,14 @@ function addNewcost($Cost) $insert_id = $this->db->affected_rows(); $this->db->trans_complete(); - // print_r( $this->db->last_query()); + return $insert_id; } - + + /** + * To get approver name by using department code + * @return array $query->result() : result of the query + */ function getApproverName() { $this->db->select('EmpID,FirstName,LastName,Designation'); @@ -88,15 +97,14 @@ function addNewcost($Cost) } /** - * This function used to get user information by id - * @param number $userId : This is user id - * @return array $result : This is user information + * To get costcenter information by id + * @param number $CostcenterID : This is cost center code + * @return array $query->result() : This is result of the query */ function getuserInfo($CostCenterID) { $this->db->select('CostCentreID, CostName,Description,CreatedDate'); $this->db->from('T_CostCentre'); - $this->db->where('CostCentreID', $CostCenterID); $query = $this->db->get(); @@ -104,15 +112,15 @@ function addNewcost($Cost) } /** * This function used to get Cost center Master information by Cost center ID - * @param number $CostCenterCode : CostCenterCode as Parameter - * @return array $result : This is user information + * @param number $CostCenterCode : This is CostCenterCode as Parameter + * @return array $query->result() : This is result of the query (Costcenter master information) */ function GetCostCenterMaster($CostCenterCode) { $this->db->select('Cost.CostCenterCode,Cost.CostCenterName,Cost.ApprovedBy,emp.FirstName,emp.Designation,max(BudgetYear) as BudYear' ); $this->db->from('T_CostCenter_Master Cost'); - $this->db->join('T_Employee_Details emp', 'emp.EmpID = Cost.ApprovedBy'); - $this->db->join('T_CostCenter_Budget Bud', ' Bud.CostCenterCode = Cost.CostCenterCode'); + $this->db->join('T_Employee_Details emp', 'emp.EmpID = Cost.ApprovedBy'); + $this->db->join('T_CostCenter_Budget Bud', ' Bud.CostCenterCode = Cost.CostCenterCode'); $this->db->where('Cost.CostCenterCode', $CostCenterCode); $query = $this->db->get(); @@ -120,40 +128,41 @@ function addNewcost($Cost) } /** - * This function used to get Cost center Department information by Cost center ID - * @param number $CostCenterCode : CostCenterCode as Parameter - * @return array $result : This is user information + * To get Cost center Department information by Cost center ID + * @param number $CostCenterCode : This is the CostCenterCode as Parameter + * @return array $query->result() : This is result of the query */ function GetCostCenterDepartment($CostCenterCode) { $this->db->select('Dept.DEPCode,Det.DepartmentName'); $this->db->from('T_CostCenter_Departments Dept'); - $this->db->join('T_DepartmentDetails Det', 'Det.DEPCode = Dept.DEPCode'); - + $this->db->join('T_DepartmentDetails Det', 'Det.DEPCode = Dept.DEPCode'); $this->db->where('Dept.CostCenterCode', $CostCenterCode); + $query = $this->db->get(); return $query->result(); } + /** - * This function used to get Cost center Budget information by Cost center ID - * @param number $CostCenterCode : CostCenterCode as Parameter - * @return array $result : This is user information + * To get Cost center Budget year information by Cost center ID + * @param number $CostCenterCode : This is CostCenterCode as Parameter + * @return array $query->result() : This is result of the query */ function GetBudgetYear($CostCenterCode) { $subQuery = 'select BudgetYear from T_CostCenter_Budget where CostCenterCode=? '; - $query = $this->db->query($subQuery, array($CostCenterCode)); return $query->result(); } + /** - * This function used to get Cost center Budget information by Cost center ID - * @param number $CostCenterCode : CostCenterCode as Parameter - * @return array $result : This is user information + * To get Cost center Budget information by Cost center ID + * @param number $CostCenterCode : This is CostCenterCode as Parameter + * @return array $query->result() : This is user information */ function GetCostCenterBudget($CostCenterCode) { @@ -161,15 +170,17 @@ function addNewcost($Cost) $subQuery = 'select BudgetType,BudgetYear,BudgetAmount,Remarks from T_CostCenter_Budget where CostCenterCode=? and BudgetYear=(select max(BudgetYear) from T_CostCenter_Budget where CostCenterCode=?)'; - $query = $this->db->query($subQuery, array($CostCenterCode,$CostCenterCode)); return $query->result(); } + /** - * This function used to get Cost center Budget information by Cost center ID - * @param number $CostCenterCode : CostCenterCode as Parameter - * @return array $result : This is user information + * To get Cost center Budget information by Cost center ID + * @param number $CostCenterCode : This is CostCenterCode as Parameter + * @param number $ConfigID : This is Config Id + * @param number $Year : This is budget year + * @return array $query->result_array() : This is result of the query */ function GetCostBudgetTypeByYear($CostCenterCode,$ConfigID,$Year) { @@ -179,31 +190,32 @@ function addNewcost($Cost) $query = $this->db->query($subQuery, array($CostCenterCode,$Year,$ConfigID)); - - return $query->result_array(); + return $query->result_array(); } + /** - * This function used to get Cost center Budget information by Cost center ID - * @param number $CostCenterCode : CostCenterCode as Parameter - * @return array $result : This is user information + * To get Cost center Budget information by Cost center ID and budget year + * @param number $CostCenterCode : This is CostCenterCode as Parameter + * @param number $Year : This is Budget year + * @return array $query->result_array() : This is result of the query */ + function GetCostCenterBudgetByYear($CostCenterCode,$Year) { $subQuery = 'select BudgetType,BudgetYear,BudgetAmount,Remarks from T_CostCenter_Budget where CostCenterCode=? and budgetyear=?'; - $query = $this->db->query($subQuery, array($CostCenterCode,$Year)); - return $query->result_array(); + return $query->result_array(); } /** - * This function used to Department list which is not available in the Costcenter master + * To get Department list which is not available in the Costcenter master * @param number $CostCenterCode : CostCenterCode as Parameter - * @return array $result : This is user information + * @return array $result : This is result of the query */ function GetDepartmentNotinCostCenter($CostCenterCode) { @@ -220,9 +232,10 @@ function addNewcost($Cost) /** - * This function used to Department list which is not available in the Costcenter master - * @param number $CostCenterCode : CostCenterCode as Parameter - * @return array $result : This is user information + * To get Department list which is not available in the Costcenter master based on cost code and config id + * @param number $CostCenterCode : This is CostCenterCode as Parameter + * @param number $ConfigID : This is ConfigID as Parameter + * @return array $query->result() : This is result of the query */ function GetBudgetTypeNotinCostCenter($CostCenterCode,$ConfigID) { @@ -232,11 +245,14 @@ function addNewcost($Cost) $query = $this->db->query($subQuery, array($CostCenterCode,$ConfigID)); - // print_r($this->db->last_query()); - - return $query->result(); + + return $query->result(); } - + + /** + * To store edited the Costcenter master + * @param number $CostCenterCode : This have all the edited CostCenter datas + */ function EditCost($Cost,$CostCenterCode) { $this->db->where('CostCenterCode', $CostCenterCode); @@ -246,7 +262,11 @@ function addNewcost($Cost) return TRUE; } - + /** + * To store the Costcenter budget by costcenter's budget + * @param number $Budget : This will have all the budget details + * @return number $insert_id : This is result of the query + */ function EditBudget($Budget) { $this->db->trans_start(); @@ -255,30 +275,45 @@ function addNewcost($Cost) $insert_id = $this->db->affected_rows(); $this->db->trans_complete(); - // print_r( $this->db->last_query()); + return $insert_id; } - + + /** + * To delete the Costcenter budget + * @param string $BudgetType : Optional : This is Budgettype as Parameter + * @param number $BudgetYear : Optional : This is Budgetyear as Parameter + * @param number $CostCenterCode : Optional : This is Costcenter as parameter + */ function DeleteBudget($BudgetType='',$BudgetYear='',$CostCenterCode ='') { - $this->db->where("BudgetType", $BudgetType); + $this->db->where("BudgetType", $BudgetType); $this->db->where("BudgetYear", $BudgetYear); $this->db->where("CostCenterCode", $CostCenterCode); $this->db->delete('T_CostCenter_Budget'); - //print_r( $this->db->last_query()); + } - + + /** + * To delete the Costcenter department + * @param number $Depcode : Optional : This is Depcode as Parameter + * @param number $CostCode : Optional : This is Costcenter as parameter + */ function DeleteDepartment($DepCode='',$CostCode='') { - // echo "fsds"; - // die(); $this->db->where("DEPCode", $DepCode); - $this->db->where("CostCenterCode", $CostCode); - $this->db->delete('T_CostCenter_Departments'); - //print_r( $this->db->last_query()); + $this->db->where("CostCenterCode", $CostCode); + $this->db->delete('T_CostCenter_Departments'); + } - + + /** + * To check the costcenter if department details is already exists are not + * @param number $Depcode : Optional : This is Depcode as Parameter + * @param number $CostCode : Optional : This is Costcenter as parameter + * @return array $query->result_array() : result of the query + */ function checkDeptCostExists($DepCode='',$CostCode='') { $this->db->select('CostCenterCode,DEPCode'); @@ -292,6 +327,13 @@ function addNewcost($Cost) return $query->result_array(); } } + + /** + * To check costcenter is already exists are not + * @param number $Depcode : Optional : This is Depcode as Parameter + * @param number $CostCode : Optional : This is Costcenter as parameter + * @return array $query->result_array() : result of the query + */ function checkCostDetailsExists($Code='',$CostName='') { $this->db->select('CostCenterCode'); @@ -307,9 +349,9 @@ function addNewcost($Cost) return $query->result_array(); } } - /* *//** - * This function is used to get the Department details from T_DepartmentDetails - * @return array $result : This is result of the query + /** + * To get the Department details from T_DepartmentDetails + * @return array $query->result() : This is result of the query */ function getDepartment() { @@ -320,21 +362,26 @@ function addNewcost($Cost) return $query->result(); } + /** * This function is used to get the Config value from configuration table - * @return array $result : This is result of the query + * @param number $ConfigID : This is ConfigID as parameter + * @return array $result : result of the query */ function getConfigValue($ConfigID ) { $this->db->select('ConfigValue'); $this->db->from('T_ConfigDetails'); - $this->db->where('Config_id ',$ConfigID ); + $this->db->where('Config_id ',$ConfigID ); $query = $this->db->get(); return $query->result(); } - + + /** + * To get costcenter's information for export xl + */ function export_excel(){ $where = null; @@ -356,13 +403,19 @@ function addNewcost($Cost) return $this->db->get('T_CostCenter_Master as bud')->result_array(); } - //get exist budget year details + /** + * To check the costcenter if budget year details is already exists are not + * @param string $BudgetType : This is budget type + * @param number $BudgetYear : This is budget year + * @param number $CostCode : This is cost code + */ function CheckExistBudget($BudgetType,$BudgetYear,$CostCode){ - $this->db->select('CostCenterCode'); - $this->db->from('T_CostCenter_Budget'); + + $this->db->select('CostCenterCode'); + $this->db->from('T_CostCenter_Budget'); $this->db->where('CostCenterCode',$CostCode); - $this->db->where('BudgetType',$BudgetType); - $this->db->where('BudgetYear',$BudgetYear); + $this->db->where('BudgetType',$BudgetType); + $this->db->where('BudgetYear',$BudgetYear); $query = $this->db->get(); @@ -374,13 +427,18 @@ function addNewcost($Cost) } } - //update budget + /** + * To update Costcenter Budget Details + * @param array $Budget : This will have all the edited datas of costcenter's budget + * @param string $BudgetType : This is budget type + * @param number $BudgetYear : This is budget year + * @param number $CostCode : This is Cost code + */ function updateBudget($Budget,$BudgetType,$BudgetYear,$CostCode) { $this->db->where('CostCenterCode',$CostCode); - $this->db->where('BudgetType',$BudgetType); - $this->db->where('BudgetYear',$BudgetYear); - + $this->db->where('BudgetType',$BudgetType); + $this->db->where('BudgetYear',$BudgetYear); $this->db->update('T_CostCenter_Budget', $Budget); return TRUE; } diff --git a/application/models/dahsboard_model.php b/application/models/dahsboard_model.php index 7bf0c338..a3b5bb7e 100755 --- a/application/models/dahsboard_model.php +++ b/application/models/dahsboard_model.php @@ -129,7 +129,7 @@ where att.Month_Year = ? and att.EmpID = ?;"; function totalpurchaseorder(){ - $sql="select count(PONO) as totalpurchaseorder from T_PurchaseOrder_Master"; + $sql="select count(PONO) as totalpurchaseorder from T_PurchaseOrder_Master where Status != 'ST030'"; $query = $this->db->query($sql); return $query->result(); @@ -137,7 +137,7 @@ where att.Month_Year = ? and att.EmpID = ?;"; function totalordervalue(){ - $sql="select sum(totalordervalue) as totalordervalue from T_PurchaseOrder_Master"; + $sql="select sum(totalordervalue) as totalordervalue from T_PurchaseOrder_Master where Status != 'ST030'"; $query = $this->db->query($sql); return $query->result(); @@ -145,11 +145,36 @@ where att.Month_Year = ? and att.EmpID = ?;"; function pendingpo(){ - $sql="select count(PONO) as pending from T_PurchaseOrder_Master where status='ST020'"; + $sql="select count(PONO) as pending from T_PurchaseOrder_Master where status='ST020' and Status != 'ST030'"; $query = $this->db->query($sql); return $query->result(); } + function req_pending(){ + + + $sql="SELECT count(Status) as TOTAL_PENDING_REQUESTS FROM T_Requestion_Master where Status = 'ST002';"; + $query = $this->db->query($sql); + return $query->result(); + + + + } + function reqdetail(){ + + + $sql="SELECT count(Status) as TODAY_REQUESTS FROM T_Requestion_Master where date(ReqDate) = date(now());"; + + $query = $this->db->query($sql); + + // echo "from Model"; + // print_r($query->result()); + + return $query->result(); + + + + } function january(){ @@ -158,41 +183,51 @@ where att.Month_Year = ? and att.EmpID = ?;"; return $query->result(); } - function totalserviceamount() - { - $sql="select sum(BudgetAmount) as totalserviceamount from T_CostCenter_Budget where BudgetType='SERVICE'"; - $query = $this->db->query($sql); - return $query->result(); + // function totalserviceamount() + // { + // $sql="select sum(BudgetAmount) as totalserviceamount from T_CostCenter_Budget where BudgetType='SERVICE'"; + // $query = $this->db->query($sql); + // return $query->result(); - } - function totalcapitalamount() - { - $sql="select sum(BudgetAmount) as totalcapitalamount from T_CostCenter_Budget where BudgetType='CAPITAL'"; - $query = $this->db->query($sql); - return $query->result(); -} -function totalimportamount() - { - $sql="select sum(BudgetAmount) as totalimportamount from T_CostCenter_Budget where BudgetType='IMPORT'"; - $query = $this->db->query($sql); - return $query->result(); -} -function totalrevenueamount() - { - $sql="select sum(BudgetAmount) as totalrevenueamount from T_CostCenter_Budget where BudgetType='REVENUE'"; - $query = $this->db->query($sql); - return $query->result(); -} + // } + // function totalcapitalamount() + // { + // $sql="select sum(BudgetAmount) as totalcapitalamount from T_CostCenter_Budget where BudgetType='CAPITAL'"; + // $query = $this->db->query($sql); + // return $query->result(); +// } +// function totalimportamount() + // { + // $sql="select sum(BudgetAmount) as totalimportamount from T_CostCenter_Budget where BudgetType='IMPORT'"; + // $query = $this->db->query($sql); + // return $query->result(); +// } +// function totalrevenueamount() + // { + // $sql="select sum(BudgetAmount) as totalrevenueamount from T_CostCenter_Budget where BudgetType='REVENUE'"; + // $query = $this->db->query($sql); + // return $query->result(); +// } //totalservice function getTotalServicePoCount(){ $i=1; - + if (date('m') >= 4) + { + $yearl = date('Y').'-'.(date('Y')+1); + } else { + $yearl = (date('Y')-1).'-'.date('Y'); + } + $ab=$yearl; + $fa=substr($ab,0,-5); + $aa=substr($ab,5,5); while($i<=12){ + $sql="SELECT count(cmast.PONO) as totalService FROM T_PurchaseOrder_Master cmast - join T_PurchaseOrder_LineItem line on line.PONO=cmast.PONO - join T_Requestion_Master req on req.ReqNo=line.ReqNo - where ReqType='SERVICE' and month(PODate) = $i "; + left join T_PurchaseOrder_LineItem line on line.PONO=cmast.PONO + left join T_Requestion_Master req on req.ReqNo=line.ReqNo + where ReqType='SERVICE' and month(PODate) = $i + and date(cmast.PODate) >= '".$fa."-04-01' and date(cmast.PODate) <= '".$aa."-03-31'"; $query = $this->db->query($sql); $array_result[]=$query->result(); @@ -206,13 +241,23 @@ $i++; function getTotalimportPoCount(){ $i=1; - + if (date('m') >= 4) + { + $yearl = date('Y').'-'.(date('Y')+1); + } else { + $yearl = (date('Y')-1).'-'.date('Y'); + } + $ab=$yearl; + $fa=substr($ab,0,-5); + $aa=substr($ab,5,5); while($i<=12){ + $sql="SELECT count(cmast.PONO) as totalImport FROM T_PurchaseOrder_Master cmast - join T_PurchaseOrder_LineItem line on line.PONO=cmast.PONO - join T_Requestion_Master req on req.ReqNo=line.ReqNo - where ReqType='IMPORT' and month(PODate) = $i "; + left join T_PurchaseOrder_LineItem line on line.PONO=cmast.PONO + left join T_Requestion_Master req on req.ReqNo=line.ReqNo + where ReqType='IMPORT' and month(PODate) = $i + and date(cmast.PODate) >= '".$fa."-04-01' and date(cmast.PODate) <= '".$aa."-03-31'"; $query = $this->db->query($sql); $array_result[]=$query->result(); @@ -225,13 +270,22 @@ $i++; } function getTotalcapitalPoCount(){ $i=1; - + if (date('m') >= 4) + { + $yearl = date('Y').'-'.(date('Y')+1); + } else { + $yearl = (date('Y')-1).'-'.date('Y'); + } + $ab=$yearl; + $fa=substr($ab,0,-5); + $aa=substr($ab,5,5); while($i<=12){ $sql="SELECT count(cmast.PONO) as totalcapital FROM T_PurchaseOrder_Master cmast - join T_PurchaseOrder_LineItem line on line.PONO=cmast.PONO - join T_Requestion_Master req on req.ReqNo=line.ReqNo - where ReqType='CAPITAL' and month(PODate) = $i "; + left join T_PurchaseOrder_LineItem line on line.PONO=cmast.PONO + left join T_Requestion_Master req on req.ReqNo=line.ReqNo + where ReqType='CAPITAL' and month(PODate) = $i + and date(cmast.PODate) >= '".$fa."-04-01' and date(cmast.PODate) <= '".$aa."-03-31'"; $query = $this->db->query($sql); $array_result[]=$query->result(); @@ -244,13 +298,22 @@ $i++; } function getTotalrevenuePoCount(){ $i=1; - + if (date('m') >= 4) + { + $yearl = date('Y').'-'.(date('Y')+1); + } else { + $yearl = (date('Y')-1).'-'.date('Y'); + } + $ab=$yearl; + $fa=substr($ab,0,-5); + $aa=substr($ab,5,5); while($i<=12){ $sql="SELECT count(cmast.PONO) as totalrevenue FROM T_PurchaseOrder_Master cmast - join T_PurchaseOrder_LineItem line on line.PONO=cmast.PONO - join T_Requestion_Master req on req.ReqNo=line.ReqNo - where ReqType='REVENUE' and month(PODate) = $i "; + left join T_PurchaseOrder_LineItem line on line.PONO=cmast.PONO + left join T_Requestion_Master req on req.ReqNo=line.ReqNo + where ReqType='REVENUE' and month(PODate) = $i + and date(cmast.PODate) >= '".$fa."-04-01' and date(cmast.PODate) <= '".$aa."-03-31'"; $query = $this->db->query($sql); $array_result[]=$query->result(); @@ -364,17 +427,14 @@ function capitalbud () function capitalbal () { $sql="SELECT ROUND(sum(BudgetAmount)-(SELECT -case po.CapitalRange - when '0' - then ifnull((sum(distinct(PO_Line_Item.Quantity * PO_Line_Item.Rate) * po.ExchangeRate)),0) - when '1' - then ifnull((sum(distinct PO_Line_Item.Quantity * PO_Line_Item.Rate)),0) - end +ifnull(sum(distinct if(CapitalRange=0,(( PO_Line_Item.Quantity * PO_Line_Item.Rate) * po.ExchangeRate),( PO_Line_Item.Quantity * PO_Line_Item.Rate) - st.Afterdiscountval)),0) as Util_Amount from T_CostCenter_Budget Cost_Center_Budget join T_PurchaseOrder_LineItem PO_Line_Item on Cost_Center_Budget.CostCenterCode=PO_Line_Item.CostCenterCode -JOIN T_PurchaseOrder_Master po on po.PONO=PO_Line_Item.PONO and po.POType=Cost_Center_Budget.BudgetType -WHERE Cost_Center_Budget.BudgetType='CAPITAL' and YEAR(STR_TO_DATE(`BudgetYear`,'%Y')) = YEAR(NOW())),2) as balcapitalbudget FROM T_CostCenter_Budget where BudgetType ='CAPITAL' and YEAR(STR_TO_DATE(`BudgetYear`,'%Y')) = YEAR(NOW())"; +JOIN T_PurchaseOrder_Master po on po.PONO=PO_Line_Item.PONO and po.POType=Cost_Center_Budget.BudgetType and po.Status !='ST030' +left JOIN T_Service_Tax st on st.LineItemNo = PO_Line_Item.LineItemNo +WHERE Cost_Center_Budget.BudgetType='CAPITAL' and YEAR(STR_TO_DATE(`BudgetYear`,'%Y')) = YEAR(NOW())),2) as balcapitalbudget FROM T_CostCenter_Budget where BudgetType ='CAPITAL' and YEAR(STR_TO_DATE(`BudgetYear`,'%Y')) = YEAR(NOW()) +"; $query = $this->db->query($sql); return $query->result(); } @@ -413,32 +473,8 @@ WHERE Cost_Center_Budget.BudgetType='REVENUE' and YEAR(STR_TO_DATE(`BudgetYear`, $query = $this->db->query($sql); return $query->result(); } -function reqdetail(){ - - - $sql="SELECT count(Status) as TODAY_REQUESTS FROM T_Requestion_Master where date(ReqDate) = date(now());"; - $query = $this->db->query($sql); - - // echo "from Model"; - // print_r($query->result()); - - return $query->result(); - - - - } - - function req_pending(){ - - - $sql="SELECT count(Status) as TOTAL_PENDING_REQUESTS FROM T_Requestion_Master where Status = 'ST002';"; - $query = $this->db->query($sql); - return $query->result(); - - - - } + function req_list(){ @@ -461,7 +497,7 @@ function reqdetail(){ function report_relpo(){ - $sql="select Mast.PONO,Mast.POType,date_format(Mast.PODate,'%d-%m-%Y') as CreatedDate,date_format(Mast.ReleasedOn,'%d-%m-%Y') as ReleasedDate,Dept_Details.DepartmentName As Dept_Name,Mast.TotalOrderValue + $sql="select Mast.PONO,Mast.POType,date_format(Mast.PODate,'%d-%m-%Y') as PODate,date_format(Mast.ReleasedOn,'%d-%m-%Y') as ReleasedDate,Dept_Details.DepartmentName As Dept_Name,Mast.TotalOrderValue from T_PurchaseOrder_Master Mast JOIN T_PurchaseOrder_LineItem Det on Det.PONO=Mast.PONO JOIN T_Requestion_Master as Req on Req.ReqNo=Det.ReqNo @@ -482,7 +518,7 @@ group by Mast.PONO"; function report_openpending(){ - $sql="select Mast.PONO as PONO,Mast.POType as POType,date_format(Mast.PODate,'%d-%m-%Y') as CreatedDate,date_format(Mast.ApprovedOn,'%d-%m-%Y') as ApprovedDate,Dept_Details.DepartmentName As Dept_Name,Mast.TotalOrderValue + $sql="select Mast.PONO as PONO,Mast.POType as POType,date_format(Mast.PODate,'%d-%m-%Y') as PODate,date_format(Mast.ApprovedOn,'%d-%m-%Y') as ApprovedDate,Dept_Details.DepartmentName As Dept_Name,Mast.TotalOrderValue from T_PurchaseOrder_Master Mast JOIN T_PurchaseOrder_LineItem Det on Det.PONO=Mast.PONO JOIN T_Requestion_Master as Req on Req.ReqNo=Det.ReqNo @@ -603,12 +639,13 @@ group by po.SupplierID,pl.MaterialCode"; $sql="select -DATE_FORMAT(IF(matv.CreatedDate = '0000-00-00', NOW(), matv.CreatedDate), '%b-%Y') AS Month, -matv.MaterialCode,mat.MaterialName,mat.UOM,ROUND(AVG(matv.Rate),2) as Average_Rate -from T_MaterialItem_PO matv -join T_MaterialMaster mat on matv.MaterialCode=mat.MaterialCode -group by matv.MaterialCode -order by monthname(matv.CreatedDate)"; + DATE_FORMAT(IF(pm.PODate = '0000-00-00', NOW(), pm.PODate), '%b-%Y') AS Month, + matv.MaterialCode,mat.MaterialName,mat.UOM,ROUND(AVG(matv.Rate),2) as Average_Rate + from T_MaterialItem_PO matv + join T_PurchaseOrder_Master pm on pm.CreatedDate = matv.CreatedDate + join T_MaterialMaster mat on matv.MaterialCode=mat.MaterialCode + group by matv.MaterialCode + order by monthname(pm.PODate)"; $query = $this->db->query($sql); return $query->result(); @@ -618,7 +655,7 @@ order by monthname(matv.CreatedDate)"; function report_purchase($cname,$prod,$fa,$aa,$m,$frm,$t){ - $sql="SELECT pm.PONO as pono,date_format(pm.PODate,'%d-%m-%Y') as created_date, + $sql="SELECT pm.PONO as pono,pm.POType as potype,date_format(pm.PODate,'%d-%m-%Y') as created_date, TIME_FORMAT(pm.PODate,'%l:%i %p') as created_time, mm.MaterialName as material_name,sd.SupplierName as supplier_name, ifnull(sum(pl.Quantity),0) as quantity,mm.UOM as UOM,ifnull(sum(pl.Rate),0) as rate, @@ -692,7 +729,7 @@ $sql.="group by pono,material_name,supplier_name"; function report_purchase_link($cname,$prod,$fa,$aa,$m,$frm,$t,$sid,$mid,$d){ - $sql="SELECT pm.PONO as pono,date_format(pm.PODate,'%d-%m-%Y') as created_date, + $sql="SELECT pm.PONO as pono,pm.POType as potype,date_format(pm.PODate,'%d-%m-%Y') as created_date, TIME_FORMAT(pm.PODate,'%l:%i %p') as created_time, mm.MaterialName as material_name,sd.SupplierName as supplier_name, ifnull(sum(pl.Quantity),0) as quantity,mm.UOM as UOM,ifnull(sum(pl.Rate),0) as rate, @@ -1077,7 +1114,7 @@ group by supplier_name,material_name"; function ireport_purchase($cname,$prod,$fa,$aa,$m,$frm,$t,$cat){ - $sql="SELECT pm.PONO as pono,date_format(pm.PODate,'%d-%m-%Y') as created_date, + $sql="SELECT pm.PONO as pono,pm.POType as potype,date_format(pm.PODate,'%d-%m-%Y') as created_date, TIME_FORMAT(pm.PODate,'%l:%i %p') as created_time, mm.MaterialName as material_name,mm.Category as category,sd.SupplierName as supplier_name, ifnull(sum(pl.Quantity),0) as quantity,mm.UOM as UOM,ifnull(sum(pl.Rate),0) as rate, @@ -1155,7 +1192,7 @@ $sql.="group by pono,material_name,category,supplier_name"; function ireport_purchase_link($cname,$prod,$fa,$aa,$m,$frm,$t,$sid,$mid,$d,$cat){ - $sql="SELECT pm.PONO as pono,date_format(pm.PODate,'%d-%m-%Y') as created_date, + $sql="SELECT pm.PONO as pono,pm.POType as potype,date_format(pm.PODate,'%d-%m-%Y') as created_date, TIME_FORMAT(pm.PODate,'%l:%i %p') as created_time, mm.MaterialName as material_name,mm.Category as category,sd.SupplierName as supplier_name, ifnull(sum(pl.Quantity),0) as quantity,mm.UOM as UOM,ifnull(sum(pl.Rate),0) as rate, @@ -1524,10 +1561,10 @@ left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID where pm.Status != 'ST030' and pm.Status = 'ST056' and pm.PONO in (select PONO from T_IGR_Master) and case - when (month(pm.CreatedDate) >=4) then - (YEAR(pm.CreatedDate) = YEAR(CURRENT_DATE) and MONTH(pm.CreatedDate) >= 4 ) or ( YEAR(pm.CreatedDate) = YEAR(CURRENT_DATE)+1 and MONTH(pm.CreatedDate) <= 3 ) + when (month(pm.PODate) >=4) then + (YEAR(pm.PODate) = YEAR(CURRENT_DATE) and MONTH(pm.PODate) >= 4 ) or ( YEAR(pm.PODate) = YEAR(CURRENT_DATE)+1 and MONTH(pm.PODate) <= 3 ) else - (YEAR(pm.CreatedDate) = YEAR(CURRENT_DATE)-1 and MONTH(pm.CreatedDate) >= 4 ) or ( YEAR(pm.CreatedDate) = YEAR(CURRENT_DATE) and MONTH(pm.CreatedDate) <= 3 ) + (YEAR(pm.PODate) = YEAR(CURRENT_DATE)-1 and MONTH(pm.PODate) >= 4 ) or ( YEAR(pm.PODate) = YEAR(CURRENT_DATE) and MONTH(pm.PODate) <= 3 ) end group by category ) as year left join @@ -1537,7 +1574,7 @@ left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID where pm.Status != 'ST030' and pm.Status = 'ST056' and pm.PONO in (select PONO from T_IGR_Master) and -month(pm.CreatedDate) = month(current_date()) +month(pm.PODate) = month(current_date()) group by category ) as month on month.category=year.category left join @@ -1547,7 +1584,7 @@ left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID where pm.Status != 'ST030' and pm.Status = 'ST056' and pm.PONO in (select PONO from T_IGR_Master) and -date(pm.CreatedDate) = current_date() +date(pm.PODate) = current_date() group by category ) as today on today.category=month.category group by category "; @@ -1563,10 +1600,10 @@ left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID where pm.Status != 'ST030' and pm.Status = 'ST056' and pm.PONO in (select PONO from T_IGR_Master) and case - when (month(pm.CreatedDate) >=4) then - (YEAR(pm.CreatedDate) = YEAR(CURRENT_DATE) and MONTH(pm.CreatedDate) >= 4 ) or ( YEAR(pm.CreatedDate) = YEAR(CURRENT_DATE)+1 and MONTH(pm.CreatedDate) <= 3 ) + when (month(pm.PODate) >=4) then + (YEAR(pm.PODate) = YEAR(CURRENT_DATE) and MONTH(pm.PODate) >= 4 ) or ( YEAR(pm.PODate) = YEAR(CURRENT_DATE)+1 and MONTH(pm.PODate) <= 3 ) else - (YEAR(pm.CreatedDate) = YEAR(CURRENT_DATE)-1 and MONTH(pm.CreatedDate) >= 4 ) or ( YEAR(pm.CreatedDate) = YEAR(CURRENT_DATE) and MONTH(pm.CreatedDate) <= 3 ) + (YEAR(pm.PODate) = YEAR(CURRENT_DATE)-1 and MONTH(pm.PODate) >= 4 ) or ( YEAR(pm.PODate) = YEAR(CURRENT_DATE) and MONTH(pm.PODate) <= 3 ) end and mm.Category = '".$cat."' group by supplier_name,material_name"; @@ -1582,7 +1619,7 @@ left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID where pm.Status != 'ST030' and pm.Status = 'ST056' and pm.PONO in (select PONO from T_IGR_Master) and -month(pm.CreatedDate) = month(current_date()) and mm.Category = '".$cat."' +month(pm.PODate) = month(current_date()) and mm.Category = '".$cat."' group by supplier_name,material_name"; $query = $this->db->query($sql); return $query->result(); @@ -1595,7 +1632,7 @@ left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID where pm.Status != 'ST030' and pm.Status = 'ST056' and pm.PONO in (select PONO from T_IGR_Master) and -date(pm.CreatedDate) = current_date() and mm.Category = '".$cat."' +date(pm.PODate) = current_date() and mm.Category = '".$cat."' group by supplier_name,material_name"; $query = $this->db->query($sql); echo $sql; @@ -1604,32 +1641,32 @@ group by supplier_name,material_name"; function rawi_report_consolidate($cname,$fa,$aa){ - $sql="select mm.Category as category, -SUM(IF(month(pm.CreatedDate) = 4, pl.Quantity, 0)) AS April, -SUM(IF(month(pm.CreatedDate) = 5, pl.Quantity, 0)) AS May, -SUM(IF(month(pm.CreatedDate) = 6, pl.Quantity, 0)) AS June, -SUM(IF(month(pm.CreatedDate) = 7, pl.Quantity, 0)) AS July, -SUM(IF(month(pm.CreatedDate) = 8, pl.Quantity, 0)) AS August, -SUM(IF(month(pm.CreatedDate) = 9, pl.Quantity, 0)) AS September, -SUM(IF(month(pm.CreatedDate) = 10, pl.Quantity, 0)) AS October, -SUM(IF(month(pm.CreatedDate) = 11, pl.Quantity, 0)) AS November, -SUM(IF(month(pm.CreatedDate) = 12, pl.Quantity, 0)) AS December, -SUM(IF(month(pm.CreatedDate) = 1, pl.Quantity, 0)) AS January, -SUM(IF(month(pm.CreatedDate) = 2, pl.Quantity, 0)) AS February, -SUM(IF(month(pm.CreatedDate) = 3, pl.Quantity, 0)) AS March, + $sql="select sd.SupplierID as sid,mm.MaterialCode as mid,mm.Category as category,sd.SupplierName as supplier_name,mm.MaterialName as material_name, +SUM(IF(month(pm.PODate) = 4, pl.Quantity, 0)) AS April, +SUM(IF(month(pm.PODate) = 5, pl.Quantity, 0)) AS May, +SUM(IF(month(pm.PODate) = 6, pl.Quantity, 0)) AS June, +SUM(IF(month(pm.PODate) = 7, pl.Quantity, 0)) AS July, +SUM(IF(month(pm.PODate) = 8, pl.Quantity, 0)) AS August, +SUM(IF(month(pm.PODate) = 9, pl.Quantity, 0)) AS September, +SUM(IF(month(pm.PODate) = 10, pl.Quantity, 0)) AS October, +SUM(IF(month(pm.PODate) = 11, pl.Quantity, 0)) AS November, +SUM(IF(month(pm.PODate) = 12, pl.Quantity, 0)) AS December, +SUM(IF(month(pm.PODate) = 1, pl.Quantity, 0)) AS January, +SUM(IF(month(pm.PODate) = 2, pl.Quantity, 0)) AS February, +SUM(IF(month(pm.PODate) = 3, pl.Quantity, 0)) AS March, sum(pl.Quantity) as qtotal, -SUM(IF(month(pm.CreatedDate) = 4, pl.Quantity * pl.Rate, 0)) AS vApril, -SUM(IF(month(pm.CreatedDate) = 5, pl.Quantity * pl.Rate, 0)) AS vMay, -SUM(IF(month(pm.CreatedDate) = 6, pl.Quantity * pl.Rate, 0)) AS vJune, -SUM(IF(month(pm.CreatedDate) = 7, pl.Quantity * pl.Rate, 0)) AS vJuly, -SUM(IF(month(pm.CreatedDate) = 8, pl.Quantity * pl.Rate, 0)) AS vAugust, -SUM(IF(month(pm.CreatedDate) = 9, pl.Quantity * pl.Rate, 0)) AS vSeptember, -SUM(IF(month(pm.CreatedDate) = 10, pl.Quantity * pl.Rate, 0)) AS vOctober, -SUM(IF(month(pm.CreatedDate) = 11, pl.Quantity * pl.Rate, 0)) AS vNovember, -SUM(IF(month(pm.CreatedDate) = 12, pl.Quantity * pl.Rate, 0)) AS vDecember, -SUM(IF(month(pm.CreatedDate) = 1, pl.Quantity * pl.Rate, 0)) AS vJanuary, -SUM(IF(month(pm.CreatedDate) = 2, pl.Quantity * pl.Rate, 0)) AS vFebruary, -SUM(IF(month(pm.CreatedDate) = 3, pl.Quantity * pl.Rate, 0)) AS vMarch, +SUM(IF(month(pm.PODate) = 4, pl.Quantity * pl.Rate, 0)) AS vApril, +SUM(IF(month(pm.PODate) = 5, pl.Quantity * pl.Rate, 0)) AS vMay, +SUM(IF(month(pm.PODate) = 6, pl.Quantity * pl.Rate, 0)) AS vJune, +SUM(IF(month(pm.PODate) = 7, pl.Quantity * pl.Rate, 0)) AS vJuly, +SUM(IF(month(pm.PODate) = 8, pl.Quantity * pl.Rate, 0)) AS vAugust, +SUM(IF(month(pm.PODate) = 9, pl.Quantity * pl.Rate, 0)) AS vSeptember, +SUM(IF(month(pm.PODate) = 10, pl.Quantity * pl.Rate, 0)) AS vOctober, +SUM(IF(month(pm.PODate) = 11, pl.Quantity * pl.Rate, 0)) AS vNovember, +SUM(IF(month(pm.PODate) = 12, pl.Quantity * pl.Rate, 0)) AS vDecember, +SUM(IF(month(pm.PODate) = 1, pl.Quantity * pl.Rate, 0)) AS vJanuary, +SUM(IF(month(pm.PODate) = 2, pl.Quantity * pl.Rate, 0)) AS vFebruary, +SUM(IF(month(pm.PODate) = 3, pl.Quantity * pl.Rate, 0)) AS vMarch, sum(pl.Quantity * pl.Rate) as vtotal FROM T_PurchaseOrder_Master pm join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO @@ -1647,7 +1684,7 @@ if ($cname!= ''){ if ($fa and $aa != ''){ - $sql.=" and (pm.CreatedDate >= '".$fa."-04-01' and pm.CreatedDate <= '".$aa."-03-31')"; + $sql.=" and (pm.PODate >= '".$fa."-04-01' and pm.PODate <= '".$aa."-03-31')"; } @@ -1667,10 +1704,10 @@ join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID where pm.Status != 'ST030' and pm.Status = 'ST056' and pm.PONO in (select PONO from T_IGR_Master) and -monthname(pm.CreatedDate) = '".$m."' and mm.Category = '".$cat."' "; +monthname(pm.PODate) = '".$m."' and mm.Category = '".$cat."' "; if ($fa and $aa != ''){ - $sql.=" and (pm.CreatedDate >= '".$fa."-04-01' and pm.CreatedDate <= '".$aa."-03-31')"; + $sql.=" and (pm.PODate >= '".$fa."-04-01' and pm.PODate <= '".$aa."-03-31')"; } $sql.= "group by category,supplier_name,material_name"; @@ -1691,7 +1728,7 @@ where pm.Status != 'ST030' and pm.Status = 'ST056' and pm.PONO in (select PONO f mm.Category = '".$cat."' "; if ($fa and $aa != ''){ - $sql.=" and (pm.CreatedDate >= '".$fa."-04-01' and pm.CreatedDate <= '".$aa."-03-31')"; + $sql.=" and (pm.PODate >= '".$fa."-04-01' and pm.PODate <= '".$aa."-03-31')"; } $sql.= "group by category,supplier_name,material_name"; diff --git a/application/models/department_model.php b/application/models/department_model.php index 445c9350..0f778cab 100644 --- a/application/models/department_model.php +++ b/application/models/department_model.php @@ -2,48 +2,10 @@ class department_model extends CI_Model { - /** - * This function is used to get the user listing count - * @param string $searchText : This is optional search text - * @return number $count : This is row count - */ - // function departmentListingCount($searchText = '') - // { - // $this->db->select('BaseT.DepartmentID, BaseT.SupplierName, BaseT.Address, BaseT.ContactNumber, BaseT.AlternateContactNumber,BaseT.EmailAddress,BaseT.Exiseregistration,BaseT.TIN,BaseT.PAN,BaseT.GSTNO,BaseT.GSTRange,BaseT.CollectrateAddress,BaseT.UANumber,BaseT.PaymentTerms,BaseT.PaymentDays,BaseT.PayableAT'); - // $this->db->from('T_DepartmentDetails as BaseT'); - // //$this->db->join('tbl_users as users', 'users.userId = BaseT.userId','left'); - // //$this->db->join('T_SupplierDetails as ID', 'ID.DepartmentID = BaseT.DepartmentID','left'); - // if(!empty($searchText)) { - // $likeCriteria = "(BaseT.DepartmentID LIKE '%".$searchText."%' - // OR BaseT.SupplierName LIKE '%".$searchText."%' - // OR BaseT.Address LIKE '%".$searchText."%' - // OR BaseT.ContactNumber LIKE '%".$searchText."%' - // OR BaseT.AlternateContactNumber LIKE '%".$searchText."%' - // OR BaseT.EmailAddress LIKE '%".$searchText."%' - // OR BaseT.Exiseregistration LIKE '%".$searchText."%' - // OR BaseT.TIN LIKE '%".$searchText."%' - // OR BaseT.PAN LIKE '%".$searchText."%' - // OR BaseT.GSTNO LIKE '%".$searchText."%' - // OR BaseT.GSTRange LIKE '%".$searchText."%' - // OR BaseT.CollectrateAddress LIKE '%".$searchText."%' - // OR BaseT.UANumber LIKE '%".$searchText."%' - // OR BaseT.PaymentTerms LIKE '%".$searchText."%' - // OR BaseT.PaymentDays LIKE '%".$searchText."%' - // OR BaseT.PayableAT LIKE '%".$searchText."%')"; - // $this->db->where($likeCriteria); - // } - // //$this->db->where('BaseT.isDeleted', 0); - // //$this->db->where('BaseT.userId !=', 1); - // $query = $this->db->get(); - - // return count($query->result()); - // } + /** * This function is used to get the user listing count - * @param string $searchText : This is optional search text - * @param number $page : This is pagination offset - * @param number $segment : This is pagination limit - * @return array $result : This is result + * @return array $result : This is result of the query */ function departmentListing() { @@ -55,57 +17,44 @@ class department_model extends CI_Model return $result; } - // function ($searchText = '') - // { - // if(!empty($searchText)) { - // $likeCriteria = "(BaseT.DepartmentName LIKE '%".$searchText."%' - // OR BaseT.DEPCode LIKE '%".$searchText."%' - // OR BaseT.HeadDept LIKE '%".$searchText."%' - // OR BaseT.IsActive LIKE '%".$searchText."%')"; - // $this->db->where($likeCriteria); - // } - // //$this->db->where('BaseT.isDeleted', 0); - // //$this->db->where('BaseT.userId !=', 1); - // // $this->db->limit($page, $segment); - // $query = $this->db->get(); - - // $result = $query->result(); - // return $result; - // } + /** - * This function used to get user information by id - * @param number $userId : This is user id - * @return array $result : This is user information + * To get Department information by id + * @param array $department : This will have all the department datas + * @return array $result : result of the query */ - -function addNewdepartment($department) + function addNewdepartment($department) { $this->db->insert('T_DepartmentDetails', $department); - $SID = $this->db->affected_rows(); + $SID = $this->db->affected_rows(); return $SID; } - -function getdepcode() -{ - //$limit = 12; - $this->db->distinct(); - $this->db->select('DEPCode, DepartmentName'); - $this->db->from('T_DepartmentDetails'); - $this->db->where('IsActive =', 1); - //$this->db->limit($limit); - $query = $this->db->get(); - - return $query->result(); -} /** - * This function used to get user information by id - * @param number $userId : This is user id - * @return array $result : This is user information + * To get active department datas + * @return array $result : result of the query(returns DepartmentCode and DepartmentName) + */ + function getdepcode() + { + + $this->db->distinct(); + $this->db->select('DEPCode, DepartmentName'); + $this->db->from('T_DepartmentDetails'); + $this->db->where('IsActive =', 1); + + $query = $this->db->get(); + + return $query->result(); + } + + /** + * To get department details + * @param number $DEPCode : Optional : this is department code + * @return array $result : result of the query */ function getDeptInfo($DEPCode='') { @@ -113,11 +62,14 @@ function getdepcode() $this->db->from('T_DepartmentDetails'); $this->db->where('DEPCode', $DEPCode); $query = $this->db->get(); - // print_r($this->db->last_query()); return $query->result(); } - /* This function to get the Supplier Address on respective Supplier ID */ - + + /** + * To store edited department details + * @param array $department : This wil have all edited department datas + * @param number $DEPCode : This is department code + **/ function Updatedepartment($department, $DEPCode) { $this->db->where('DEPCode', $DEPCode); diff --git a/application/models/employeedetails_model.php b/application/models/employeedetails_model.php index 093c1555..07ddd30c 100644 --- a/application/models/employeedetails_model.php +++ b/application/models/employeedetails_model.php @@ -6,18 +6,14 @@ class employeedetails_model extends CI_Model /** - * This function is used to get the user listing count - * @param string $searchText : This is optional search text - * @param number $page : This is pagination offset - * @param number $segment : This is pagination limit - * @return array $result : This is result + * To get the employee listing + * @return array $result : result of the query */ function employeeListing() { - $this->db->select(' Emp.*,Dep.DepartmentName as DepartmentName'); - $this->db->from('T_Employee_Details Emp'); + $this->db->select(' Emp.*,Dep.DepartmentName as DepartmentName'); + $this->db->from('T_Employee_Details Emp'); $this->db->join('T_DepartmentDetails Dep', 'Emp.Departmentcode = Dep.DEPCode','left'); - $this->db->order_by("Emp.EmpID", "asc"); $query = $this->db->get(); @@ -26,7 +22,10 @@ class employeedetails_model extends CI_Model return $result; } - + /** + * To get the role data for employee + * @return array $query->result() : result of the query + */ function getUserRoles() { $this->db->select('roleId, role'); @@ -37,9 +36,9 @@ class employeedetails_model extends CI_Model return $query->result(); } - /** - * This function is used to get the Config value from configuration table - * @return array $result : This is result of the query + /** + * To get the Config value from configuration table + * @return array $query->result() : This is result of the query */ function getConfigValue($ConfigID ) { @@ -52,9 +51,9 @@ class employeedetails_model extends CI_Model return $query->result(); } - /* *//** - * This function is used to get the Department details from T_DepartmentDetails - * @return array $result : This is result of the query + /** + * To get the Department details from T_DepartmentDetails + * @return array $query->result() : result of the query */ function getDepartment() { @@ -65,33 +64,40 @@ class employeedetails_model extends CI_Model return $query->result(); } + /** - * This function used to get user information by id - * @param number $userId : This is user id - * @return array $result : This is user information + * To store employee details + * @param array $Employee : This will have all the employee datas + * @return number $EmpID : This will return how many value are inserted (return as number/count) */ - -function addNewemployee($Employee) + function addNewemployee($Employee) { $this->db->insert('T_Employee_Details', $Employee); - $EmpID = $this->db->affected_rows(); return $EmpID; } - + /** + * To store the edited employee details + * @param array $Emp : This will have all the edited employee datas + * @param number $EmpID : This is employee id + */ function UpdateEmployee($Emp, $EmpID) { - //echo $EmpID; + $this->db->where('EmpID', $EmpID); $this->db->update('T_Employee_Details', $Emp); - //print_r($this->db->last_query()); + return TRUE; } - + /** + * To get employee details + * @param number $EmpID : This is employee id + * @return array $result : result of the query + */ function viewemployee( $EmpID) { $this->db->select('Emp.*,Dep.DepartmentName as DepartmentName'); @@ -100,22 +106,31 @@ function addNewemployee($Employee) $this->db->where('Emp.EmpID', $EmpID); $query = $this->db->get(); - $result = $query->result(); + $result = $query->result(); - // print_r($this->db->last_query()); - return $result; + return $result; } - /* This function to get the Employee department on respective Employee */ + /** + * To get the Employee department on respective Employee + * @param number $EmployeeID : this is employee Id + * @return array $query->result_array() : result of the query + **/ function GetEmployeeDepartment($EmployeeID) { $this->db->select('DepartmentName'); $this->db->from('T_EmployeeDetails'); - $this->db->where($EmployeeID); + $this->db->where($EmployeeID); $query = $this->db->get(); - return $query->result_array(); + return $query->result_array(); } - + + /** + * To check respective Employee emailid already exists or not + * @param number $empid : this is employee Id + * @param number $email : this is employee's emailid + * @return array $query->result_array() : result of the query + **/ function checkMailExists($email='',$Empid='') { $this->db->select('EmailId'); @@ -126,12 +141,18 @@ function addNewemployee($Employee) $this->db->where('EmpID !=',$Empid); } $query = $this->db->get(); - //print_r($this->db->last_query()); + if ($query->num_rows > 0) { return $query->result_array(); } } - + + /** + * To check respective Employee aadhar no already exists or not + * @param number $Empid : this is employee Id + * @param number $AadharNo : this is employee's aadhar no + * @return array $query->result_array() : result of the query + **/ function checkAadharExists($AadharNo,$Empid='') { $this->db->select('AadharNo'); @@ -142,11 +163,18 @@ function addNewemployee($Employee) $this->db->where('EmpID !=',$Empid); } $query = $this->db->get(); - //print_r($this->db->last_query()); + if ($query->num_rows > 0) { return $query->result_array(); } } + + /** + * To check respective Employee's panno already exists or not + * @param number $Empid : this is employee Id + * @param number $AadharNo : this is employee's pan no + * @return array $query->result_array() : result of the query + **/ function checkPANExists($PANNo,$Empid='') { $this->db->select('PANNo'); @@ -163,7 +191,11 @@ function addNewemployee($Employee) } - + /** + * To check respective Employee's profile pic already exists or not + * @param number $pic : this is employee profile pic (pic name) + * @return array $query->result_array() : result of the query + **/ function checkPhotoExists($Pic) { $this->db->select('ProfilePic'); @@ -171,35 +203,46 @@ function addNewemployee($Employee) $this->db->where($Pic); $query = $this->db->get(); - // print_r($this->db->last_query()); + if ($query->num_rows > 0) { return $query->result_array(); } } -function getEmployeeCount( ) + + /** + * To get employee's count + * @return array $query->result_array() : result of the query + **/ + function getEmployeeCount( ) { $this->db->select('count(*) as EmpCount'); $this->db->from('T_Employee_Details'); - $this->db->where('IsActive ',1 ); + $this->db->where('IsActive ',1 ); $query = $this->db->get(); return $query->result(); } - - function getBankDetails() - { - $this->db->select('*'); - $this->db->from('T_Bank_Details'); - $query = $this->db->get(); - $result = $query->result(); - return $result; - - } + + /** + * To get bank details + * @return array $result : result of the query + **/ + function getBankDetails() + { + $this->db->select('*'); + $this->db->from('T_Bank_Details'); + $query = $this->db->get(); + $result = $query->result(); + return $result; + } + /** + * To get Asset's information for export xl + */ function export_excel(){ $this->db->select(' det.*,Dep.DepartmentName as DepartmentName,det.firstname,emp1.firstname as UpdatedByName,emp1.firstname as CreatedByName'); - $this->db->join('T_DepartmentDetails Dep', 'det.Departmentcode = Dep.DEPCode','left'); + $this->db->join('T_DepartmentDetails Dep', 'det.Departmentcode = Dep.DEPCode','left'); $this->db->join('tbl_users as tbl',' det.createdby = tbl.userid','left'); $this->db->join('T_Employee_Details as emp', 'emp.empid=tbl.empid','left'); $this->db->join('tbl_users as tbl1',' det.UpdatedBy = tbl1.userid','left'); diff --git a/application/models/emppaydate_model.php b/application/models/emppaydate_model.php index e78a0781..723d4f88 100644 --- a/application/models/emppaydate_model.php +++ b/application/models/emppaydate_model.php @@ -3,18 +3,10 @@ class emppaydate_model extends CI_Model { - - - /** - * This function is used to get the user listing count - * @param string $searchText : This is optional search text - * @param number $page : This is pagination offset - * @param number $segment : This is pagination limit - * @return array $result : This is result + * To get the employee pay listing + * @return array $result : This is result of the query */ - - function emppayListing() { $this->db->select('T_Emp_Pay_Data.*,T_Employee_Details.FirstName,T_Employee_Details.LastName'); @@ -24,7 +16,11 @@ class emppaydate_model extends CI_Model $result = $query->result(); return $result; } - + + /** + * To delete the employee pay datas + * @return array $query : This is result of the query + */ function deleteEmployeePay($EmpID) { $this->db->where('EmpID',$EmpID); @@ -34,8 +30,11 @@ class emppaydate_model extends CI_Model } - - + /** + * To store the employee payments datas + * @param $emppay + * @return array $paydataid : + */ function addNewemppay($emppay) { $this->db->trans_start(); @@ -47,7 +46,13 @@ class emppaydate_model extends CI_Model return $emppay; } - + + /** + * To store the employees loan information + * @param string $string : + * @param array $dataarray : + * @return array $loanid : + */ function addLoanInfo($dataarray,$string) { if($string == 'add'){ @@ -63,7 +68,13 @@ class emppaydate_model extends CI_Model $loanid = $this->db->affected_rows(); return $loanid; } - } + } + + /** + * To get the employees payment information + * @param string $paydataid: + * @return array $loanid : + */ function getUserInfo($paydataid) { $sql = 'select T_Emp_Pay_Data.Pay_Data_ID,T_Emp_Pay_Data.EmpID as PAYEMPID,T_Emp_Pay_Data.Basic_Pay,T_Emp_Pay_Data.HRA_Rate,T_Emp_Pay_Data.Allowances,T_Emp_Pay_Data.Food_Allowances,T_Emp_Pay_Data.PF_Rate,T_Emp_Pay_Data.ESI_Rate,T_Emp_Pay_Data.HRA_Amount,T_Emp_Pay_Data.TotalSalary,T_Employee_Details.FirstName,T_Employee_Details.LastName,T_Loan_Master.*from T_Emp_Pay_Data @@ -75,21 +86,25 @@ class emppaydate_model extends CI_Model return $query->result(); } - + /** + * To store edited emppay information + * @param array $emppaydatas : + */ function editemppay($emppaydatas) { $paydateid=$emppaydatas['Pay_Data_ID']; - //echo $paydateid; - //print_r($emppaydatas);die(); - $this->db->where('Pay_Data_ID' ,$paydateid); $this->db->update('T_Emp_Pay_Data',$emppaydatas); return TRUE; } - + /** + * To view emppay information + * @param number $emppaydata : This will have all edited emppay details + * @param array $paydateid : This is paydate id + */ function viewemppay($emppaydata, $paydateid) { $this->db->where('Pay_Data_ID', $paydateid); diff --git a/application/models/inwardgateregister_model.php b/application/models/inwardgateregister_model.php index daca1a7e..20e08ff6 100644 --- a/application/models/inwardgateregister_model.php +++ b/application/models/inwardgateregister_model.php @@ -2,85 +2,76 @@ class inwardgateregister_model extends CI_Model { - /** - * This function is used to get the user listing count - * @param string $searchText : This is optional search text - * @return number $count : This is row count - */ - /** - * This function is used to get the user listing count - * @param string $searchText : This is optional search text - * @param number $page : This is pagination offset - * @param number $segment : This is pagination limit - * @return array $result : This is result + * To get the IGR details for listing + * @return array $result : result of the query */ function igrListing() { - $this->db->select('igr.*,PO.DeliveryDate,sup.SupplierName'); $this->db->from('T_IGR_Master igr'); $this->db->join('T_PurchaseOrder_Master PO','igr.PONO = PO.PONO'); $this->db->join('T_SupplierDetailsN` sup','PO.SupplierID = sup.SupplierID'); - $this->db->order_by('igr.CreatedDate','desc'); + $this->db->order_by('igr.CreatedDate','desc'); $query = $this->db->get(); $result = $query->result(); return $result; } + /** + * To get the po details + * @return array $result : result of the query + */ function getpurchaseorder() { - $this->db->distinct(); + $this->db->distinct(); $this->db->select('POM.PONO,POM.ServiceDescription,POM.DeliveryDate,sup.SupplierName,sup.Address,POM.status'); $this->db->from('T_PurchaseOrder_Master POM'); - $this->db->join('T_PurchaseOrder_LineItem POL', 'POL.PONO = POM.PONO'); + $this->db->join('T_PurchaseOrder_LineItem POL', 'POL.PONO = POM.PONO'); $this->db->join('T_SupplierDetailsN sup', 'POM.SupplierID = sup.SupplierID'); - $this->db->where('POM.Status',PO_RELEASED); - $this->db->where('POM.POType !=',SERVICE); - $this->db->or_where('POM.Status',IGR_CREATED); - $this->db->or_where('POM.Status',MRIR_CREATED); - $this->db->or_where('POM.Status',MRIR_APPROVED); - $query = $this->db->get(); + $this->db->where('POM.Status',PO_RELEASED); + $this->db->where('POM.POType !=',SERVICE); + $this->db->or_where('POM.Status',IGR_CREATED); + $this->db->or_where('POM.Status',MRIR_CREATED); + $this->db->or_where('POM.Status',MRIR_APPROVED); + $query = $this->db->get(); - $result = $query->result(); - //print_r($this->db->last_query()); - return $result; + $result = $query->result(); + + return $result; } - + /** + * To get the po details for revalant Po + * @param number $PO : this is po number + * @return array $query->result() : result of the query + */ function viewpurchaseorder($PO) { $subQuery ='SELECT distinct POM.PONO,POL.MaterialCode,POL.Quantity,POL.ReceivedQuantity,(POL.Quantity -POL.ReceivedQuantity ) as PendingQty,POL.PONO,MM.MaterialName,MM.UOM - from T_PurchaseOrder_Master POM - left join T_PurchaseOrder_LineItem POL on POL.PONO = POM.PONO - left join T_IGR_Master IGM on IGM.PONO =POL.PONO - left join T_IGR_Details igr on igr.MaterialCode = POL.MaterialCode and IGM.PONO =POL.PONO - left join T_MaterialMaster MM - on MM.MaterialCode = POL.MaterialCode where POM.PONO=? ';// and POM.Status not in(?) '; + from T_PurchaseOrder_Master POM + left join T_PurchaseOrder_LineItem POL on POL.PONO = POM.PONO + left join T_IGR_Master IGM on IGM.PONO =POL.PONO + left join T_IGR_Details igr on igr.MaterialCode = POL.MaterialCode and IGM.PONO =POL.PONO + left join T_MaterialMaster MM + on MM.MaterialCode = POL.MaterialCode where POM.PONO=? '; - $query = $this->db->query($subQuery, array($PO,IGR_CREATED)); - - // print_r($this->db->last_query()); + $query = $this->db->query($subQuery, array($PO,IGR_CREATED)); return $query->result(); - /* $this->db->select('POM.PONO,POL.MaterialCode,POL.Quantity,POL.PONO,MM.MaterialName,MM.UOM'); - $this->db->from('T_PurchaseOrder_Master POM'); - $this->db->join('T_PurchaseOrder_LineItem POL', 'POL.PONO = POM.PONO','left'); - $this->db->join('T_MaterialMaster MM', 'MM.MaterialCode = POL.MaterialCode','left'); - $this->db->where('POM.PONO',$PO ); - - $this->db->where('POL.Status !=',POLINEITEM_IGR_CREATED ); - $query = $this->db->get(); - - $result = $query->result(); - - $this->db->last_query(); - return $result; */ - } + + } + + /** + * To store the igr master details + * @param array $igrM : This will have all igr master details + * @var number $insert_id : + * @return array $query->result() : result of the query + */ function addigrM($igrM) { @@ -88,8 +79,7 @@ class inwardgateregister_model extends CI_Model $this->db->insert('T_IGR_Master', $igrM); $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(IGRNO) as IGRNO from T_IGR_Master'; @@ -100,6 +90,12 @@ class inwardgateregister_model extends CI_Model } } + /** + * To store the igr child details + * @param array $igrD : This will have all igr child details + * @var number $insert_id : + * @return array $query->result() : result of the query + */ function addigrD($igrD) { $this->db->trans_start(); @@ -116,6 +112,12 @@ class inwardgateregister_model extends CI_Model return $query->result(); } } + + /** + * To get igr details for revalant IGRNO + * @param number $IGRNO : This is IGRNO + * @return array $result : result of the query + */ function viewigr($IGRNO) { $this->db->distinct(); @@ -131,11 +133,17 @@ class inwardgateregister_model extends CI_Model $query = $this->db->get(); - // print_r( $this->db->last_query()); + $result = $query->result(); return $result; } + /** + * To store edited po lineitem details + * @param number $PONO : This is PONO + * @param number $MaterialCode : This material code + * @param array $Lineitem : This will have all edited po lineitem details + */ function UpdatePOLineItem($LineItem,$PONO,$MaterialCode) { $this->db->where('PONO', $PONO); @@ -145,6 +153,13 @@ class inwardgateregister_model extends CI_Model return TRUE; } + /** + * To store edited po master details + * @param number $PONO : This is PONO + * @var array $POStatus : for updation operation : this will have igrcreated's const value and updater' id + * @param number $updatedBy : This is updater's id + * @param array $Lineitem : This will have all edited po lineitem details + */ function UpdatePOMaster($PONO,$updatedBy) { $this->db->select('*'); @@ -162,14 +177,20 @@ class inwardgateregister_model extends CI_Model } } + + /** + * To get po lineitem details for recieved qty + * @param number $PONO : This is PONO + * @param number $MaterialCode : This is material code + * @return array $result : result of the query + */ function getPOLineItemReceivedQty($PONO,$MaterialCode) { - $this->db->select('ReceivedQuantity'); + $this->db->select('ReceivedQuantity'); $this->db->from('T_PurchaseOrder_LineItem'); $this->db->where('PONO',$PONO); $this->db->where('MaterialCode',$MaterialCode); - $query = $this->db->get(); - // print_r( $this->db->last_query()); + $query = $this->db->get(); $result = $query->result(); return $result; } diff --git a/application/models/login_model.php b/application/models/login_model.php index a24bfeb8..0f547995 100644 --- a/application/models/login_model.php +++ b/application/models/login_model.php @@ -4,7 +4,7 @@ class Login_model extends CI_Model { /** - * This function used to check the login credentials of the user + * To check the login credentials of the user * @param string $email : This is email of the user * @param string $password : This is encrypted password of the user */ diff --git a/application/models/monthlypay_model.php b/application/models/monthlypay_model.php index 69ad0f1f..f4b2f8cf 100755 --- a/application/models/monthlypay_model.php +++ b/application/models/monthlypay_model.php @@ -4,15 +4,13 @@ class monthlypay_model extends CI_Model { /** - * This function is used to get the user listing count - * @param string $searchText : This is optional search text - * @param number $page : This is pagination offset - * @param number $segment : This is pagination limit - * @return array $result : This is result + * To get monthwise payment list + * @param date $current : This is current month and year + * @return array $result : This is result of the query */ function monthlyListing($current="") { - //echo $current; + $this->db->select('T_Monthly_Pay_Inputs.*,T_Employee_Details.FirstName,T_Employee_Details.LastName,T_Payroll.Key,T_Loan_Master.Loan_ID'); $this->db->from('T_Monthly_Pay_Inputs'); $this->db->join('T_Employee_Details','T_Monthly_Pay_Inputs.EmpID=T_Employee_Details.EmpID'); @@ -21,18 +19,23 @@ class monthlypay_model extends CI_Model $this->db->where('Month_Year',$current); $query = $this->db->get(); - // print_r($query->result()); + $result = $query->result(); return $result; } + /** + * To get employee payment details + * @param date $current : Optional + * @param array $s : Optional + * @return array $result : This is result of the query + */ function getEmpPayDetails($current="",$s="") { $this->db->select('T_Employee_Details.EmpID,T_Employee_Details.FirstName,T_Employee_Details.LastName,T_Employee_Details.DateofJoining'); $this->db->from('T_Employee_Details'); - //$this->db->join('T_Emp_Pay_Data','T_Emp_Pay_Data.EmpID=T_Employee_Details.EmpID','Left'); $this->db->where('T_Employee_Details.IsActive',1); $this->db->order_by('EmpID','asc'); $query = $this->db->get(); @@ -41,11 +44,16 @@ class monthlypay_model extends CI_Model return $result; } + /** + * To get employee payment month wise details + * @param date $current : Optional : This is current month and year value + * @return array $result : This is result of the query + */ function getEmpPayDetailsforMonthInputs($current="") { $current = '01-'.$current; - //echo $current; + $current = date_create($current); $current = date_format($current,'Y-m-d'); $sql = "select T_Emp_Pay_Data.EmpID,T_Employee_Details.FirstName,T_Employee_Details.LastName,T_Employee_Details.DateofJoining,T_Attendance.Days_Worked as Days_worked,T_Attendance.Absent as LOP_Days,T_Attendance.Paid_Leave as Paid_leave,T_Attendance.Total_OTHrs as OT_Hrs_Worked,T_Attendance.NoofDays,T_Loan_Master.Loan_ID from T_Emp_Pay_Data @@ -59,6 +67,11 @@ class monthlypay_model extends CI_Model return $query->result(); } + /** + * To get public holiday details for attendances + * @param date $current : Optional : This is current month and year value + * @return array $query->result() : result of the query + */ function getPublicHoldays($current="") { if(!empty($current)) @@ -79,19 +92,29 @@ class monthlypay_model extends CI_Model } + /** + * To declare date is holiday + * @param date $Date : This is date + * @return array $query->result() : result of the query + */ function checkHoliday($Date) { $Date = date('Y-m-d',strtotime($Date)); - //echo $Date;die();[ $sql="select count(*) as count from T_Public_Holidays where H_Date = ?"; $query = $this->db->query($sql,array($Date)); return $query->result_array(); } + /** + * To store holiday date + * @param array $data : This is date + * @param string $String : it has 'i' and 'u' ('i' handles insertion and 'u' handles updation) + * @return array $i : result of the query + */ function saveHolidays($data,$string) { - //print_r($data); + if($string == 'i') { $this->db->insert('T_Public_Holidays',$data); @@ -107,7 +130,11 @@ class monthlypay_model extends CI_Model } } - + /** + * To delete holiday date + * @param date $d : This is date + * @return $this->db->affected_rows() : result of the query + */ function deleteHoliday($d) { $d = date_format(date_create($d),'Y-m-d'); @@ -115,6 +142,12 @@ class monthlypay_model extends CI_Model $this->db->delete('T_Public_Holidays'); return $this->db->affected_rows(); } + + /** + * To get details for attendances + * @param date $current : Optional : This is date + * @return $result : result of the query + */ function monthlyAttendance($current="") { @@ -128,7 +161,14 @@ class monthlypay_model extends CI_Model $result = $query->result(); return $result; - } + } + + /** + * To store attendances Information (its handles insertion and updation operation) + * @param array $data : this will have all attendances inforamtion + * @var number $res : gets count + * @return array $i : result of the query + */ function saveMonthlyData_model($data) { @@ -167,6 +207,13 @@ class monthlypay_model extends CI_Model } + /** + * To store cashbook Information (its insertion and updation operation) + * @param array $monthattendance : this will have all cashbook details + * @param number $Month_Year : + * @param number $EmpID : + * @return array $this->db->affected_rows() : result of the query + */ function saveAttendance($monthattendance,$Month_Year,$EmpID) { $this->db->select('count(*) as c'); @@ -180,26 +227,15 @@ class monthlypay_model extends CI_Model if($ans == 0) { - //array_pop(); $this->db->insert('T_Attendance',$monthattendance); return $this->db->affected_rows(); - //echo "INS"; - // if($this->db->affected_rows() > 0) - // { - - // return true; - // } - // else - // { - // return false; - // } + } else { $this->db->where('Month_Year',$Month_Year); $this->db->where('EmpID',$EmpID); $this->db->update('T_Attendance',$monthattendance); - //echo "UPDATE"; return $this->db->affected_rows(); } diff --git a/application/models/supplier_model.php b/application/models/supplier_model.php index cf598765..4bd60183 100644 --- a/application/models/supplier_model.php +++ b/application/models/supplier_model.php @@ -4,7 +4,7 @@ class supplier_model extends CI_Model { /** - * To get the Supplier Information for listing + * To get the Supplier Information for listing * @return array $result : This is result */ function supplierListing() @@ -38,7 +38,7 @@ class supplier_model extends CI_Model /** * To get Payment information - * @param number $payment :Optional : To get payment value + * @param number $payment : Optional : To get payment value * @return array $result : This is result of the query(payment information) */ function getPaymentTerms($payment = '') @@ -52,7 +52,7 @@ class supplier_model extends CI_Model /** * To Check PAN number is already exists are not - * @param number $SID : Optional:To get Supplier ID + * @param number $SID : Optional : To get Supplier ID * @param number $PAN : To get PAN number from the controller - for check purpose if already exists are not * @return $query->result_array() : This is result of the query (PAN Number information based on supplier ID) */ diff --git a/application/views/Report_Material_Master_ItemWise.php b/application/views/Report_Material_Master_ItemWise.php index f0cb0d5c..694906f7 100755 --- a/application/views/Report_Material_Master_ItemWise.php +++ b/application/views/Report_Material_Master_ItemWise.php @@ -6,9 +6,11 @@ if(!empty($mmi)) } ?> - + + + + + + + + + +
@@ -103,15 +115,18 @@ $(document).ready(function() { "dom": "<'row'<'col-md-6'l><'col-md-6'Bf>>" + "<'row'<'col-md-6'><'col-md-6'>>" + "<'row'<'col-md-12't>><'row'<'col-md-4'i><'col-md-8'p>>", - buttons: [ - { - extend: 'collection', - text: 'Export MM-Receipt Value Report', - buttons: [ - 'excel' - ] - } - ] +buttons: [ + { + extend: 'excelHtml5', + footer: 'true', + title: 'Report - Material Master - ReceiptValue', + exportOptions: { + columns: ':visible' + } + }, + 'colvis' +] + } ); } ); $('#mySelect').on('change',function(){ diff --git a/application/views/Report_Material_Master_SupplierWise.php b/application/views/Report_Material_Master_SupplierWise.php index 0e40bb90..936325d8 100755 --- a/application/views/Report_Material_Master_SupplierWise.php +++ b/application/views/Report_Material_Master_SupplierWise.php @@ -6,9 +6,11 @@ if(!empty($mms)) } ?> - + + + @@ -36,7 +38,22 @@ if(!empty($mms))
-

Report - Cumulative -inward

+

Report - Cumulative -inward( + = 4) { + + $yearl = date('Y').'-'.(date('Y')+1); + + } else { + + $yearl = (date('Y')-1).'-'.date('Y'); + + } + + echo $yearl; + + ?> )

@@ -213,12 +230,14 @@ if(!empty($mms))
- - - - - - + + + + + + + + - - - - - + + + + + + + + - - - - - + + + + + + + + - - - - - + + + + + + + + - - - - - + + + + + + + + - - - - - + + + + + + + + - - - - - + + + + + + + + - - - - - + + + + + + + + - - - - - + + + + + + + + - - - - - + + + + + + + + - - - - - + + + + + + + + - + + @@ -45,7 +46,57 @@ if(!empty($mms))
-

Report - Supplier-Inward

+

Report - Supplier-Inward

+ + input->post('client_name')){ + + $cl=$this->input->post('client_name'); + + echo $cl; + + echo ' '.' '; + + } + + + + if($this->input->post('financialyear')){ + + $ab=$this->input->post('financialyear'); + + echo '('.$ab.')'; + + echo ' '; + + + + } + + if($this->input->post('month')){ + + $m=$this->input->post('month'); + + echo '('.$m.')'; + + 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; + + } + + + + ?>

@@ -56,10 +107,10 @@ if(!empty($mms))
-
- - - - - - + + + + + + + - - - - - + + + + + + + - - - - - - + + + + + + + - - - - - - + + + + + + + - - - - - - + + + + + + + - - - - - - + + + + + + + - - - - - - + + + + + + +