diff --git a/application/config/routes.php b/application/config/routes.php index 18389ff5..7fa12815 100644 --- a/application/config/routes.php +++ b/application/config/routes.php @@ -53,8 +53,6 @@ $route['reports']='reportlistcontroller'; $route['userListing'] = 'user/userListing'; $route['userListing/(:num)'] = "user/userListing/$1"; -//$route['purchaseorderListing'] = 'purchaseorder/purchaseorderListing'; -//$route['purchaseorderListing/(:num)'] = "purchaseorder/purchaseorderListing/$1"; $route['supplierListing'] = 'supplier/supplierListing'; $route['supplierListing/(:num)'] = "supplier/supplierListing/$1"; @@ -80,8 +78,7 @@ $route['attendance'] = 'monthlypay/attendanceLoad'; $route['publicholidays'] = 'monthlypay/loadPublicholidays'; $route['loanreports'] = 'payslip/loadLoanReport'; $route['qualityreportlist'] = "quality/reportList"; - - +$route['qualityreportlistinward'] = "quality/reportListInward"; //<-----------Application Add Routes------------> $route['addNew'] = "user/addNew"; @@ -182,13 +179,12 @@ $route['POApproval'] = "purchaseorder/poapproval"; // + $route['storerequisition']="storerequisitionlist/addstore"; $route['approvalstorerequisitionslip']="storerequisitionlist/SearchRequistLists"; $route['storerequisitionlisting']="storerequisitionlist/addstorerequisitionlist"; $route['EditStoreRequisition'] = "storerequisitionlist/EditStoreRequistion"; - - //<-------------IGR page-----------------> $route['Addigr'] = "inwardgateregister/addinwardgateregister"; $route['ViewigrDetails'] = "inwardgateregister/viewIGRDetails"; @@ -209,6 +205,11 @@ $route['ViewIncomeExpense'] = "cashbook/incomeExpenseList"; $route['addNewIncomeExpense'] = "cashbook/addNewIncomeExpenseLoad"; $route['addIncomeExpense'] = "cashbook/addIncomeExpense"; +// permission slip// + +$route['permission'] = 'monthlypay/permissionslip'; +$route['permissionlist'] = 'monthlypay/addper'; + //<-------------Reports page-----------------> $route['reportpending'] = "report/pending_report"; $route['releasedpo'] = "report/releasedPO"; @@ -233,8 +234,7 @@ $route['Report_consolidate_inward'] = "report/iconsolidate"; $route['Report_cumulative_inward'] = "report/icumulative"; $route['Report_cumulative_raw'] = "report/rawi_cumulative"; $route['Report_consolidate_category'] = "report/rawi_consolidate"; -$route['Report_cumulative_raw'] = "report/rawi_cumulative"; -$route['Report_consolidate_category'] = "report/rawi_consolidate"; + // Company Information $route['companyview'] = 'companycontroller/companyview'; diff --git a/application/controllers/amendmentpurchaseorder.php b/application/controllers/amendmentpurchaseorder.php index e365d280..d78e1a21 100644 --- a/application/controllers/amendmentpurchaseorder.php +++ b/application/controllers/amendmentpurchaseorder.php @@ -4,7 +4,7 @@ require APPPATH . '/libraries/BaseController.php'; /** * Class : Amendment Purchase Order controller - * User Class to control all user related operations. + * amendmentpurchaseorder Class to control all amendmented po's related operations. * @author : Venba Info Tech - Velmurugan * @version : 1.1 * @since : 18 November 2017 @@ -12,35 +12,33 @@ require APPPATH . '/libraries/BaseController.php'; class amendmentpurchaseorder extends BaseController { /** - * This is default constructor of the class + * default constructor of the class */ public function __construct() { parent::__construct(); - //$this->load->model('amendment_model'); $this->load->model('purchaseorder_model'); $this->load->library('session'); $this->load->library('form_validation'); - // $this->load->library('pagination'); - $this->isLoggedIn(); - } + } + /** - * This function used to load the first screen of the user + * Index Page for this controller(default function of the class) */ public function index() { - - - $this->load->library('pagination'); - + + $this->load->library('pagination'); $forwhat='amendment'; $data['POData'] = $this->purchaseorder_model->purchaseorderListing($forwhat); $this->global['pageTitle'] = 'Resico : Amendment Purchase Order'; $this->loadviews('AmendPOlist',$this->global,$data,NULL); } - + /** + * For editing purpose and it has oldest all released po. + */ function EditAmendPurchaseOrder() { $PONO = $_GET['PONO']; @@ -51,20 +49,21 @@ class amendmentpurchaseorder extends BaseController $result = array(); $ReqArray = array(); $Status = ''; + foreach ($Req as $SID): $ReqArray[] = $SID->ReqNo ; $result[] = $this->purchaseorder_model->getRawPOMaterialList($SID->ReqNo); - endforeach; - $data['MaterialList'] = $result;//$this->purchaseorder_model->getRawMaterialList($ReqType,$ReqArray); + + endforeach; + $data['MaterialList'] = $result; $data['Suplist'] = $this->purchaseorder_model->getSupplierName(); $data['Payment']=$this->purchaseorder_model->getPaymentTermsDetails(); $data['INRSYMBOL']=$this->purchaseorder_model->GetINRCurrencytype('INR'); - //print_r($data['Payment']); /* Cost code from Requisition - Client Review Fix Start here */ $ReqDetails = $this->purchaseorder_model->getRequistDetails($ReqArray); $data['RequistionDetails'] = $ReqDetails; - // $data['RequistionDetails'] = $ReqDetails; + foreach ($data['RequistionDetails'] as $ReqDet) { @@ -79,20 +78,21 @@ class amendmentpurchaseorder extends BaseController } $CostCode = ''; $this->load->model('costcenter_model'); - $FYStart = ''; - $FYEnd = ''; - $FiscalYear = $this->costcenter_model->getFiscalYear(); - if(!empty($FiscalYear)) + + $FYStart = ''; + $FYEnd = ''; + $FiscalYear = $this->costcenter_model->getFiscalYear(); + + if(!empty($FiscalYear)) { - foreach ($FiscalYear as $Fy) - { - $FYStart =$Fy->StartYear; - $FYEnd =$Fy->EndYear; - } + foreach ($FiscalYear as $Fy) + { + $FYStart =$Fy->StartYear; + $FYEnd =$Fy->EndYear; + } + } - } - - $FYdt = $FYStart." - ".$FYEnd ; + $FYdt = $FYStart." - ".$FYEnd ; foreach ($ReqDetails as $Rs): $CostCode = $Rs->CostCenterCode; endforeach; @@ -108,161 +108,123 @@ class amendmentpurchaseorder extends BaseController $data['MaxPODate'] = $this->purchaseorder_model->getLastCreatedPODate(); $data['TaxType'] = $this->purchaseorder_model->getConfigValue('C006'); $data['FreightType'] = $this->purchaseorder_model->getConfigValue('C018'); - $data['PoTypeOptions'] = $this->purchaseorder_model->getConfigValue('C026'); - if($ReqType == SERVICE) - { + $data['PoTypeOptions'] = $this->purchaseorder_model->getConfigValue('C026'); + 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("editServiceAmendPO", $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("editServiceAmendPO", $this->global, $data, NULL); + } else if($ReqType == REVENUE) { - //$data['Payment']=$this->purchaseorder_model->getSupplierPayment(); - $data['POSTATUS']=$this->purchaseorder_model->GetPOStatus($PONO); - $data['POItem'] = $this->purchaseorder_model->GetRevenuePurchaseOrderDetails($PONO); - $data['PaymentTerms']=$this->purchaseorder_model->GetPaymentTerms($PONO); - //echo "FROM CON"; - //print_r($data['Payment']); - $this->global['pageTitle'] = 'Resico : Edit Revenue Purchase order form'; - $this->loadViews("editRevenueAmendPO", $this->global, $data, NULL); + + $data['POSTATUS']=$this->purchaseorder_model->GetPOStatus($PONO); + $data['POItem'] = $this->purchaseorder_model->GetRevenuePurchaseOrderDetails($PONO); + $data['PaymentTerms']=$this->purchaseorder_model->GetPaymentTerms($PONO); + $this->global['pageTitle'] = 'Resico : Edit Revenue Purchase order form'; + $this->loadViews("editRevenueAmendPO", $this->global, $data, NULL); } - else if($ReqType == IMPORT) { - - $AvlBudget = $this->purchaseorder_model->GetAvailableImportBudgetAmount($CostCode,$FYdt,$ReqType); - - //print_r($AvlBudget); - if(count($AvlBudget)>0) - { - $data['AvlBudAmt'] = $AvlBudget[0]['BudgetAmount'] - $AvlBudget[0]['Totalvalue']; - } - // print_r($data); - $data['POItem'] = $this->purchaseorder_model->GetImportPurchaseOrderDetails($PONO); - $data['Currency']=$this->purchaseorder_model->GetCurrencytype(); - $data['PoTypeOptions'] = $this->purchaseorder_model->getConfigValue('C026'); + 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(); + $data['PoTypeOptions'] = $this->purchaseorder_model->getConfigValue('C026'); - foreach($data['POMaster'] as $CUR) - { - - //print_r($CUR->CurrencyType); - $Currency=$CUR->CurrencyType; - - } - // $data[$Rate->ExchangeRate]=$Rate->ExchangeRate; - $data['CurrencyDetail']=$this->purchaseorder_model->GetCurrencyDetail($Currency); - $data['PaymentTerms']=$this->purchaseorder_model->GetPaymentTerms($PONO); - $data['INRSYMBOL']=$this->purchaseorder_model->GetINRCurrencytype('INR'); - //print_r($data['PaymentTerms']); - $unicode =''; - foreach ($data['CurrencyDetail'] as $Detail) - { - $unicode=$Detail->FontCode2000; - } + foreach($data['POMaster'] as $CUR) + { + $Currency=$CUR->CurrencyType; + } + + $data['CurrencyDetail']=$this->purchaseorder_model->GetCurrencyDetail($Currency); + $data['PaymentTerms']=$this->purchaseorder_model->GetPaymentTerms($PONO); + $data['INRSYMBOL']=$this->purchaseorder_model->GetINRCurrencytype('INR'); + + $unicode =''; + foreach ($data['CurrencyDetail'] as $Detail) + { + $unicode=$Detail->FontCode2000; + } - foreach ($data['CurrencyDetail'] as $Detail) - { - $currencycode=$Detail->Currency_Code; - } + foreach ($data['CurrencyDetail'] as $Detail) + { + $currencycode=$Detail->Currency_Code; + } - //print_r($unicode); - $data['unicode']=$unicode; - $data['currencycode']=$currencycode; - $this->global['pageTitle'] = 'Resico : Edit Import Purchase order form'; - $this->loadViews("editImportAmendPO", $this->global, $data, NULL); + + $data['unicode']=$unicode; + $data['currencycode']=$currencycode; + $this->global['pageTitle'] = 'Resico : Edit Import Purchase order form'; + $this->loadViews("editImportAmendPO", $this->global, $data, NULL); } else if($ReqType == CAPITAL) { - $CapitalRange = $_GET['CapitalRange']; - - $CapitalAvlBudget = $this->purchaseorder_model->GetAvailableCapitalBudgetAmount($CostCode,$FYdt,$ReqType); - - - if(count($CapitalAvlBudget)>0) - { - - - $data['AvlCapitalBudAmt'] = $CapitalAvlBudget[0]['BudgetAmount'] - $CapitalAvlBudget[0]['Totalvalue']; + $CapitalRange = $_GET['CapitalRange']; + $CapitalAvlBudget = $this->purchaseorder_model->GetAvailableCapitalBudgetAmount($CostCode,$FYdt,$ReqType); - } - if($CapitalRange=='0'){ + if(count($CapitalAvlBudget)>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); - - + $data['requestedBy'] = $this->purchaseorder_model->GetRequesedByDetails($PONO); + $CapitalRange=''; - $CapitalRange=''; - - foreach($data['POItem'] as $Rate) - { - - - $exRate=$Rate->ExchangeRate; + 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['CurrencyDetail']=$this->purchaseorder_model->GetCurrencyDetail($Currency); $data['ExchangeRate']=$exRate; - $data['Currency']=$this->purchaseorder_model->GetCurrencytype(); - } - else if($CapitalRange=='1'){ + } + else if($CapitalRange=='1'){ $data['CurrencyDetail']=''; - $data['ExchangeRate']=$exRate; - $data['Currency']=$this->purchaseorder_model->GetCurrencytype(); - } - - - $this->global['pageTitle'] = 'Resico : Edit Capital Purchase order form'; - $this->loadViews("editCapitalAmendPO", $this->global, $data, NULL); - } + } + $this->global['pageTitle'] = 'Resico : Edit Capital Purchase order form'; + $this->loadViews("editCapitalAmendPO", $this->global, $data, NULL); + } } - + /** + * To Store release Revenue Po values after edit + */ function EditRevenuePurchaseOrder() { $NewPO=''; $MAD=''; - $PONO =$this->input->post('txtPONO'); - // echo "Revenue Amendment"; - // echo "OLD PO IS" . $PONO; - $POdt =$this->input->post('PODate'); $PODate = $this->getDateformat($POdt); $SupplierID = $this->input->post('drpSupplier'); @@ -271,17 +233,16 @@ class amendmentpurchaseorder extends BaseController $dt = $this->input->post('Deliverydt'); $predeliverydate=$this->input->post('beforeDeliverydt'); $preschedule=$this->input->post('beforeScheduleby'); - //$Deliverydt = $this->getDateformat($dt); $DeliverySchedule1 = $this->input->post('Scheduleby'); $DeliveryOption = $this->input->post('DateRange'); if($DeliveryOption==1){ - $Deliverydt=null; - $DeliverySchedule = $this->input->post('Scheduleby'); + $Deliverydt=null; + $DeliverySchedule = $this->input->post('Scheduleby'); } else{ - $Deliverydt = $this->getDateformat($dt); - $DeliverySchedule = ''; + $Deliverydt = $this->getDateformat($dt); + $DeliverySchedule = ''; } $Modeofshipment=$this->input->post('addmodeofshipment'); @@ -292,19 +253,17 @@ class amendmentpurchaseorder extends BaseController $revenuetype=$this->input->post('PoTypeOptions'); $insurancestatus=$this->input->post('insurancestatus'); if($insurancestatus == 1){ - $insuranceno=$this->input->post('insuranceno'); + $insuranceno=$this->input->post('insuranceno'); }else{ - $insuranceno=""; + $insuranceno=""; } - $POType = $this->input->post('POType'); $PoRange = $this->input->post('Range'); $PaymentTermsText=$this->input->post('beforePaymentTermsText'); $PaymentTerms=$this->input->post('PaymentTerms'); $Otherpayment=$this->input->post('Otherpayment'); $Otherpaymentamend=$this->input->post('Otherpayment'); - //echo $Otherpayment; $prePaymentTerms=$this->input->post('beforePaymentTerms'); $preTotalOdervalue=$this->input->post('preTotalOdervalue'); $MAD.="Amended TotalOrder Value:  :" . $preTotalOdervalue ."
"; @@ -312,27 +271,19 @@ class amendmentpurchaseorder extends BaseController if($PaymentTerms!=$prePaymentTerms) { if($prePaymentTerms != 'PT08'){ $Otherpaymentamend='';} - $MAD.="Amended PaymentTerms :  ". $PaymentTermsText . $Otherpaymentamend ."
"; + $MAD.="Amended PaymentTerms :  ". $PaymentTermsText . $Otherpaymentamend ."
"; } if(($dt != $predeliverydate)|| ($DeliverySchedule1 != $preschedule)) { - - - $MAD.='Amended Delivery Option :    ' . $predeliverydate . $preschedule . '
' ; + $MAD.='Amended Delivery Option :    ' . $predeliverydate . $preschedule . '
' ; } - $SpecialInstruction = $this->input->post('txtSpcialInstruction');//$_POST['txtSpcialInstruction'];//$this->input->post('txtSpcialInstruction');//t->post('txtSpcialInstruction')); - - //echo $MAD; - + $SpecialInstruction = $this->input->post('txtSpcialInstruction'); $TotalOrderValueSummary = $this->input->post('txtTotalOrderValueSummary'); $POStatus = $this->input->post('txtStatus'); - $updatedBy = $this->session->userdata ( 'userId' ); - $RowCount = $this->input->post('txtRowCount'); - $dtt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $updateddt = $dtt->format('Y-m-d H:i:s'); if(empty($Deliverydt)) @@ -345,38 +296,22 @@ class amendmentpurchaseorder extends BaseController } - $POMaster = array('ParentPO'=>$PONO,'SupplierID'=>$SupplierID,'POType'=>$POType,'PORange'=>$PoRange,'TotalOrderValue'=>$TotalOrderValueSummary,'PODate'=>$PODate,'Status'=>PO_RELEASED,'PaymentTerms'=>$PaymentTerms,'PaymentOtherDescription'=>$Otherpayment,'Mode_Of_Shipment'=>$Modeofshipment,'Supplier_Reference'=>$supplierreference,'Supplier_Offer_No'=>$supplieroffno,'Other_Reference'=>$otherreference,'Fincap'=>$fincap,'InsuranceStatus'=>$insurancestatus,'InsuranceNumber'=>$insuranceno,'POSubType'=>$revenuetype,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'ServiceDescription'=>$SpecialInstruction,'CreatedBy'=>$updatedBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'UpdatedOn'=>$updateddt,'ReleasedBy'=>$updatedBy,'ReleasedOn'=>$updateddt,'AmendedDetails'=>$MAD); - //print_r($POMaster); - - - - $LastPO = $this->purchaseorder_model->addAmendPOMaster($POMaster,$updatedBy,$PONO); - if(count($LastPO)>0) - { + $POMaster = array('ParentPO'=>$PONO,'SupplierID'=>$SupplierID,'POType'=>$POType,'PORange'=>$PoRange,'TotalOrderValue'=>$TotalOrderValueSummary,'PODate'=>$PODate,'Status'=>PO_RELEASED,'PaymentTerms'=>$PaymentTerms,'PaymentOtherDescription'=>$Otherpayment,'Mode_Of_Shipment'=>$Modeofshipment,'Supplier_Reference'=>$supplierreference,'Supplier_Offer_No'=>$supplieroffno,'Other_Reference'=>$otherreference,'Fincap'=>$fincap,'InsuranceStatus'=>$insurancestatus,'InsuranceNumber'=>$insuranceno,'POSubType'=>$revenuetype,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'ServiceDescription'=>$SpecialInstruction,'CreatedBy'=>$updatedBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'UpdatedOn'=>$updateddt,'ReleasedBy'=>$updatedBy,'ReleasedOn'=>$updateddt,'AmendedDetails'=>$MAD); + $LastPO = $this->purchaseorder_model->addAmendPOMaster($POMaster,$updatedBy,$PONO); + if(count($LastPO)>0) + { $NewPO = $LastPO[0]['PONO']; - } + } - //echo "NEW PO IS " . $NewPO; - //echo ""; - //change old po status as Amendment - $PODetail=array('Status'=>PO_AMENDED);//TO SET PARENT PO AS AMENDMENT STATUS - //print_r($PODetail); - $APO=$this->purchaseorder_model->updateAmendPOMaster($PONO,$PODetail); - //echo $APO."Affected"; - //die(); - //print_r($LastPO); + $PODetail=array('Status'=>PO_AMENDED);//TO SET PARENT PO AS AMENDMENT STATUS + $APO=$this->purchaseorder_model->updateAmendPOMaster($PONO,$PODetail); - $LineItemStatus = REQITEM_NEW; - + $LineItemStatus = REQITEM_NEW; + for ($i = 1; $i <= $RowCount; $i++) + { - //echo 'before for loop'; - //echo $RowCount; - - for ($i = 1; $i <= $RowCount; $i++) - { - //echo "inside loop"; $CAD=''; $MaterialCode = $this->input->post('materialCode'.$i); $Quantity = $this->input->post('quantity'.$i); @@ -440,22 +375,22 @@ class amendmentpurchaseorder extends BaseController if(($Quantity-$preqty)!=0) { - $rowspanvalue++; - $CAD.="Amended Quantity : ".$preqty ."Current Qty : ".$Quantity.""; + $rowspanvalue++; + $CAD.="Amended Quantity : ".$preqty ."Current Qty : ".$Quantity.""; } if(($itemRate-$preitemrate)!=0) { - $rowspanvalue++; - $CAD.="Amended Rate : " . $preitemrate."Current Item Rate : ".$itemRate.""; + $rowspanvalue++; + $CAD.="Amended Rate : " . $preitemrate."Current Item Rate : ".$itemRate.""; } if($DiscountType != $beforeDiscountType){ - $rowspanvalue++; - $CAD.="Amended DiscountType : " . $beforeDiscountType."Current DiscountType : ".$DiscountType.""; + $rowspanvalue++; + $CAD.="Amended DiscountType : " . $beforeDiscountType."Current DiscountType : ".$DiscountType.""; } if(($DiscountValue-$preDiscountValue)!=0) { - $rowspanvalue++; - $CAD.="Amended Discount : ". $preDiscountValue ."Current Discount : ".$DiscountValue.""; + $rowspanvalue++; + $CAD.="Amended Discount : ". $preDiscountValue ."Current Discount : ".$DiscountValue.""; } if(($AfterDiscount-$beforeAfterDiscount)!=0) { @@ -469,53 +404,53 @@ class amendmentpurchaseorder extends BaseController if(($PackagingValue-$prePackagingValue)!=0) { $rowspanvalue++; - $CAD.="Amended Package Value : ". $prePackagingValue."Current Package Value : ".$PackagingValue.""; + $CAD.="Amended Package Value : ". $prePackagingValue."Current Package Value : ".$PackagingValue.""; } if(($AfterPackagingValue-$beforeAfterPackagingValue)!=0) { $rowspanvalue++; - $CAD.="Amended Package Value : ". $beforeAfterPackagingValue."Current Package Value : ".$AfterPackagingValue.""; + $CAD.="Amended Package Value : ". $beforeAfterPackagingValue."Current Package Value : ".$AfterPackagingValue.""; } if(($VatValue-$preVatValue)!=0)//SGST { $rowspanvalue++; - $CAD.="Amended SGST : ". $preVatValue."Current SGST : ".$VatValue.""; + $CAD.="Amended SGST : ". $preVatValue."Current SGST : ".$VatValue.""; } if(($AfterVatValue-$beforeAfterVatValue)!=0)//SGST { $rowspanvalue++; - $CAD.="Amended SGST value : ". $beforeAfterVatValue."Current SGST Value : ".$AfterVatValue.""; + $CAD.="Amended SGST value : ". $beforeAfterVatValue."Current SGST Value : ".$AfterVatValue.""; } if(($GSTValue-$preGSTValue)!=0)//CGST { $rowspanvalue++; - $CAD.="Amended CGST : ". $preGSTValue."Current CGST : ".$GSTValue.""; + $CAD.="Amended CGST : ". $preGSTValue."Current CGST : ".$GSTValue.""; } if(($AfterGSTValue-$beforeAfterGSTValue)!=0)//CGST { $rowspanvalue++; - $CAD.="Amended CGST Value : ". $beforeAfterGSTValue."Current CGST Value : ".$AfterGSTValue.""; + $CAD.="Amended CGST Value : ". $beforeAfterGSTValue."Current CGST Value : ".$AfterGSTValue.""; } if(($OtherTaxValue-$preOtherTaxValue)!=0)//IGST { $rowspanvalue++; - $CAD.="Amended IGST : ". $preOtherTaxValue."Current IGST : ".$OtherTaxValue.""; + $CAD.="Amended IGST : ". $preOtherTaxValue."Current IGST : ".$OtherTaxValue.""; } if(($AfterOtherTaxValue-$beforeAfterOtherTaxValue)!=0)//IGST { $rowspanvalue++; - $CAD.="Amended IGST : ". $beforeAfterOtherTaxValue."Current IGST : ".$AfterOtherTaxValue.""; + $CAD.="Amended IGST : ". $beforeAfterOtherTaxValue."Current IGST : ".$AfterOtherTaxValue.""; } if($FreightType != $beforeFreightType){ $rowspanvalue++; $CAD.="Amended Freight Type : ". $beforeFreightType."Current Freight Type : ".$FreightType.""; } if(($FreightType=="PER TRIP") || ($beforeFreightType=="PER TRIP")){ - if($NoofTrips != $beforeNoofTrips) - { + if($NoofTrips != $beforeNoofTrips) + { $rowspanvalue++; $CAD.="Amended No of Trips : ". $beforeNoofTrips."Current No of Trips : ".$NoofTrips.""; - } + } } if(($FreightValue-$preFreightValue)!=0) @@ -533,54 +468,46 @@ class amendmentpurchaseorder extends BaseController if(($InsuranceValue-$preInsuranceValue)!=0) { $rowspanvalue++; - $CAD.="Amended Insurance Value : ". $preInsuranceValue."Current Insurance Value : ".$InsuranceValue.""; + $CAD.="Amended Insurance Value : ". $preInsuranceValue."Current Insurance Value : ".$InsuranceValue.""; } if($rowspanvalue>0) { $rowspanvalue++; - $CAD2=''; $CAD2=$CAD; $CAD=''; $CAD="".$MaterialCode.""; $CAD.=$CAD2; } - // echo $CAD; - // die(); - $ReceivedQty = $this->purchaseorder_model->GetLineItemReceivedQty($PONO,$MaterialCode); - + $ReceivedQty = $this->purchaseorder_model->GetLineItemReceivedQty($PONO,$MaterialCode); if(count($ReceivedQty)>0) - { + { $RecQtyvalue = $ReceivedQty[0]['ReceivedQuantity']; - } + } - - - $POLineItemList = array('PONO'=>$NewPO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'ReceivedQuantity'=>$RecQtyvalue,'Quantity'=>$Quantity,'Per'=>$per,'ServiceMaterialDescription'=>$servicematerialdescription,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'CreatedBy'=>$updatedBy,'CreatedDate'=>$updateddt,'CostCenterCode'=>$CostCenter,'ServiceFrequency'=>$ServiceFrequency,'AmendedDetails'=>$CAD); - //print_r($POLineItemList); + $POLineItemList = array('PONO'=>$NewPO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'ReceivedQuantity'=>$RecQtyvalue,'Quantity'=>$Quantity,'Per'=>$per,'ServiceMaterialDescription'=>$servicematerialdescription,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'CreatedBy'=>$updatedBy,'CreatedDate'=>$updateddt,'CostCenterCode'=>$CostCenter,'ServiceFrequency'=>$ServiceFrequency,'AmendedDetails'=>$CAD); - $POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList); + $POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList); - if(count($POLineItem)>0) - { + if(count($POLineItem)>0) + { $LineItemNo = $POLineItem[0]['LineItemNo']; - } + } - $RevenueTaxList = array('LineItemNo'=>$LineItemNo, 'DiscountType'=>$DiscountType,'DiscountValue'=>$DiscountValue,'AfterDiscount'=>$AfterDiscount,'PackagingType'=>$PackagingType,'PackagingValue'=>$PackagingValue,'PackagingCalulatedOn'=>$PackagingOption,'AfterPackagingValue'=>$AfterPackagingValue,'FreightType'=>$FreightType,'NoOfTrip'=>$NoofTrips,'FreightValue'=>$FreightValue,'AfterFreightValue'=>$AfterFreightValue,'SGST'=>$VatValue,'AfterSGST'=>$AfterVatValue,'CGST'=>$GSTValue,'AfterCGST'=>$AfterGSTValue,'IGST'=>$OtherTaxValue,'AfterIGST'=>$AfterOtherTaxValue,'Insurance'=>$InsuranceValue,'TotalValue'=>$TotalOrderValue, 'CreatedBy'=>$updatedBy,'CreatedDate'=>$updateddt); - // print_r($RevenueTaxList); - $RevenueList = $this->purchaseorder_model->addRevenueTax($RevenueTaxList); - - } + $RevenueTaxList = array('LineItemNo'=>$LineItemNo, 'DiscountType'=>$DiscountType,'DiscountValue'=>$DiscountValue,'AfterDiscount'=>$AfterDiscount,'PackagingType'=>$PackagingType,'PackagingValue'=>$PackagingValue,'PackagingCalulatedOn'=>$PackagingOption,'AfterPackagingValue'=>$AfterPackagingValue,'FreightType'=>$FreightType,'NoOfTrip'=>$NoofTrips,'FreightValue'=>$FreightValue,'AfterFreightValue'=>$AfterFreightValue,'SGST'=>$VatValue,'AfterSGST'=>$AfterVatValue,'CGST'=>$GSTValue,'AfterCGST'=>$AfterGSTValue,'IGST'=>$OtherTaxValue,'AfterIGST'=>$AfterOtherTaxValue,'Insurance'=>$InsuranceValue,'TotalValue'=>$TotalOrderValue, 'CreatedBy'=>$updatedBy,'CreatedDate'=>$updateddt); - echo 'Purchase Order Amended Successfully! PO Number Is: '.$PONO .'- New PO Number is'.$NewPO; - } + $RevenueList = $this->purchaseorder_model->addRevenueTax($RevenueTaxList); + + } + + echo 'Purchase Order Amended Successfully! PO Number Is: '.$PONO .'- New PO Number is'.$NewPO; + } - - - - -function UpdateAmendServicePurchaseOrder() + /** + * To Store release Service Po values after edit + */ + function UpdateAmendServicePurchaseOrder() { $PONO =$this->input->post('txtPONO'); @@ -588,75 +515,63 @@ function UpdateAmendServicePurchaseOrder() $MAD=''; $POdt =$this->input->post('PODate'); $PODate = $this->getDateformat($POdt); - //echo $PODate; - $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 =null; - $DeliverySchedule = $this->input->post('Scheduleby'); + $Deliverydt =null; + $DeliverySchedule = $this->input->post('Scheduleby'); } - else{ - $Deliverydt = $this->getDateformat($dt); - // echo "IF" . $Deliverydt; - $DeliverySchedule = ''; + else{ + $Deliverydt = $this->getDateformat($dt); + $DeliverySchedule = ''; } $ddate=$this->input->post('Deliverydt'); - $beforeddate=$this->input->post('beforeDeliverydt'); - $testdate=date("Y-m-d"); - $dschedule=$this->input->post('Scheduleby'); - $beforedschedule=$this->input->post('beforeScheduleby'); - $preTotalordervalue=$this->input->post('preTotalordervalue'); - $MAD.="Amended TotalOrder Value:  " . $preTotalordervalue . "
"; + if(($ddate != $beforeddate)||($dschedule != $beforedschedule)) { $MAD.="Amended DeliveryOption :  " . $beforeddate . $beforedschedule."
"; } - // if($dschedule != $beforedschedule) - // { - // $MAD.="Amended DeliveryOption :  " . $beforedschedule . $beforeddate."
"; - // } - $PaymentTermsText=$this->input->post('beforePaymentTermsText'); - $PaymentTerms=$this->input->post('PaymentTerms'); + $PaymentTerms=$this->input->post('PaymentTerms'); $Otherpayment=$this->input->post('Otherpayment'); $Otherpaymentamend=$this->input->post('Otherpayment'); $beforePaymentTerms=$this->input->post('beforePaymentTerms'); + if($PaymentTerms != $beforePaymentTerms) { if($beforePaymentTerms != 'PT08'){ $Otherpaymentamend='';} $MAD.="Amended PaymentTerms :  ". $PaymentTermsText . $Otherpaymentamend."
"; } - //echo "MAD IS" . $MAD . "
"; - $POType = $this->input->post('POType'); - + $POType = $this->input->post('POType'); $ModeOfShipment=$this->input->post('addmodeofshipment'); - $SupplierReference=$this->input->post('amendsupplierreference'); - $SuppliersOfferNo=$this->input->post('amendsupplierofferno'); - $OtherReferences=$this->input->post('amendotherreference'); - $Fincap=$this->input->post('amendfincap'); - $InsuranceOptions=$this->input->post('insuranceStatus'); - $InsuranceNo=$this->input->post('insuranceNo'); - $ServiceTypeOptions=$this->input->post('PoTypeOptions'); - $DescriptionOfPo = $this->input->post('amenddescofpo'); + $SupplierReference=$this->input->post('amendsupplierreference'); + $SuppliersOfferNo=$this->input->post('amendsupplierofferno'); + $OtherReferences=$this->input->post('amendotherreference'); + $Fincap=$this->input->post('amendfincap'); + $InsuranceOptions=$this->input->post('insuranceStatus'); + $InsuranceNo=$this->input->post('insuranceNo'); + $ServiceTypeOptions=$this->input->post('PoTypeOptions'); + $DescriptionOfPo = $this->input->post('amenddescofpo'); $scopeofwork = $this->input->post('ScopeofWork'); $TotalOrderValueSummary = $this->input->post('txtTotalOrderValueSummary'); $POStatus = $this->input->post('txtStatus'); $updatedBy = $this->session->userdata ( 'userId' ); $RowCount = $this->input->post('txtRowCount'); - //echo 'RowCount is' . $RowCount; + $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $updateddt = $dt->format('Y-m-d H:i:s'); $WorkStatus=$this->input->post('workstatus'); @@ -666,33 +581,28 @@ function UpdateAmendServicePurchaseOrder() $Deliverydt=null; } if($PaymentTerms != 'PT08'){ - $Otherpayment=''; - + $Otherpayment=''; } $POMaster = array('ParentPO'=>$PONO,'POType'=>$POType,'SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrderValueSummary,'PODate'=>$PODate,'Status'=>PO_RELEASED,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'ServiceDescription'=>$scopeofwork,'CreatedBy'=>$updatedBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'CreatedDate'=>$updateddt,'PaymentTerms'=>$PaymentTerms,'PaymentOtherDescription'=>$Otherpayment,'ServiceWorkStatus'=>$WorkStatus,'ReleasedBy'=>$updatedBy,'ReleasedOn'=>$updateddt,'AmendedDetails'=>$MAD,'Supplier_Reference'=>$SupplierReference,'Mode_Of_Shipment'=>$ModeOfShipment,'Supplier_Offer_No'=>$SuppliersOfferNo,'Other_Reference'=>$OtherReferences,'Fincap'=>$Fincap,'Description_Of_Service'=>$DescriptionOfPo,'InsuranceStatus'=>$InsuranceOptions,'InsuranceNumber'=>$InsuranceNo,'POSubType'=>$ServiceTypeOptions); - //print_r($POMaster); - $LastPO = $this->purchaseorder_model->addAmendPOMaster($POMaster,$updatedBy,$PONO); - //print_r($LastPO); - $NewPO = ''; - if(count($LastPO)>0) - { + + $NewPO = ''; + if(count($LastPO)>0) + { $NewPO = $LastPO[0]['PONO']; - } + } - $PODetail=array('Status'=>PO_AMENDED);//TO SET PARENT PO AS AMENDMENT STATUS + $PODetail=array('Status'=>PO_AMENDED);//TO SET PARENT PO AS AMENDMENT STATUS - $APO=$this->purchaseorder_model->updateAmendPOMaster($PONO,$PODetail); + $APO=$this->purchaseorder_model->updateAmendPOMaster($PONO,$PODetail); $LineItemStatus = REQITEM_NEW; for ($i = 1; $i <= $RowCount; $i++) { - - //echo "Inside Loop"; $CAD=''; $MaterialCode = $this->input->post('materialCode'.$i); $MaterialName=$this->input->post('materialName'.$i); @@ -717,7 +627,6 @@ function UpdateAmendServicePurchaseOrder() $otherallowance = $this->input->post('otherallowance'.$i); $beforeotherallowance = $this->input->post('beforeotherallowance'.$i); $servicematerialdescription = $this->input->post('servicematerialdescription'.$i); - $CostCenter = $this->input->post('costCode'.$i); $POLineItemNo = $this->input->post('LineItemNo'.$i); $TotalOrderValue = $this->input->post('TotalOrderValue'.$i); @@ -726,7 +635,8 @@ function UpdateAmendServicePurchaseOrder() $RecQtyvalue=0; $rowspanvalue=0; $ReceivedQty = $this->purchaseorder_model->GetLineItemReceivedQty($PONO,$MaterialCode); - if(count($ReceivedQty)>0) + + if(count($ReceivedQty)>0) { $RecQtyvalue = $ReceivedQty[0]['ReceivedQuantity']; } @@ -771,63 +681,50 @@ function UpdateAmendServicePurchaseOrder() $CAD="".$MaterialCode."-".$MaterialName.""; $CAD.=$CAD2; } - - //echo "
CAD IS" . $CAD . "
"; - + $POLineItemList = array('PONO'=>$NewPO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'ServiceMaterialDescription'=>$servicematerialdescription,'CreatedBy'=>$updatedBy,'CreatedDate'=>$updateddt,'CostCenterCode'=>$CostCenter,'ServiceFrequency'=>$ServiceFrequency,'ReceivedQuantity'=>$RecQtyvalue,'AmendedDetails'=>$CAD,'Per'=>$Per); - //print_r($POLineItemList); $POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList); - if(count($POLineItem)>0) - { - $LineItemNo = $POLineItem[0]['LineItemNo']; - } + if(count($POLineItem)>0) + { + $LineItemNo = $POLineItem[0]['LineItemNo']; + } - - $ServiceTaxList = array('LineItemNo'=>$LineItemNo,'CGST'=>$CGST,'After_CGST'=>$AfterCGST,'SGST'=>$SGST,'After_SGST'=>$AfterSGST,'IGST'=>$IGST,'After_IGST'=>$AfterIGST,'otherallowance'=>$otherallowance, 'TotalValue'=>$TotalOrderValue, 'CreatedBy'=>$updatedBy,'CreatedDate'=>$updateddt); - //print_r($ServiceTaxList); $ServiceList =$this->purchaseorder_model->addServiceTax($ServiceTaxList); } echo 'PO Number is'.$PONO . ' is Amended Successfully! - New Amended PO Number is '.$NewPO; } - + /** + * To Store Capital Po values after edit + */ function EditAmendCapitalPurchaseOrder() { - - - - $PONO =$this->input->post('txtPONO'); - //echo $PONO."--"; $MAD=''; $DeliverySchedule = ''; $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('Deliverydate'); - //echo $dt . "-"; - //die(); $POType = $this->input->post('POType'); $PoRange = $this->input->post('capitalType'); - $DeliveryOption = $this->input->post('DateRange'); $Deliverydt = ''; - if(($DeliveryOption==1)||($DeliveryOption==2)){ + if(($DeliveryOption==1)||($DeliveryOption==2)){ $Deliverydt = null; - + if($DeliveryOption==1){ - $DeliverySchedule = $this->input->post('Scheduleby');} - } - else{ - $Deliverydt = $this->getDateformat($dt); - + $DeliverySchedule = $this->input->post('Scheduleby');} + } + else{ + $Deliverydt = $this->getDateformat($dt); $DeliverySchedule = ''; - } + } $predispatch=$this->input->post('beforeDisins'); $curdispatch=$this->input->post('Dispatch'); @@ -845,23 +742,21 @@ function UpdateAmendServicePurchaseOrder() $Otherpaymentamend=$this->input->post('Otherpayment'); $PreServiceTotalorder = $this->input->post('preServiceTotalorderValue');//For Domestic Pre Total Value $Totalserviceorder = $this->input->post('Totalservicesummary');//For Domestic Current Total value - //echo "Tjb" . $Totalserviceorder."--" . $PreServiceTotalorder;die(); $TotalCapitalorder= $this->input->post('CapitalToatlOrder');//For International total CapitalOrder $preTotalCapitalorder= $this->input->post('preinterTotalorderValue');//For International pre total CapitalOrder - $ModeOfShipment=$this->input->post('addmodeofshipment'); - $SupplierReference=$this->input->post('amendsupplierreference'); - $SuppliersOfferNo=$this->input->post('amendsupplierofferno'); - $OtherReferences=$this->input->post('amendotherreference'); - $Fincap=$this->input->post('amendfincap'); - $InsuranceOptions=$this->input->post('insuranceStatus'); - $InsuranceNo=$this->input->post('insuranceNo'); - $ServiceTypeOptions=$this->input->post('PoTypeOptions'); - //echo $TotalCapitalorder . "-" . $preTotalCapitalorder; + $ModeOfShipment=$this->input->post('addmodeofshipment'); $SupplierReference=$this->input->post('amendsupplierreference'); + $SuppliersOfferNo=$this->input->post('amendsupplierofferno'); + $OtherReferences=$this->input->post('amendotherreference'); + $Fincap=$this->input->post('amendfincap'); + $InsuranceOptions=$this->input->post('insuranceStatus'); + $InsuranceNo=$this->input->post('insuranceNo'); + $ServiceTypeOptions=$this->input->post('PoTypeOptions'); + if($PoRange==1){ - $MAD.="Amended TotalOrder Value:  " . $PreServiceTotalorder . "
"; + $MAD.="Amended TotalOrder Value:  " . $PreServiceTotalorder . "
"; }else if($PoRange==0){ - $MAD.="Amended TotalOrder Value:  " . $preTotalCapitalorder . "
"; + $MAD.="Amended TotalOrder Value:  " . $preTotalCapitalorder . "
"; } if($PaymentMethod != $prePaymentmethod) @@ -881,79 +776,62 @@ function UpdateAmendServicePurchaseOrder() { $MAD.="Amended DeliveyOption :  " .$preDate.$preDeliverySchedule."
"; } - //echo "

" . $MAD; - //die(); - $capitalType = $this->input->post('capitalType'); - $currencytypeID = $this->input->post('currencytype'); - if($capitalType=='1'){ + $capitalType = $this->input->post('capitalType'); + $currencytypeID = $this->input->post('currencytype'); + if($capitalType=='1'){ $CapitalRange = '1'; - $ExchangeRateOn = ''; - $ExchangeRate=''; - - } - else{ - - $CapitalRange = '0'; - $ExchangeRateOn = $this->input->post('ExchangeRateOn'); - $ExchangeRateOn = $this->getDateformat($ExchangeRateOn); - $ExchangeRate=$this->input->post('ExchangeRt'); - } - - + $ExchangeRateOn = ''; + $ExchangeRate=''; + } + else{ + $CapitalRange = '0'; + $ExchangeRateOn = $this->input->post('ExchangeRateOn'); + $ExchangeRateOn = $this->getDateformat($ExchangeRateOn); + $ExchangeRate=$this->input->post('ExchangeRt'); + } + $SpcialInstruction = $this->input->post('txtSpcialInstruction'); if($PoRange==1){ - $FinalTotalOrder = $Totalserviceorder; + $FinalTotalOrder = $Totalserviceorder; }else if($PoRange==0) { $FinalTotalOrder=$TotalCapitalorder; - } - $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'); - //echo $RowCount; $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $createddt = $dt->format('Y-m-d H:i:s'); $updateddt = $dt->format('Y-m-d H:i:s'); - //echo "FINAL-".$Deliverydt; + if(empty($Deliverydt)){ $Deliverydt=null; - //echo "*INSIDE IF" .$Deliverydt; } - // echo "*" .$Deliverydt; + if($PaymentMethod != 'PT08'){ $Otherpayment=''; } - $updatedBy = $this->session->userdata ( 'userId' ); + $updatedBy = $this->session->userdata ( 'userId' ); $POMaster = array('ParentPO'=>$PONO,'SupplierID'=>$SupplierID, 'TotalOrderValue'=>$FinalTotalOrder,'POType'=>$POType,'PODate'=>$PODate,'Status'=>PO_RELEASED,'CapitalRange'=>$PoRange,'ExchangeRate'=>$ExchangeRate,'ExchangeRateCalculatedon'=>$ExchangeRateOn,'PaymentTerms'=>$PaymentMethod,'PaymentOtherDescription'=>$Otherpayment,'ServiceDescription'=>$SpcialInstruction,'CreatedBy'=>$CreateBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'CreatedDate'=>$createddt,'ReleasedBy'=>$updatedBy,'ReleasedOn'=>$updateddt,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'CurrencyType'=>$currencytypeID,'AmendedDetails'=>$MAD,'Import_DispatchDetails'=>$curdispatch,'Import_PlaceofOrgin'=>$PlaceOforigin,'Supplier_Reference'=>$SupplierReference,'Mode_Of_Shipment'=>$ModeOfShipment,'Supplier_Offer_No'=>$SuppliersOfferNo,'Other_Reference'=>$OtherReferences,'Fincap'=>$Fincap,'InsuranceStatus'=>$InsuranceOptions,'InsuranceNumber'=>$InsuranceNo,'POSubType'=>$ServiceTypeOptions); - // print_r($POMaster); - - $LastPO = $this->purchaseorder_model->addAmendPOMaster($POMaster,$CreateBy,$PONO); + $LastPO = $this->purchaseorder_model->addAmendPOMaster($POMaster,$CreateBy,$PONO); - foreach($LastPO as $PO): + foreach($LastPO as $PO): $NewPO=$PO['PONO']; - endforeach; - - // echo "NEW PO IS " . $NewPO."
"; - - - $PODetail=array('Status'=>PO_AMENDED);//TO SET PARENT PO AS AMENDMENT STATUS - //print_r($PODetail); - $APO=$this->purchaseorder_model->updateAmendPOMaster($PONO,$PODetail); - // echo $APO."Affected
"; - - $LineItemStatus = REQITEM_NEW; - + endforeach; + $PODetail=array('Status'=>PO_AMENDED);//TO SET PARENT PO AS AMENDMENT STATUS + + $APO=$this->purchaseorder_model->updateAmendPOMaster($PONO,$PODetail); - //echo "Before Loopp"; - for ($i = 1; $i <= $RowCount; $i++) - { + $LineItemStatus = REQITEM_NEW; + + for ($i = 1; $i <= $RowCount; $i++) + { $CAD=''; $MaterialCode = $this->input->post('materialCode'.$i); @@ -962,7 +840,7 @@ function UpdateAmendServicePurchaseOrder() $Reqnumber = $this->input->post('Reqnumber'.$i); $preitemRate = $this->input->post('itemRate'.$i); $itemRate = $this->input->post('rateInUs'.$i); - $Per = $this->input->post('per'.$i); + $Per = $this->input->post('per'.$i); $Exchangerate = $this->input->post('echangeRate'.$i); $BasicPriceinmton = $this->input->post('rateInUs'.$i); $Productprice = $this->input->post('basicvalInINR'.$i); @@ -1012,22 +890,17 @@ function UpdateAmendServicePurchaseOrder() $ClearingCharge = $this->input->post('ClearingCharge'.$i); - $NetValue = $this->input->post('NetValue'.$i); + $NetValue = $this->input->post('NetValue'.$i); - $DutyImpact=$this->input->post('DutyImpact'.$i); + $DutyImpact=$this->input->post('DutyImpact'.$i); - - - - - //echo $BasicPriceinmton; $CostCenter = $this->input->post('CPCostCode'.$i); $SGST = $this->input->post('SGST'.$i); $preSGST = $this->input->post('beforeSGST'.$i); - $CGST = $this->input->post('CGST'.$i); + $CGST = $this->input->post('CGST'.$i); $preCGST = $this->input->post('beforeCGST'.$i); - $IGST = $this->input->post('IGST'.$i); + $IGST = $this->input->post('IGST'.$i); $preIGST = $this->input->post('beforeIGST'.$i); $SGSTvalue=$this->input->post('afterSGST'.$i); @@ -1037,42 +910,31 @@ function UpdateAmendServicePurchaseOrder() $IGSTvalue=$this->input->post('afterIGST'.$i); $preIGSTvalue=$this->input->post('beforeIGSTvalue'.$i); $otherallowance=$this->input->post('otherallowance'.$i); - $preotherallowance=$this->input->post('beforeotherallowance'.$i); - $DiscountType = $this->input->post('DisType'.$i); + $preotherallowance=$this->input->post('beforeotherallowance'.$i); + $DiscountType = $this->input->post('DisType'.$i); $DiscountValue = $this->input->post('DisVal'.$i); $AfterDiscount = $this->input->post('AfterDisVal'.$i); - $preDiscountType = $this->input->post('beforeDisType'.$i); + $preDiscountType = $this->input->post('beforeDisType'.$i); $preDiscountValue = $this->input->post('beforeDisVal'.$i); $preAfterDiscount = $this->input->post('beforeAfterDisVal'.$i); - $TotalServiceOrderValue = $this->input->post('totalservicevalue'.$i); - $CapitalItemDescrition = $this->input->post('CapitalItemDescrition'.$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); - $POLineItemNo = $this->input->post('LineItemNo'.$i); - + $TotalServiceOrderValue = $this->input->post('totalservicevalue'.$i); + $CapitalItemDescrition = $this->input->post('CapitalItemDescrition'.$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); + $POLineItemNo = $this->input->post('LineItemNo'.$i); $FreightTypeloc=$this->input->post('Ftype'.$i); $FreightNoofTriploc=$this->input->post('NoTrip'.$i); $Freightrateloc=$this->input->post('Fvalue'.$i); $FreightAmountloc=$this->input->post('Afvalue'.$i); - - $beforeFreightTypeloc=$this->input->post('beforeFtype'.$i); $beforeFreightNoofTriploc=$this->input->post('beforeNoTrip'.$i); $beforeFreightrateloc=$this->input->post('beforeFvalue'.$i); $beforeFreightAmountloc=$this->input->post('beforeAfvalue'.$i); - - - - - - - - $rowspanvalue=0; if($Quantity != $preQuantity) @@ -1080,158 +942,127 @@ function UpdateAmendServicePurchaseOrder() $rowspanvalue++; $CAD.="Amended Qty : " . $preQuantity ."Current Qty : " . $Quantity . ""; } - if($itemRate != $preitemRate) - { + if($itemRate != $preitemRate) + { $rowspanvalue++; $CAD.="Amended Rate : " . $preitemRate ."Current Rate : " . $itemRate . ""; - } + } if($PoRange==1){ - if(($DiscountValue!=$preDiscountValue) && ($AfterDiscount!=$preAfterDiscount)){ - $rowspanvalue+=2; - $CAD.="Amended Discount : " . $preDiscountValue ."Current Discount : " . $DiscountValue . "Amended Discount value : " . $preAfterDiscount ."Current Discount value: " . $AfterDiscount . ""; + if(($DiscountValue!=$preDiscountValue) && ($AfterDiscount!=$preAfterDiscount)){ + $rowspanvalue+=2; + $CAD.="Amended Discount : " . $preDiscountValue ."Current Discount : " . $DiscountValue . "Amended Discount value : " . $preAfterDiscount ."Current Discount value: " . $AfterDiscount . ""; } - if(($SGST != $preSGST) && ($SGSTvalue != $preSGSTvalue)) - { - $rowspanvalue+=2; - $CAD.="Amended SGST% : " . $preSGST ."Current SGST% : " . $SGST . "Amended SGST value : " . $preSGSTvalue ."Current SGST value: " . $SGSTvalue . ""; - } - if(($CGST != $preCGST) && ($CGSTvalue != $preCGSTvalue)) - { - $rowspanvalue+=2; - $CAD.="Amended CGST% : " . $preCGST ."Current CGST% : " . $CGST . "Amended CGST value : " . $preCGSTvalue ."Current CGST value: " . $CGSTvalue . ""; - } - if(($IGST != $preIGST) && ($IGSTvalue != $preIGSTvalue)) - { - $rowspanvalue+=2; - $CAD.="Amended IGST% : " . $preIGST ."Current IGST% : " . $IGST . "Amended IGST value : " . $preIGSTvalue ."Current IGST value: " . $IGSTvalue . ""; - } - if($otherallowance != $preotherallowance) - { - $rowspanvalue++; - $CAD.="Amended OtherAllowances : " . $preotherallowance ."Current OtherAllowances : " . $otherallowance . ""; - } + if(($SGST != $preSGST) && ($SGSTvalue != $preSGSTvalue)) + { + $rowspanvalue+=2; + $CAD.="Amended SGST% : " . $preSGST ."Current SGST% : " . $SGST . "Amended SGST value : " . $preSGSTvalue ."Current SGST value: " . $SGSTvalue . ""; + } + if(($CGST != $preCGST) && ($CGSTvalue != $preCGSTvalue)) + { + $rowspanvalue+=2; + $CAD.="Amended CGST% : " . $preCGST ."Current CGST% : " . $CGST . "Amended CGST value : " . $preCGSTvalue ."Current CGST value: " . $CGSTvalue . ""; + } + if(($IGST != $preIGST) && ($IGSTvalue != $preIGSTvalue)) + { + $rowspanvalue+=2; + $CAD.="Amended IGST% : " . $preIGST ."Current IGST% : " . $IGST . "Amended IGST value : " . $preIGSTvalue ."Current IGST value: " . $IGSTvalue . ""; + } + if($otherallowance != $preotherallowance) + { + $rowspanvalue++; + $CAD.="Amended OtherAllowances : " . $preotherallowance ."Current OtherAllowances : " . $otherallowance . ""; + } + if($FreightTypeloc != $beforeFreightTypeloc) + { + $rowspanvalue++; + $CAD.="Amended Freight Type : " . $beforeFreightTypeloc ."Current Qty : " . $FreightTypeloc . ""; + } + if($FreightNoofTriploc != $beforeFreightNoofTriploc) + { + $rowspanvalue++; + $CAD.="Amended Freight Nooftrips : " . $beforeFreightNoofTriploc ."Current Freight Nooftrips: " . $FreightNoofTriploc . ""; + } + if($Freightrateloc != $beforeFreightrateloc) + { + $rowspanvalue++; + $CAD.="Amended Freight Rate : " . $beforeFreightrateloc ."Current Freight Rate: " . $Freightrateloc . ""; + } - if($FreightTypeloc != $beforeFreightTypeloc) - { - $rowspanvalue++; - $CAD.="Amended Freight Type : " . $beforeFreightTypeloc ."Current Qty : " . $FreightTypeloc . ""; - } + if($FreightAmountloc != $beforeFreightAmountloc) + { + $rowspanvalue++; + $CAD.="Amended Freight Amount : " .$beforeFreightAmountloc ."Current Freight Amount: " . $FreightAmountloc . ""; + } - - - if($FreightNoofTriploc != $beforeFreightNoofTriploc) - { - $rowspanvalue++; - $CAD.="Amended Freight Nooftrips : " . $beforeFreightNoofTriploc ."Current Freight Nooftrips: " . $FreightNoofTriploc . ""; - } - - - - if($Freightrateloc != $beforeFreightrateloc) - { - $rowspanvalue++; - $CAD.="Amended Freight Rate : " . $beforeFreightrateloc ."Current Freight Rate: " . $Freightrateloc . ""; - } - - - if($FreightAmountloc != $beforeFreightAmountloc) - { - $rowspanvalue++; - $CAD.="Amended Freight Amount : " .$beforeFreightAmountloc ."Current Freight Amount: " . $FreightAmountloc . ""; - } - - - if(($Assable-$beforeAssable)!=0) - { - //$CAD=$CAD."Amended CustomDuty :".$beforeCustomDuty ."
"; - $rowspanvalue++; - $CAD=$CAD."Amended Assessable : ".$beforeAssable ."Current CustomDuty:".$Assable.""; - } - - - - if(($Subtotal-$beforeSubtotal)!=0) - { - //$CAD=$CAD."Amended CustomDuty :".$beforeCustomDuty ."
"; - $rowspanvalue++; - $CAD=$CAD."Amended Subtotal : ".$beforeSubtotal ."Current Subtotal:".$Subtotal.""; - } - - - - if(($Igst-$beforeIgst)!=0) - { - //$CAD=$CAD."Amended CustomDuty :".$beforeCustomDuty ."
"; - $rowspanvalue++; - $CAD=$CAD."Amended IGST Percentage : ".$beforeIgst ."Current IGST Percentage:".$Igst.""; - } - - - - - - } - if($rowspanvalue>0) - { - $rowspanvalue++; - $CAD2=''; - $CAD2=$CAD; - $CAD=''; - $CAD="".$MaterialCode.""; - $CAD.=$CAD2; - } + if(($Assable-$beforeAssable)!=0) + { - - - $POLineItemList = array('PONO'=>$NewPO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'CostCenterCode'=>$CostCenter,'AmendedDetails'=>$CAD,'Per'=>$Per,'ServiceMaterialDescription'=>$CapitalItemDescrition); - - - $POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList); - - $LineItemNo = ''; + $rowspanvalue++; + $CAD=$CAD."Amended Assessable : ".$beforeAssable ."Current CustomDuty:".$Assable.""; + } + + if(($Subtotal-$beforeSubtotal)!=0) + { + + $rowspanvalue++; + $CAD=$CAD."Amended Subtotal : ".$beforeSubtotal ."Current Subtotal:".$Subtotal.""; + } + + if(($Igst-$beforeIgst)!=0) + { + + $rowspanvalue++; + $CAD=$CAD."Amended IGST Percentage : ".$beforeIgst ."Current IGST Percentage:".$Igst.""; + } + + } + if($rowspanvalue>0) + { + $rowspanvalue++; + $CAD2=''; + $CAD2=$CAD; + $CAD=''; + $CAD="".$MaterialCode.""; + $CAD.=$CAD2; + } + + $POLineItemList = array('PONO'=>$NewPO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'CostCenterCode'=>$CostCenter,'AmendedDetails'=>$CAD,'Per'=>$Per,'ServiceMaterialDescription'=>$CapitalItemDescrition); + $POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList); + $LineItemNo = ''; - foreach($POLineItem as $line): + foreach($POLineItem as $line): $LineItemNo = $line['LineItemNo']; - endforeach; + endforeach; - if(trim($POType) == CAPITAL ) - { - if($capitalType=='1'){ + if(trim($POType) == CAPITAL ) + { + if($capitalType=='1'){ $ServiceTaxList = array('LineItemNo'=>$LineItemNo, 'CGST'=>$CGST,'After_CGST'=>$CGSTvalue,'SGST'=>$SGST,'After_SGST'=>$SGSTvalue,'IGST'=>$IGST,'After_IGST'=>$IGSTvalue, 'otherallowance'=>$otherallowance,'TotalValue'=>$TotalServiceOrderValue,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'discount'=>$DiscountType,'discountval'=>$DiscountValue,'Afterdiscountval'=>$AfterDiscount,'FreightType'=>$FreightTypeloc,'NoOfTrip'=>$FreightNoofTriploc,'FreightValue'=>$Freightrateloc,'AfterFreightValue'=>$FreightAmountloc); - $ServiceTax = $this->purchaseorder_model->addServiceTax($ServiceTaxList); - } //echo "Service"; - else if($capitalType=='0'){ //print_r($ServiceTax); + } + else if($capitalType=='0'){ $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'=>$FreightValue,'AfterFreightValue'=>$AfterFreightValue,'AssessableValue'=>$Assable,'SubTotal'=>$Subtotal,'IGST'=>$Igst,'AfterIGST'=>$AfterIgst,'DutyImpact'=>$DutyImpact,'NetValue'=>$NetValue,'ClearingCharge'=>$ClearingCharge); - - $ImportList = $this->purchaseorder_model->addImportTax($ImportTaxList); - } - - } - - - - } + } + } + + } echo 'Purchase Order'.$PONO.'Amended Successfully! New PO Number Is: '.$NewPO ; } - - function EditAmendImportPO() + /** + * To Store release import Po values after edit + */ + function EditAmendImportPO() { - - - //echo 'dsds'; - //die(); - $MAD=''; + $MAD=''; $PONO =$this->input->post('txtPONO'); - //echo $PONO; $POdt = ''; $createddt=''; @@ -1243,14 +1074,13 @@ function UpdateAmendServicePurchaseOrder() $Deliverydt = $this->getDateformat($dt); $POType = $this->input->post('POType'); $PoRange = $this->input->post('txtPoRange'); - //$DeliveryOption = $this->input->post('DateRange'); + $updatedBy = $this->session->userdata ( 'userId' ); - $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'); @@ -1269,17 +1099,12 @@ function UpdateAmendServicePurchaseOrder() $Dispatch = $this->input->post('Dispatch'); $DeliverySchedule = ''; } - - - $SpcialInstruction = $this->input->post('txtSpcialInstruction'); - // $TotalOrder = $this->input->post('txtTotalorderValue'); + $TotalOrder = $this->input->post('txttot'); $AmendTotal=$this->input->post('txttotamend'); $MAD.="Amended Total Order Value:  :" . $AmendTotal ."
"; - //$beforeTotalOrder=$this->input->post() - //echo "Total Order:".$TotalOrder; $POStatus = $this->input->post('txtStatus'); $CreateBy = $this->session->userdata ( 'userId' ); @@ -1304,78 +1129,50 @@ function UpdateAmendServicePurchaseOrder() $Insurance=$this->input->post('Insurance'); - if($Insurance=='YES') - { + if($Insurance=='YES') + { $Insurancenumber=$this->input->post('insurancenumber'); $insurestatus='1'; - } - else + } + else { - $Insurancenumber=''; - $insurestatus='0'; + $Insurancenumber=''; + $insurestatus='0'; } - - - $importoption=$this->input->post('Importoption'); - + $importoption=$this->input->post('Importoption'); if($PaymentTerms!=$beforePaymentTerms) { - //$MAD=$MAD."Amended Payment Terms:". $beforePaymentTerms ."
"; - $MAD.="Amended Payment Terms  " . $beforePaymentTerms."
"; + + $MAD.="Amended Payment Terms  " . $beforePaymentTerms."
"; } - //$Payableat=$this->input->post('PayableAT'); + $Palaceoforigin=$this->input->post('PlaceOforigin'); - $beforePalaceoforigin=$this->input->post('beforePlaceOforigin'); if($Palaceoforigin!=$beforePalaceoforigin) { - //$MAD=$MAD."Amended Place of Origin:". $beforePalaceoforigin ."
"; - $MAD.=$MAD."Amended Place of Origin:  " . $beforePalaceoforigin."
"; + + $MAD.=$MAD."Amended Place of Origin:  " . $beforePalaceoforigin."
"; } - //echo $MAD; - //die(); - - - - //echo $RowCount; - // PO Master - // PO Master + $POMaster = array('ParentPO'=>$PONO,'SupplierID'=>$SupplierID, 'POType'=>$POType,'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,'ReleasedBy'=>$updatedBy,'ReleasedOn'=>$updateddt,'Import_PlaceofOrgin'=>$Palaceoforigin,'Mode_Of_Shipment'=>$Shipmentmode,'Supplier_Reference'=>$SupplierRef,'Supplier_Offer_No'=>$SupplierOffer,'Other_Reference'=>$otherRef,'Fincap'=>$finCap,'AmendedDetails'=>$MAD,'PaymentOtherDescription'=>$OtherPayment,'InsuranceStatus'=>$insurestatus,'InsuranceNumber'=>$Insurancenumber,'POSubType'=>$importoption); - //print_r($POMaster); - //die(); - - // $POList = array('SupplierID'=>$Supp,lierID, '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); - - - //print_r($POMaster); - - $LastPO = $this->purchaseorder_model->addAmendPOMaster($POMaster,$CreateBy,$PONO); - $NewPO = ''; - if(count($LastPO)>0) - { + $LastPO = $this->purchaseorder_model->addAmendPOMaster($POMaster,$CreateBy,$PONO); + $NewPO = ''; + if(count($LastPO)>0) + { $NewPO = $LastPO[0]['PONO']; - } - - //echo $NewPO; + } - $PODetail=array('Status'=>PO_AMENDED);//TO SET PARENT PO AS AMENDMENT STATUS - // print_r($PODetail); - $APO=$this->purchaseorder_model->updateAmendPOMaster($PONO,$PODetail); - // echo "Affected Rows:"; - // print_r($APO); - - $LineItemStatus = REQITEM_NEW; - - + $PODetail=array('Status'=>PO_AMENDED);//TO SET PARENT PO AS AMENDMENT STATUS - //echo "Before Loop"; - for ($i = 1; $i <= $RowCount; $i++) - { - //echo "Inside Loop"; - // die(); + $APO=$this->purchaseorder_model->updateAmendPOMaster($PONO,$PODetail); + + $LineItemStatus = REQITEM_NEW; + + for ($i = 1; $i <= $RowCount; $i++) + { $CAD=''; $MaterialCode = $this->input->post('materialCode'.$i); $Quantity = $this->input->post('quantity'.$i); @@ -1385,68 +1182,45 @@ function UpdateAmendServicePurchaseOrder() $Reqnumber = $this->input->post('Reqnumber'.$i); $itemRate = $this->input->post('itemRate'.$i); $beforeitemRate=$this->input->post('beforeitemRate'.$i); - //$Exchangerate = $this->input->post('Exchangerate'.$i); + $BasicPriceinmton = $this->input->post('BasicPriceInMTon'.$i); $Productprice = $this->input->post('ProductPrice'.$i); $LandingCharge = $this->input->post('LandingCharge'.$i); $beforeLandingCharge = $this->input->post('beforeLandingCharge'.$i); - //echo $LandingCharge; - //echo $beforeitemRate; - // die(); - $AfterLandingCharge = $this->input->post('AfterLandingCharge'.$i); - $CustomDuty = $this->input->post('CustomDuty'.$i); $beforeCustomDuty=$this->input->post('beforeCustomDuty'.$i); $AfterCustomDuty = $this->input->post('AfterCustomDuty'.$i); - - $CustomEd= $this->input->post('CustomEdCess1'.$i); $beforeCustomEd=$this->input->post('beforeCustomEdCess'.$i); $AfterCustomEd= $this->input->post('AfterCustomEdCess1'.$i); - // echo $CustomEd; - // echo 're'; - // echo $AfterCustomEd; - $CustomSH = $this->input->post('CustomSHCess'.$i); $beforeCustomSH=$this->input->post('beforeCustomSHCess'.$i); $AfterCustomSH = $this->input->post('AfterCustomSHCess'.$i); - - $Grossdutypayable = $this->input->post('Grossdutypayable1'.$i); $beforeGrossdutypayable = $this->input->post('beforeGrossdutypayable'.$i); - //echo $Grossdutypayable; - - $Assable=$this->input->post('AssessableValue'.$i); $beforeAssable=$this->input->post('beforeAssessableValue'.$i); - - + $Subtotal=$this->input->post('SubTotal'.$i); $beforeSubtotal=$this->input->post('beforeSubTotal'.$i); $Igst=$this->input->post('IGST'.$i); $beforeIgst=$this->input->post('beforeIGST'.$i); $AfterIgst=$this->input->post('AfterIGST'.$i); - - - $CustomDutyExpensesPerKG = $this->input->post('CustomDutyExpensesPerKG'.$i); - $beforeCustomDutyExpensesPerKG = $this->input->post('beforeCustomDutyExpensesPerKG'.$i); - - - - + $CustomDutyExpensesPerKG = $this->input->post('CustomDutyExpensesPerKG'.$i); + $beforeCustomDutyExpensesPerKG = $this->input->post('beforeCustomDutyExpensesPerKG'.$i); $FreightType=$this->input->post('FreightType'.$i); $NoOfTrip=$this->input->post('NoOfTrip'.$i); @@ -1455,32 +1229,18 @@ function UpdateAmendServicePurchaseOrder() $per=$this->input->post('Per'.$i); - - $beforeFreightType=$this->input->post('beforeFreightType'.$i); $beforeNoOfTrip=$this->input->post('beforeNoOfTrip'.$i); $beforeFreightrate=$this->input->post('beforeFreightValue'.$i); $beforeFreightamount=$this->input->post('beforeAfterFreightValue'.$i); $beforeper=$this->input->post('beforePer'.$i); - // if($RMCIncludingCustomersPerKG-$beforeRMCIncludingCustomersPerKG ) - // { - // $CAD="Amended RMC Including Customs".$beforeRMCIncludingCustomersPerKG ."
"; - // } - - $QuantityKG = $this->input->post('QuantityKG'.$i); - - $ClearingCharge = $this->input->post('ClearingCharge'.$i); - - $NetValue = $this->input->post('NetValue'.$i); - - $DutyImpact=$this->input->post('DutyImpact'.$i); - - + $QuantityKG = $this->input->post('QuantityKG'.$i); + $ClearingCharge = $this->input->post('ClearingCharge'.$i); + $NetValue = $this->input->post('NetValue'.$i); + $DutyImpact=$this->input->post('DutyImpact'.$i); $specialinstruction=$this->input->post('Addinstruction'.$i); - - //$POLineItemNo = $this->input->post('LineItemNo'.$i); $CostCenter = $this->input->post('costCode'.$i); $Totalvalueitem=$this->input->post('txtTotalorderValue'); @@ -1490,147 +1250,108 @@ function UpdateAmendServicePurchaseOrder() if(($itemRate-$beforeitemRate)!=0) { - $rowspanvalue++; - //$CAD="Amended Quantity :".$beforeQuantity ."
"; - $CAD=$CAD."Amended Rate : ".$beforeitemRate ."Current Rate:".$itemRate.""; + $rowspanvalue++; + $CAD=$CAD."Amended Rate : ".$beforeitemRate ."Current Rate:".$itemRate.""; } if(($Quantity-$beforeQuantity)!=0) { - $rowspanvalue++; - //$CAD="Amended Quantity :".$beforeQuantity ."
"; - $CAD=$CAD."Amended Quantity : ".$beforeQuantity ."Current Quantity:".$Quantity.""; + $rowspanvalue++; + $CAD=$CAD."Amended Quantity : ".$beforeQuantity ."Current Quantity:".$Quantity.""; } if(($LandingCharge-$beforeLandingCharge)!=0) { - //$CAD=$CAD."Amended Landing :".$beforeLandingCharge ."
"; - $rowspanvalue++; - $CAD=$CAD."Amended Landing percentage : ".$beforeLandingCharge ."Current Landing Percentage:".$LandingCharge.""; + + $rowspanvalue++; + $CAD=$CAD."Amended Landing percentage : ".$beforeLandingCharge ."Current Landing Percentage:".$LandingCharge.""; } - - - if(($CustomDuty-$beforeCustomDuty)!=0) { - //$CAD=$CAD."Amended CustomDuty :".$beforeCustomDuty ."
"; - $rowspanvalue++; - $CAD=$CAD."Amended CustomDuty : ".$beforeCustomDuty ."Current CustomDuty:".$CustomDuty.""; + + $rowspanvalue++; + $CAD=$CAD."Amended CustomDuty : ".$beforeCustomDuty ."Current CustomDuty:".$CustomDuty.""; } - if($CustomEd-$beforeCustomEd) { $rowspanvalue++; - //$CAD=$CAD."Amended CustomEd :".$beforeCustomEd ."
"; - $CAD=$CAD."Amended CustomEd : ".$beforeCustomEd ."Current CustomEd:".$CustomEd.""; - + $CAD=$CAD."Amended CustomEd : ".$beforeCustomEd ."Current CustomEd:".$CustomEd.""; } if($CustomSH-$beforeCustomSH) { $rowspanvalue++; - //$CAD=$CAD."Amended CustomSH :".$beforeCustomSH ."
"; - $CAD=$CAD."Amended CustomSH : ".$beforeCustomSH ."Current CustomSH:".$CustomSH.""; - + $CAD=$CAD."Amended CustomSH : ".$beforeCustomSH ."Current CustomSH:".$CustomSH.""; } - - - if($FreightType!=$beforeFreightType) { - //$CAD=$CAD."Amended Additional Excise duty :".$beforeAddAdtional ."
"; - $rowspanvalue++; - $CAD=$CAD."Amended Freight Type: ".$beforeFreightType ."Current Freight Type:".$FreightType.""; - } + $rowspanvalue++; + $CAD=$CAD."Amended Freight Type: ".$beforeFreightType ."Current Freight Type:".$FreightType.""; + } if($NoOfTrip-$beforeNoOfTrip) { - //$CAD=$CAD."Amended Additional Excise duty :".$beforeAddAdtional ."
"; + $rowspanvalue++; - $CAD=$CAD."Amended No of Trip: ".$beforeNoOfTrip ."Current Additional Excise duty:".$NoOfTrip.""; + $CAD=$CAD."Amended No of Trip: ".$beforeNoOfTrip ."Current Additional Excise duty:".$NoOfTrip.""; } - - if($Freightrate-$beforeFreightrate) { - //$CAD=$CAD."Amended Additional Excise duty :".$beforeAddAdtional ."
"; - $rowspanvalue++; - $CAD=$CAD."Amended Freightrate: ".$beforeFreightrate ."Current Freightrate:".$Freightrate.""; - } + $rowspanvalue++; + $CAD=$CAD."Amended Freightrate: ".$beforeFreightrate ."Current Freightrate:".$Freightrate.""; + } if($Freightamount-$beforeFreightamount) { - //$CAD=$CAD."Amended Additional Excise duty :".$beforeAddAdtional ."
"; + $rowspanvalue++; - $CAD=$CAD."Amended Freight Amount: ".$beforeFreightamount ."Current Freight Amount:".$Freightamount.""; + $CAD=$CAD."Amended Freight Amount: ".$beforeFreightamount ."Current Freight Amount:".$Freightamount.""; } if($per!=$beforeper) { - //$CAD=$CAD."Amended Additional Excise duty :".$beforeAddAdtional ."
"; $rowspanvalue++; - $CAD=$CAD."Amended Per Value: ".$beforeper ."Current Per Value:".$per.""; + $CAD=$CAD."Amended Per Value: ".$beforeper ."Current Per Value:".$per.""; } - - - - if(($Assable-$beforeAssable)!=0) { - //$CAD=$CAD."Amended CustomDuty :".$beforeCustomDuty ."
"; - $rowspanvalue++; - $CAD=$CAD."Amended Assessable : ".$beforeAssable ."Current CustomDuty:".$Assable.""; + $rowspanvalue++; + $CAD=$CAD."Amended Assessable : ".$beforeAssable ."Current CustomDuty:".$Assable.""; } - - if(($Subtotal-$beforeSubtotal)!=0) { - //$CAD=$CAD."Amended CustomDuty :".$beforeCustomDuty ."
"; - $rowspanvalue++; - $CAD=$CAD."Amended Subtotal : ".$beforeSubtotal ."Current Subtotal:".$Subtotal.""; + $rowspanvalue++; + $CAD=$CAD."Amended Subtotal : ".$beforeSubtotal ."Current Subtotal:".$Subtotal.""; } - - if(($Igst-$beforeIgst)!=0) { - //$CAD=$CAD."Amended CustomDuty :".$beforeCustomDuty ."
"; - $rowspanvalue++; - $CAD=$CAD."Amended IGST Percentage : ".$beforeIgst ."Current IGST Percentage:".$Igst.""; + $rowspanvalue++; + $CAD=$CAD."Amended IGST Percentage : ".$beforeIgst ."Current IGST Percentage:".$Igst.""; } - - if(($Grossdutypayable-$beforeGrossdutypayable)!=0) { - //$CAD=$CAD."Amended CustomDuty :".$beforeCustomDuty ."
"; - $rowspanvalue++; - $CAD=$CAD."Amended Gross Duty Payable : ".$beforeGrossdutypayable ."Current Gross Duty Payable:".$Grossdutypayable.""; + $rowspanvalue++; + $CAD=$CAD."Amended Gross Duty Payable : ".$beforeGrossdutypayable ."Current Gross Duty Payable:".$Grossdutypayable.""; } - - - - - - if($rowspanvalue>0) { - $rowspanvalue++; - + $rowspanvalue++; $CAD2=''; $CAD2=$CAD; $CAD=''; @@ -1638,43 +1359,31 @@ function UpdateAmendServicePurchaseOrder() $CAD.=$CAD2; } - - - - - + $POLineItemList = array('PONO'=>$NewPO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'CostCenterCode'=>$CostCenter,'AmendedDetails'=>$CAD,'Per'=>$per,'ServiceMaterialDescription'=>$specialinstruction); - $POLineItemList = array('PONO'=>$NewPO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'CostCenterCode'=>$CostCenter,'AmendedDetails'=>$CAD,'Per'=>$per,'ServiceMaterialDescription'=>$specialinstruction); - //print_r($POLineItemList); + $POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList); - $POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList); - - if(count($POLineItem)>0) - { + if(count($POLineItem)>0) + { $LineItemNo = $POLineItem[0]['LineItemNo']; - } - // foreach($POLineItem as $line): - // $LineItemNo = $line['LineItemNo']; - // endforeach; + } - - $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'=>$Assable,'SubTotal'=>$Subtotal,'IGST'=>$Igst,'AfterIGST'=>$AfterIgst,'DutyImpact'=>$DutyImpact,'NetValue'=>$NetValue,'ClearingCharge'=>$ClearingCharge); - // print_r($ImportTaxList); - //die(); - $ImportList = $this->purchaseorder_model->addImportTax($ImportTaxList); + $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'=>$Assable,'SubTotal'=>$Subtotal,'IGST'=>$Igst,'AfterIGST'=>$AfterIgst,'DutyImpact'=>$DutyImpact,'NetValue'=>$NetValue,'ClearingCharge'=>$ClearingCharge); + $ImportList = $this->purchaseorder_model->addImportTax($ImportTaxList); - } - echo 'Purchase Order is'.$PONO.'Amended Successfully! New PO Number is: '.$NewPO ; } + echo 'Purchase Order is'.$PONO.'Amended Successfully! New PO Number is: '.$NewPO ; + } - - - function getDateformat($Val) + /** + * To convert the dateformat (date with time) and store to DB + */ + function getDateformat($Val) { - $date = new DateTime($Val,new DateTimeZone('Asia/Kolkata')); - $retDate = $date->format('Y-m-d H:i:s'); - return $retDate; + $date = new DateTime($Val,new DateTimeZone('Asia/Kolkata')); + $retDate = $date->format('Y-m-d H:i:s'); + return $retDate; } } diff --git a/application/controllers/assetdetails.php b/application/controllers/assetdetails.php index 895b077f..ac2ed29d 100644 --- a/application/controllers/assetdetails.php +++ b/application/controllers/assetdetails.php @@ -24,7 +24,7 @@ class assetdetails extends BaseController } /** - * default function of the assetdetails class + * Index Page for this controller(default function of the class) */ public function index() { diff --git a/application/controllers/cashbook.php b/application/controllers/cashbook.php index 9ae900f8..4fdac920 100755 --- a/application/controllers/cashbook.php +++ b/application/controllers/cashbook.php @@ -93,11 +93,11 @@ class cashbook extends BaseController $accounttype = $this->input->post('myradio'); if($accounttype == 1) { - $accounttype = 'INCOME'; + $accounttype = 'RECEIPT'; } else { - $accounttype = 'EXPENSE'; + $accounttype = 'PAYMENT'; } $accountcode = $this->input->post('accode'); $date = $this->input->post('Date'); @@ -254,11 +254,17 @@ class cashbook extends BaseController } echo "Successfully Saved!"; - - - - - + + } + + /** + * For edit cashbook screen + */ + public function editcashbook() + { + + $this->load->model('cashbook_model'); + $this->loadViews("editincomeexpenses", $this->global, NULL); } /** diff --git a/application/controllers/emergencypurchaseorder.php b/application/controllers/emergencypurchaseorder.php index 9ec8df3d..fb908394 100644 --- a/application/controllers/emergencypurchaseorder.php +++ b/application/controllers/emergencypurchaseorder.php @@ -4,7 +4,7 @@ require APPPATH . '/libraries/BaseController.php'; /** * Class : emergencypurchaseorder (Emergency Purchase Order - Controller) - * User Class to control all user related operations. + * emergencypurchaseorder Class to control all emergency po related operations. * @author : Venba Info Tech - * @version : 1.1 * @since : 18 November 2017 @@ -12,13 +12,12 @@ require APPPATH . '/libraries/BaseController.php'; class emergencypurchaseorder extends BaseController { /** - * This is default constructor of the class + * default constructor of the class */ public function __construct() { parent::__construct(); $this->load->model('purchaseorder_model'); - $this->load->library('session'); $this->load->library('form_validation'); $this->load->model('requistion_model'); @@ -28,95 +27,93 @@ class emergencypurchaseorder extends BaseController } /** - * This function used to load the first screen of the user + * Index Page for this controller(default function of the class) */ public function index() { $this->global['pageTitle'] = 'Resico : AddPO'; - $this->loadViews("addPO", $this->global, NULL , NULL); } function requisition() { $data['DeptList'] = $this->purchaseorder_model->getDepartmentListForAllReq(); - $data['stList'] = $this->purchaseorder_model->getStatusListforAllReq(); - $data['ReqList'] = $this->purchaseorder_model->getRequistionListbySearch(); $this->global['pageTitle'] = 'Resico : Create PO from Requisition List'; - $this->loadViews("createPOfromRequistion", $this->global, $data,Null); } + /** + * To create new emergency po + */ function CreateEmergencyPO() { $RequestedBy = $this->session->userdata ('EmpID'); + $this->global['pageTitle'] = 'Resico : Create Emergency Purchase Order'; + $data['RequestType'] = $this->requistion_model->getConfigValue('C004'); $data['Suplist'] = $this->purchaseorder_model->getSupplierName(); $data['INRSYMBOL']=$this->purchaseorder_model->GetINRCurrencytype('INR'); - $data['DeptList'] = $this->purchaseorder_model->getDepartmentAllList(); - - - + $data['DeptList'] = $this->purchaseorder_model->getDepartmentAllList(); $data['CompanyDetails'] = $this->purchaseorder_model->getCompanyInformation(); $data['MaxPODate'] = $this->purchaseorder_model->getLastCreatedPODate(); $data['TaxType'] = $this->purchaseorder_model->getConfigValue('C006'); $data['FreightType'] = $this->purchaseorder_model->getConfigValue('C018'); - //$data['Payment']=$this->purchaseorder_model->getSupplierPayment('C009'); $data['Payment']=$this->purchaseorder_model->getPaymentTermsDetails(); - //$data['WorkStatus']=$this->purchaseorder_model->GetWorkStatus('C019'); - $data['WorkStatus']=$this->purchaseorder_model->getStatus(7); - $data['ServiceOption'] = $this->requistion_model->getConfigValue('C022'); - $data['PoTypeOptions'] = $this->purchaseorder_model->getConfigValue('C026'); + $data['WorkStatus']=$this->purchaseorder_model->getStatus(7); + $data['ServiceOption'] = $this->requistion_model->getConfigValue('C022'); + $data['PoTypeOptions'] = $this->purchaseorder_model->getConfigValue('C026'); - if($this->DEPCode == PURCHASE ) - { - $this->loadViews("alterpurchaseorder", $this->global, $data, Null); - - } - - else - { - $this->loadViews("access", $this->global, $data, Null); - } + if($this->DEPCode == PURCHASE ) + { + $this->loadViews("alterpurchaseorder", $this->global, $data, Null); + } + else + { + $this->loadViews("access", $this->global, $data, Null); + } } + + /** - * this function used for get all material code using request type + * For get all material code using request type */ function getMaterialCode(){ $reqType = $this->input->post('input'); $materialList = $this->requistion_model->GetMaterialCode($reqType); echo json_encode($materialList); - } - /*This function is used for get cost center list using department code*/ + /** + * For get cost center list using department code + */ function getCostCenterName(){ $CostList=''; $DeptCode = $this->input->post('id'); $CostList = $this->requistion_model->GetCostCenterByDept($DeptCode); - // print_r($CostList); echo json_encode($CostList); } - + /** + * To add file for inward po + */ function addfile() - { + { $file = ''; //Check whether user upload picture if(!empty($_FILES['images']['name'])) { - //echo 'true'; + $config['upload_path'] = 'uploads/BillFiles/'; $config['allowed_types'] = 'docx|pdf|doc|png|jpg'; $config['file_name'] = $_FILES['images']['name']; - // print_r($config);die; + //Load upload library and initialize configuration $this->load->library('upload',$config); $this->upload->initialize($config); @@ -124,19 +121,17 @@ class emergencypurchaseorder extends BaseController if($this->upload->do_upload('images')) { $uploadData = $this->upload->data(); - //print_r($uploadData); $file = $uploadData['file_name']; } else { - $error = array('error' => $this->upload->display_errors()); - //print_r($error); - $file = ''; + $error = array('error' => $this->upload->display_errors()); + $file = ''; } } else { - //echo 'false'; + $file = ''; } @@ -144,23 +139,18 @@ class emergencypurchaseorder extends BaseController } - - - - - -function addfile1() - { + function addfile1() + { $file = ''; //Check whether user upload picture if(!empty($_FILES['images1']['name'])) { - //echo 'true'; + $config['upload_path'] = 'uploads/BillFiles/'; $config['allowed_types'] = 'docx|pdf|doc|png|jpg'; $config['file_name'] = $_FILES['images1']['name']; - // print_r($config);die; + //Load upload library and initialize configuration $this->load->library('upload',$config); $this->upload->initialize($config); @@ -168,19 +158,19 @@ function addfile1() if($this->upload->do_upload('images1')) { $uploadData = $this->upload->data(); - //print_r($uploadData); + $file = $uploadData['file_name']; } else { - $error = array('error' => $this->upload->display_errors()); - //print_r($error); + $error = array('error' => $this->upload->display_errors()); + $file = ''; } } else - { - //echo 'false'; + { + $file = ''; } @@ -191,568 +181,435 @@ function addfile1() - //This used to Create Service Purchase Order + /** + * To Create Service Purchase Order + */ function addNewServicePurchaseOrder() { - - //echo "t54"; - - - //die(); - - $txtRowCount=$this->input->post('txtRowCount'); + $txtRowCount=$this->input->post('txtRowCount'); - $POdt =$this->input->post('PODate'); - $PODate = $this->getDateformat($POdt); - $SupplierID = $this->input->post('drpSupplier'); - $DeliveryAddr = $this->input->post('DeliveryAddr'); + $POdt =$this->input->post('PODate'); + $PODate = $this->getDateformat($POdt); + $SupplierID = $this->input->post('drpSupplier'); + $DeliveryAddr = $this->input->post('DeliveryAddr'); - $CostCenterName = $this->input->post('CostCenterName'); - $DeliveryOption = $this->input->post('DateRange'); - $DeliverySchedule=''; - $Deliverydt = $this->getDateformat($POdt); + $CostCenterName = $this->input->post('CostCenterName'); + $DeliveryOption = $this->input->post('DateRange'); + $DeliverySchedule=''; + $Deliverydt = $this->getDateformat($POdt); - $txtsplservice=$this->input->post('txtSpecialservice'); + $txtsplservice=$this->input->post('txtSpecialservice'); - if($txtsplservice=='1') - { - - $POStatus=SPECIAL_PO; - } - else - { - $POStatus=REQITEM_Emergency_PO_CREATED; - } - - - //echo $POStatus; - //die(); + if($txtsplservice=='1') + { + $POStatus=SPECIAL_PO; + } + else + { + $POStatus=REQITEM_Emergency_PO_CREATED; + } - $POType = $this->input->post('POType'); + $POType = $this->input->post('POType'); + $SpcialInstruction = $this->input->post('ScopeOfWork'); + $RequistionComments = "Created Emergency Service PO"; + + $TotalOrderValueSummary = $this->input->post('txtTotalOrderValueSummaryService'); + $CreateBy = $this->session->userdata ('userId'); + $RequestedBy = $this->input->post('drpDepartment'); + + $ReqStatus = REQITEM_Emergency_PO_CREATED; + + $RowCount = $this->input->post('txtRowCount'); + $DeletedRow = $this->input->post('txtDeletedRow1'); + $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('PaymentMethod'); + $OtherPayment=$this->input->post('Otherpayment'); + + + if($POStatus==SPECIAL_PO) + { + $ServiceWorkStatus=SERVICE_COMPLETED; + } + else + { + $ServiceWorkStatus=$this->input->post('txtworkstatus'); + } + + $ServiceScheduleType = $this->input->post('ScheduleType'); + $ServiceScheduleOptions = $this->input->post('ScheduleType'); + $ServiceServiceNo = 1; + $ModeOfShipment=$this->input->post('emergmodeofshipment'); + $SupplierReference=$this->input->post('emergsupplierreference'); + $SuppliersOfferNo=$this->input->post('emergsupplierofferno'); + $OtherReferences=$this->input->post('emergotherreference'); + $Fincap=$this->input->post('emergfincap'); + $InsuranceOptions=$this->input->post('insuranceStatus'); + $InsuranceNo=$this->input->post('insuranceNo'); + $ServiceTypeOptions=$this->input->post('PoTypeOptions'); + $DescriptionOfPo = $this->input->post('emergdescofpo'); + - $SpcialInstruction = $this->input->post('ScopeOfWork'); - $RequistionComments = "Created Emergency Service PO"; - // $TotalOrderValueSummary = $this->input->post('TextTotalOrderValueSummaryService'); - - $TotalOrderValueSummary = $this->input->post('txtTotalOrderValueSummaryService'); - - //$POStatus = $this->input->post('TextStatus'); - $CreateBy = $this->session->userdata ('userId'); - $RequestedBy = $this->input->post('drpDepartment'); - - $ReqStatus = REQITEM_Emergency_PO_CREATED; - - // $RowCount = $this->input->post('TextRowCount'); - - $RowCount = $this->input->post('txtRowCount'); - - //$DeletedRow = $this->input->post('TextDeletedRowCount'); - - $DeletedRow = $this->input->post('txtDeletedRow1'); - - $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('PaymentMethod'); - - $PaymentTerms=$this->input->post('PaymentMethod'); - $OtherPayment=$this->input->post('Otherpayment'); - - - if($POStatus==SPECIAL_PO) - { - $ServiceWorkStatus=SERVICE_COMPLETED; - } - - else - { - $ServiceWorkStatus=$this->input->post('txtworkstatus'); - - //$ServiceWorkStatus=$this->input->post('workstatusValue'); - } - - - //echo $ServiceWorkStatus; - - // echo "fveg"; - - //die(); - $ServiceScheduleType = $this->input->post('ScheduleType'); - $ServiceScheduleOptions = $this->input->post('ScheduleType'); - //$ServiceServiceNo = $this->input->post('ServiceNo'); - $ServiceServiceNo = 1; - $ModeOfShipment=$this->input->post('emergmodeofshipment'); - $SupplierReference=$this->input->post('emergsupplierreference'); - $SuppliersOfferNo=$this->input->post('emergsupplierofferno'); - $OtherReferences=$this->input->post('emergotherreference'); - $Fincap=$this->input->post('emergfincap'); - $InsuranceOptions=$this->input->post('insuranceStatus'); - $InsuranceNo=$this->input->post('insuranceNo'); - $ServiceTypeOptions=$this->input->post('PoTypeOptions'); - $DescriptionOfPo = $this->input->post('emergdescofpo'); - - //create T_Requestion_Master - $Request = array('ReqType'=>$POType, 'RequestedDept'=>$RequestedBy,'CostCenterCode'=>$CostCenterName,'Status'=>$ReqStatus,'Comments'=>$RequistionComments,'ReqDate'=>$createddt,'CreatedDate'=>$createddt,'CreatedBy'=>$CreateBy,'Schedule_Type'=>$ServiceScheduleType,'NumberOfService'=>$ServiceServiceNo,'Service_Period'=>$ServiceScheduleOptions); + $Request = array('ReqType'=>$POType, 'RequestedDept'=>$RequestedBy,'CostCenterCode'=>$CostCenterName,'Status'=>$ReqStatus,'Comments'=>$RequistionComments,'ReqDate'=>$createddt,'CreatedDate'=>$createddt,'CreatedBy'=>$CreateBy,'Schedule_Type'=>$ServiceScheduleType,'NumberOfService'=>$ServiceServiceNo,'Service_Period'=>$ServiceScheduleOptions); - $Req = $this->requistion_model->addRequistion($Request); + $Req = $this->requistion_model->addRequistion($Request); - $RegNo=''; - if(count($Req)>0) - { - $RegNo = $Req[0]['ReqNo']; - } + $RegNo=''; + if(count($Req)>0) + { + $RegNo = $Req[0]['ReqNo']; + } - - // PO Master - $POList = array('SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrderValueSummary,'PODate'=>$PODate,'Status'=>$POStatus,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'ServiceDescription'=>$SpcialInstruction,'CreatedBy'=>$CreateBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'CreatedDate'=>$createddt,'PaymentTerms'=>$PaymentTerms,'ServiceWorkStatus'=>$ServiceWorkStatus,'POType'=>$POType,'PaymentOtherDescription'=>$OtherPayment,'Supplier_Reference'=>$SupplierReference,'Mode_Of_Shipment'=>$ModeOfShipment,'Supplier_Offer_No'=>$SuppliersOfferNo,'Other_Reference'=>$OtherReferences,'Fincap'=>$Fincap,'Description_Of_Service'=>$DescriptionOfPo,'InsuranceStatus'=>$InsuranceOptions,'InsuranceNumber'=>$InsuranceNo,'POSubType'=>$ServiceTypeOptions); + // PO Master + $POList = array('SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrderValueSummary,'PODate'=>$PODate,'Status'=>$POStatus,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'ServiceDescription'=>$SpcialInstruction,'CreatedBy'=>$CreateBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'CreatedDate'=>$createddt,'PaymentTerms'=>$PaymentTerms,'ServiceWorkStatus'=>$ServiceWorkStatus,'POType'=>$POType,'PaymentOtherDescription'=>$OtherPayment,'Supplier_Reference'=>$SupplierReference,'Mode_Of_Shipment'=>$ModeOfShipment,'Supplier_Offer_No'=>$SuppliersOfferNo,'Other_Reference'=>$OtherReferences,'Fincap'=>$Fincap,'Description_Of_Service'=>$DescriptionOfPo,'InsuranceStatus'=>$InsuranceOptions,'InsuranceNumber'=>$InsuranceNo,'POSubType'=>$ServiceTypeOptions); - $POMaster = $this->purchaseorder_model->addPOMaster($POList,$POType,$ServiceTypeOptions); - $PONO = ''; - if(count($POMaster)>0) - { - $PONO = $POMaster[0]['PONO']; - } + $POMaster = $this->purchaseorder_model->addPOMaster($POList,$POType,$ServiceTypeOptions); + $PONO = ''; + if(count($POMaster)>0) + { + $PONO = $POMaster[0]['PONO']; + } - $RegDetailsStatus=REQITEM_POCREATED; + $RegDetailsStatus=REQITEM_POCREATED; - // PO Line Items - $LineItemStatus = REQITEM_NEW; + // PO Line Items + $LineItemStatus = REQITEM_NEW; - for ($i = 1; $i <= $RowCount; $i++) - { - $Per = $this->input->post('Serviceper'.$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); - $Cgst = $this->input->post('Cgst'.$i); - $Sgst = $this->input->post('Sgst'.$i); - $Igst = $this->input->post('Igst'.$i); - $AfterCgst = $this->input->post('AfterCgst'.$i); - $AfterSgst = $this->input->post('AfterSgst'.$i); - $AfterIgst = $this->input->post('AfterIgst'.$i); - $OtherAmt = $this->input->post('OtherAmt'.$i); - $CostCenter = $this->input->post('costCode'.$i); - - $TotalOrderValue = $this->input->post('TotalOrderValue'.$i); - $ServiceFrequency=$this->input->post('Frequency'.$i).' - '.$this->input->post('FrequencyValue'.$i); - $ServiceMaterialDescription = $this->input->post('ItemServiceDescription'.$i); - $SkipInsert = "False"; - if( count($comma_separated) > 0) + for ($i = 1; $i <= $RowCount; $i++) { - for($j = 1; $j < count($comma_separated); $j++) - { - $deletedRow = $comma_separated[$j]; + $Per = $this->input->post('Serviceper'.$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); + $Cgst = $this->input->post('Cgst'.$i); + $Sgst = $this->input->post('Sgst'.$i); + $Igst = $this->input->post('Igst'.$i); + $AfterCgst = $this->input->post('AfterCgst'.$i); + $AfterSgst = $this->input->post('AfterSgst'.$i); + $AfterIgst = $this->input->post('AfterIgst'.$i); + $OtherAmt = $this->input->post('OtherAmt'.$i); + $CostCenter = $this->input->post('costCode'.$i); - if($deletedRow == $i ) + $TotalOrderValue = $this->input->post('TotalOrderValue'.$i); + $ServiceFrequency=$this->input->post('Frequency'.$i).' - '.$this->input->post('FrequencyValue'.$i); + $ServiceMaterialDescription = $this->input->post('ItemServiceDescription'.$i); + $SkipInsert = "False"; + if( count($comma_separated) > 0) + { + for($j = 1; $j < count($comma_separated); $j++) { - $SkipInsert = "True"; - break; + $deletedRow = $comma_separated[$j]; + + if($deletedRow == $i ) + { + $SkipInsert = "True"; + break; + } } - - } - } - if($SkipInsert == "False") - { + } + if($SkipInsert == "False") + { - //add requistion details - $ReqDetails = array('ReqNo'=>$RegNo, 'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Status'=>$RegDetailsStatus,'UpdatedBy'=>$CreateBy,'UpdatedOn'=>$createddt); - - + //add requistion details + $ReqDetails = array('ReqNo'=>$RegNo, 'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Status'=>$RegDetailsStatus,'UpdatedBy'=>$CreateBy,'UpdatedOn'=>$createddt); $ReqDetQuery = $this->requistion_model->addRequistionDetails($ReqDetails,$RegNo); - - - $ItemNo = ''; - if(count($ReqDetQuery)>0) - { - $ItemNo = $ReqDetQuery[0]['ItemNo']; - } + $ItemNo = ''; + if(count($ReqDetQuery)>0) + { + $ItemNo = $ReqDetQuery[0]['ItemNo']; + } - $POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$RegNo,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'CostCenterCode'=>$CostCenter,'ServiceMaterialDescription'=>$ServiceMaterialDescription,'ServiceFrequency'=>$ServiceFrequency,'Per'=>$Per,'ItemNo'=>$ItemNo); - - - $POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList); - $LineItemNo = ''; - if(count($POLineItem)>0) - { - $LineItemNo = $POLineItem[0]['LineItemNo']; + $POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$RegNo,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'CostCenterCode'=>$CostCenter,'ServiceMaterialDescription'=>$ServiceMaterialDescription,'ServiceFrequency'=>$ServiceFrequency,'Per'=>$Per,'ItemNo'=>$ItemNo); + $POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList); + $LineItemNo = ''; + if(count($POLineItem)>0) + { + $LineItemNo = $POLineItem[0]['LineItemNo']; + } + if(trim($POType) == SERVICE ) + { + $ServiceTaxList = array('LineItemNo'=>$LineItemNo, 'CGST'=>$Cgst,'After_CGST'=>$AfterCgst,'SGST'=>$Sgst,'After_SGST'=>$AfterSgst,'IGST'=>$Igst,'After_IGST'=>$AfterIgst,'otherallowance'=>$OtherAmt,'TotalValue'=>$TotalOrderValue, 'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt); + $ServiceTax = $this->purchaseorder_model->addServiceTax($ServiceTaxList); + } } + else {} + if($POStatus==SPECIAL_PO){ - if(trim($POType) == SERVICE ) - { - // echo 'Success'; - - $ServiceTaxList = array('LineItemNo'=>$LineItemNo, 'CGST'=>$Cgst,'After_CGST'=>$AfterCgst,'SGST'=>$Sgst,'After_SGST'=>$AfterSgst,'IGST'=>$Igst,'After_IGST'=>$AfterIgst,'otherallowance'=>$OtherAmt,'TotalValue'=>$TotalOrderValue, 'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt); - - $ServiceTax = $this->purchaseorder_model->addServiceTax($ServiceTaxList); - + $file =$this->addfile1(); + $myfile = array('FilePath'=>$file,'MaterialCode'=>$MaterialCode,'PONO'=>$PONO); + $result= $this->purchaseorder_model->fileupload($myfile); } } - else { - - } - - -if($POStatus==SPECIAL_PO){ - - $file =$this->addfile1(); - - $myfile = array('FilePath'=>$file,'MaterialCode'=>$MaterialCode,'PONO'=>$PONO); - $result= $this->purchaseorder_model->fileupload($myfile); - } - - } - - - - if($POStatus == REQ_DRAFT) - { - // echo 'Emergency Service Purchase Order Saved Successfully!The PO NO Is: '.$PONO; - - - echo ""; + if($POStatus == REQ_DRAFT) + { + echo ""; redirect('purchaseorder/PurchaseOrderList','refresh'); - } - else - { - // echo 'Emergency Service Purchase Order Created Successfully!The PO NO Is: '.$PONO; - - echo ""; - redirect('purchaseorder/PurchaseOrderList','refresh'); + } + else + { + echo ""; + redirect('purchaseorder/PurchaseOrderList','refresh'); - } + } - - } + } - - - //This used to Create Revenue Emergency Purchase Order + /** + * To Create Revenue Emergency Purchase Order + **/ function addNewRevenuePurchaseOrder() { $txtspl=$this->input->post('txtSpecial'); - - //echo "Emergency Revenue PO"; - $POdt =$this->input->post('PODate'); - $PODate = $this->getDateformat($POdt); - $SupplierID = $this->input->post('drpSupplier'); - $DeliveryAddr = $this->input->post('DeliveryAddr'); - $dt = $this->input->post('Deliverydt'); - $DeliveryOption = $this->input->post('DateRange'); + $POdt =$this->input->post('PODate'); + $PODate = $this->getDateformat($POdt); + $SupplierID = $this->input->post('drpSupplier'); + $DeliveryAddr = $this->input->post('DeliveryAddr'); + $dt = $this->input->post('Deliverydt'); + $DeliveryOption = $this->input->post('DateRange'); if($DeliveryOption==1){ - $Deliverydt = ''; - $DeliverySchedule = $this->input->post('Scheduleby'); + $Deliverydt = ''; + $DeliverySchedule = $this->input->post('Scheduleby'); } - else{ - $Deliverydt = $this->getDateformat($dt); - $DeliverySchedule = ''; + else{ + $Deliverydt = $this->getDateformat($dt); + $DeliverySchedule = ''; } - $Modeofshipment=$this->input->post('emergmodeofshipment'); - $supplierreference=$this->input->post('emergsupplierreference'); - $supplieroffno=$this->input->post('emergsupplierofferno'); - $otherreference=$this->input->post('emergotherreference'); - $fincap=$this->input->post('emergfincap'); - $revenuetype=$this->input->post('PoTypeOptions'); - $insurancestatus=$this->input->post('insuranceStatus'); - if($insurancestatus == 1){ + $Modeofshipment=$this->input->post('emergmodeofshipment'); + $supplierreference=$this->input->post('emergsupplierreference'); + $supplieroffno=$this->input->post('emergsupplierofferno'); + $otherreference=$this->input->post('emergotherreference'); + $fincap=$this->input->post('emergfincap'); + $revenuetype=$this->input->post('PoTypeOptions'); + $insurancestatus=$this->input->post('insuranceStatus'); + if($insurancestatus == 1){ $insuranceno=$this->input->post('insuranceNo'); - }else{ + }else{ $insuranceno=""; - } + } $CostCenterName = $this->input->post('CostCenterName'); - $POType = $this->input->post('POType'); - $PoRange = $this->input->post('txtPoRange'); + $POType = $this->input->post('POType'); + $PoRange = $this->input->post('txtPoRange'); - $SpcialInstruction = $this->input->post('txtSpcialInstruction'); - $RequistionComments = "Created Emergency Revenue PO"; - $TotalOrderValueSummary = $this->input->post('txtTotalOrderValueSummary'); + $SpcialInstruction = $this->input->post('txtSpcialInstruction'); + $RequistionComments = "Created Emergency Revenue PO"; + $TotalOrderValueSummary = $this->input->post('txtTotalOrderValueSummary'); - if($txtspl==0) - { + if($txtspl==0) + { $POStatus=REQITEM_Emergency_PO_CREATED; - } - else - { + } + else + { $POStatus=SPECIAL_PO; - } + } - //$POStatus = $this->input->post('TextStatus'); -$RequestedBy = $this->input->post('drpDepartment'); - $CreateBy = $this->session->userdata ( 'userId' ); - // $RowCount = $this->input->post('TextRowCount'); - - $RowCount=$this->input->post('txtRowCount1'); - - //echo $RowCount; - // $DeletedRow = $this->input->post('TextDeletedRowCount'); - - $DeletedRow = $this->input->post('txtDeletedRow1'); - - - - $splRow = $this->input->post('splrow'); - - // echo $DeletedRow; + $RequestedBy = $this->input->post('drpDepartment'); + $CreateBy = $this->session->userdata ( 'userId' ); + $RowCount=$this->input->post('txtRowCount1'); + $DeletedRow = $this->input->post('txtDeletedRow1'); + $splRow = $this->input->post('splrow'); - $ReqStatus = REQITEM_Emergency_PO_CREATED; - $Local_Interstate=$this->input->post('Range'); + $ReqStatus = REQITEM_Emergency_PO_CREATED; + $Local_Interstate=$this->input->post('Range'); - $comma_separated = explode(':', $DeletedRow); + $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('PaymentMethod'); - $OtherPayment=$this->input->post('Otherpayment'); + $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); + $createddt = $dt->format('Y-m-d H:i:s'); + $PaymentTerms=$this->input->post('PaymentMethod'); + $OtherPayment=$this->input->post('Otherpayment'); - if($POStatus==SPECIAL_PO) - { + if($POStatus==SPECIAL_PO) + { $Qualitycheck=$this->input->post('txtQuality'); - } - - else - { + } + else + { $Qualitycheck=1; - } + } - - - //add requistion - $Request = array('ReqType'=>$POType, 'RequestedDept'=>$RequestedBy,'CostCenterCode'=>$CostCenterName,'Status'=>$ReqStatus,'Comments'=>$RequistionComments,'ReqDate'=>$createddt,'CreatedDate'=>$createddt,'CreatedBy'=>$CreateBy); + + $Request = array('ReqType'=>$POType, 'RequestedDept'=>$RequestedBy,'CostCenterCode'=>$CostCenterName,'Status'=>$ReqStatus,'Comments'=>$RequistionComments,'ReqDate'=>$createddt,'CreatedDate'=>$createddt,'CreatedBy'=>$CreateBy); - $Req = $this->requistion_model->addRequistion($Request); + $Req = $this->requistion_model->addRequistion($Request); - $RegNo=''; - if(count($Req)>0) + $RegNo=''; + if(count($Req)>0) { $RegNo = $Req[0]['ReqNo']; } - // PO Master - $POList = array('SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrderValueSummary,'PODate'=>$PODate,'Status'=>$POStatus,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'PORange'=>$Local_Interstate,'ServiceDescription'=>$SpcialInstruction,'CreatedBy'=>$CreateBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'CreatedDate'=>$createddt,'PaymentTerms'=>$PaymentTerms,'POType'=>$POType,'CapitalRange'=>$Local_Interstate,'PaymentOtherDescription'=>$OtherPayment,'Mode_Of_Shipment'=>$Modeofshipment,'Supplier_Offer_No'=>$supplieroffno,'Supplier_Reference'=>$supplierreference,'Other_Reference'=>$otherreference,'InsuranceNumber'=>$insuranceno,'InsuranceStatus'=>$insurancestatus,'Fincap'=>$fincap,'POSubType'=>$revenuetype,'IsQualityChkReqired'=>$Qualitycheck); - //print_r($POList); - $POMaster = $this->purchaseorder_model->addPOMaster($POList,$POType,$revenuetype); + // PO Master + $POList = array('SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrderValueSummary,'PODate'=>$PODate,'Status'=>$POStatus,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'PORange'=>$Local_Interstate,'ServiceDescription'=>$SpcialInstruction,'CreatedBy'=>$CreateBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'CreatedDate'=>$createddt,'PaymentTerms'=>$PaymentTerms,'POType'=>$POType,'CapitalRange'=>$Local_Interstate,'PaymentOtherDescription'=>$OtherPayment,'Mode_Of_Shipment'=>$Modeofshipment,'Supplier_Offer_No'=>$supplieroffno,'Supplier_Reference'=>$supplierreference,'Other_Reference'=>$otherreference,'InsuranceNumber'=>$insuranceno,'InsuranceStatus'=>$insurancestatus,'Fincap'=>$fincap,'POSubType'=>$revenuetype,'IsQualityChkReqired'=>$Qualitycheck); + + $POMaster = $this->purchaseorder_model->addPOMaster($POList,$POType,$revenuetype); - $PONO = ''; - if(count($POMaster)>0) - { - $PONO = $POMaster[0]['PONO']; - } - //echo $PONO; - // PO Line Items - $RegDetailsStatus=REQITEM_POCREATED; - $LineItemStatus = REQITEM_NEW; + $PONO = ''; + if(count($POMaster)>0) + { + $PONO = $POMaster[0]['PONO']; + } + + // PO Line Items + $RegDetailsStatus=REQITEM_POCREATED; + $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); + $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); + $PackagingOption = $this->input->post('PackOption'.$i); + $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); + $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); + $SkipInsert = "False"; + if( count($comma_separated) > 0) + { + for($j = 1; $j < count($comma_separated); $j++) + { + $deletedRow = $comma_separated[$j] ; - $DiscountType = $this->input->post('DisType'.$i); - $DiscountValue = $this->input->post('DisVal'.$i); - $AfterDiscount = $this->input->post('AfterDisVal'.$i); - $PackagingOption = $this->input->post('PackOption'.$i); - $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); - $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); - $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") - { - //add requistion details + if($deletedRow == $i ) + { + $SkipInsert = "True"; + break; + } + } + } + if($SkipInsert == "False") + { + //add requistion details $ReqDetails = array('ReqNo'=>$RegNo, 'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Status'=>$RegDetailsStatus,'UpdatedBy'=>$CreateBy,'UpdatedOn'=>$createddt); - - $ReqDetQuery = $this->requistion_model->addRequistionDetails($ReqDetails); + $ReqDetQuery = $this->requistion_model->addRequistionDetails($ReqDetails); - $POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$RegNo,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'CostCenterCode'=>$CostCenter,'Per'=>$per,'ServiceMaterialDescription'=>$revenuedescription); - //print_r($POLineItemList); - $POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList); + $POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$RegNo,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'CostCenterCode'=>$CostCenter,'Per'=>$per,'ServiceMaterialDescription'=>$revenuedescription); + + $POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList); - $LineItemNo = ''; - if(count($POLineItem)>0) - { - $LineItemNo = $POLineItem[0]['LineItemNo']; - } - //echo $LineItemNo; + $LineItemNo = ''; + if(count($POLineItem)>0) + { + $LineItemNo = $POLineItem[0]['LineItemNo']; + } + - if(trim($POType) == REVENUE ) - { - // echo 'Success'; - $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); - //print_r($RevenueTaxList); - $RevenueList = $this->purchaseorder_model->addRevenueTax($RevenueTaxList); - //echo 'Revenue tax Success'; - } - } - - } - - + 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); + + } + } + } if($txtspl==1 || $txtspl==2) { - //secho "cwwe"; - //die(); + $PONOigr = $PONO; - $PONOigr = $PONO; - - //echo $PONOigr; - //die(); - //IGR Data Entry - //$DeliveryChellanOrInvoiceNo = $this->input->post('ChallanInvNo'); - - $DeliveryChellanInvoiceNo=$this->input->post('ChallanInvNo'); + $DeliveryChellanInvoiceNo=$this->input->post('ChallanInvNo'); - $DeliveryChellan = $this->input->post('ChallanInvDate'); - $DeliveryChellanDate = $this->getDateformat($DeliveryChellan); + $DeliveryChellan = $this->input->post('ChallanInvDate'); + $DeliveryChellanDate = $this->getDateformat($DeliveryChellan); - $Vehicle = $this->input->post('VehicleNo'); - $Courier = $this->input->post('CourierNo'); + $Vehicle = $this->input->post('VehicleNo'); + $Courier = $this->input->post('CourierNo'); - $CreatedBy = $this->session->userdata('userId'); + $CreatedBy = $this->session->userdata('userId'); - $Remarksmrir='Emergency PO without Quality Check'; - //$Remarks = $this->input->post('Remarks'); - //$RowCount = $this->input->post('TextRowCount'); - //echo $RowCount; - $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); - $createddt = $dt->format('Y-m-d H:i:s'); + $Remarksmrir='Emergency PO without Quality Check'; + $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); + $createddt = $dt->format('Y-m-d H:i:s'); - $IGRStatus = IGR_CREATED; - - - - $igr = array(); + $IGRStatus = IGR_CREATED; + $igr = array(); - $igr = array('PONO'=>$PONO,'VehicleNo'=>$Vehicle,'DeliveryChellanOrInvoiceNo'=>$DeliveryChellanInvoiceNo,'DeliveryChellanDate'=>$DeliveryChellanDate,'CourierNo'=>$Courier,'IGRStatus'=>$IGRStatus,'CreatedBy'=>$CreatedBy,'CreatedDate' =>$createddt); - - //print_r($igr); - - $igrM = $this->inwardgateregister_model->addigrM($igr); - - - - - $IGRNO = ''; - if(count($igrM)>0) - { - foreach ($igrM as $key ) - { - $IGRNO=$key->IGRNO; - } - } - // echo $IGRNO; - - + $igr = array('PONO'=>$PONO,'VehicleNo'=>$Vehicle,'DeliveryChellanOrInvoiceNo'=>$DeliveryChellanInvoiceNo,'DeliveryChellanDate'=>$DeliveryChellanDate,'CourierNo'=>$Courier,'IGRStatus'=>$IGRStatus,'CreatedBy'=>$CreatedBy,'CreatedDate' =>$createddt); + $igrM = $this->inwardgateregister_model->addigrM($igr); + $IGRNO = ''; + if(count($igrM)>0) + { + foreach ($igrM as $key ) + { + $IGRNO=$key->IGRNO; + } + } if($Qualitycheck==0) - { + { + $mrirmastervalues = array('MRIRStatus'=>MRIR_APPROVED,'IGRNO'=>$IGRNO,'PONO'=>$PONO,'CreatedBy'=>$CreatedBy,'Createdon'=>$createddt,'Remarks'=>$Remarksmrir); + $mrirmaster = $this->mrir_model->master_mrir($mrirmastervalues); + $MRIRNO = ''; + + if(count($mrirmaster)>0) + { + foreach ($mrirmaster as $key ) { + $MRIRNO=$key->MRIRNo; } + } - $mrirmastervalues = array('MRIRStatus'=>MRIR_APPROVED,'IGRNO'=>$IGRNO,'PONO'=>$PONO,'CreatedBy'=>$CreatedBy,'Createdon'=>$createddt,'Remarks'=>$Remarksmrir); - - $mrirmaster = $this->mrir_model->master_mrir($mrirmastervalues); + for ($i = 1; $i <= $RowCount; $i++) + { + $MaterialCode = $this->input->post('materialCode'.$i); + $Quantity = $this->input->post('quantity'.$i); + $Remarked = "Special PO Without Quality Check"; - $MRIRNO = ''; - - - if(count($mrirmaster)>0) - - { - foreach ($mrirmaster as $key ) { - - $MRIRNO=$key->MRIRNo; } - } - - - for ($i = 1; $i <= $RowCount; $i++) - { - - - $MaterialCode = $this->input->post('materialCode'.$i); - $Quantity = $this->input->post('quantity'.$i); - - $Remarked = "Special PO Without Quality Check"; - - $MRIRStatus=MRIR_APPROVED; - - - + $MRIRStatus=MRIR_APPROVED; + //this array to store the value in child table.. $mrirdetailvalues = array('MRIRNO'=>$MRIRNO,'MaterialCode'=>$MaterialCode,'ActualQuantityReceived'=>$Quantity,'Remarks'=>$Remarked,'MRIRStatus'=>$MRIRStatus); - - //print_r($mrirdetailvalues); - //die(); - $mrirdetails = $this->mrir_model->detail_mrir($mrirdetailvalues); - - - - - $getAvailableqty = $this->mrir_model->getItemQuantityFromStock(trim($MaterialCode)); + $getAvailableqty = $this->mrir_model->getItemQuantityFromStock(trim($MaterialCode)); if(count($getAvailableqty)>0) { $avlQty = $getAvailableqty[0]['Quantity']; } - $updatStock = array('Quantity'=>($Quantity+$avlQty),'Status'=>'0','UpdatedOn'=>$createddt,'UpdatedBy'=>$CreatedBy,'Remarks'=>'Stock added for '. $MRIRNO); + $updatStock = array('Quantity'=>($Quantity+$avlQty),'Status'=>'0','UpdatedOn'=>$createddt,'UpdatedBy'=>$CreatedBy,'Remarks'=>'Stock added for '. $MRIRNO); - $this->mrir_model->UpdateStock($updatStock,trim($MaterialCode)); + $this->mrir_model->UpdateStock($updatStock,trim($MaterialCode)); - } + } - } - - - - - $IGRItemStatus = REQITEM_NEW; - - - for ($i = 1; $i <= $RowCount; $i++) - { + } + $IGRItemStatus = REQITEM_NEW; + for ($i = 1; $i <= $RowCount; $i++) + { $MaterialCode = trim($this->input->post('materialCode'.$i)); @@ -762,22 +619,17 @@ $RequestedBy = $this->input->post('drpDepartment'); $ReceivedQty = $this->input->post('AQuantity'.$i); - $emergencyitemcode = $this->input->post('emergencyitemcode'); + $emergencyitemcode = $this->input->post('emergencyitemcode'); $PendingQty = 0; - //echo $QuantityAsPerInvoice; - //echo $PendingQty.'ReceivedQty'.$ReceivedQty; - //echo ' '; if(strlen($QuantityAsPerInvoice)>0 && $QuantityAsPerInvoice != '0') { $Remarks = "Special PO Created"; $ItemStatus = ''; - //if($QuantityAsPerInvoice == $OrderedQuantity) if($PendingQty == 0.00 ) - - { + { $ItemStatus = IGR_CREATED; } else @@ -788,105 +640,67 @@ $RequestedBy = $this->input->post('drpDepartment'); $CreatedBy = $this->session->userdata('userId'); - $igrDetails = array('IGRNO'=>$IGRNO,'MaterialCode'=>$MaterialCode,'QuantityAsPerInvoice'=>$QuantityAsPerInvoice,'Remarks'=>$Remarks,'IGRItemStatus'=>$IGRItemStatus,'CreatedBy'=>$CreatedBy,'CreatedDate'=>$createddt); - - - //print_r($igrDetails); - + $igrDetails = array('IGRNO'=>$IGRNO,'MaterialCode'=>$MaterialCode,'QuantityAsPerInvoice'=>$QuantityAsPerInvoice,'Remarks'=>$Remarks,'IGRItemStatus'=>$IGRItemStatus,'CreatedBy'=>$CreatedBy,'CreatedDate'=>$createddt); + $igrD = $this->inwardgateregister_model->addigrD($igrDetails); - - $igrD = $this->inwardgateregister_model->addigrD($igrDetails); - - $Recqty = $this->inwardgateregister_model->getPOLineItemReceivedQty($PONO,$MaterialCode); - $ReceivedQuantity = 0.00; - if(count($Recqty)>0) - { + $Recqty = $this->inwardgateregister_model->getPOLineItemReceivedQty($PONO,$MaterialCode); + $ReceivedQuantity = 0.00; + if(count($Recqty)>0) + { foreach ($Recqty as $key ) { $ReceivedQuantity=$key->ReceivedQuantity; } - } - $totalReceivedqty = $ReceivedQuantity + $QuantityAsPerInvoice; + } + $totalReceivedqty = $ReceivedQuantity + $QuantityAsPerInvoice; - //echo ''; - - $POLineItem = array('ReceivedQuantity'=>$totalReceivedqty,'Status'=>$ItemStatus,'UpdateBY'=>$CreatedBy,'UpdatedOn'=>$createddt ); + $POLineItem = array('ReceivedQuantity'=>$totalReceivedqty,'Status'=>$ItemStatus,'UpdateBY'=>$CreatedBy,'UpdatedOn'=>$createddt ); $this->inwardgateregister_model->UpdatePOLineItem($POLineItem,$PONO,$MaterialCode); } - - // $file =$this->addfile(); - // $emergencyitemcode = $this->input->post('emergencyitemcode'.$i); - // ($this->input->post('materialCode'.$i)); - // $myfile = array('FilePath'=>$file,'MaterialCode'=>$emergencyitemcode,'PONO'=>$PONO,'IGRNO'=>$IGRNO); - // // print_r($myfile); - // $result= $this->purchaseorder_model->fileupload($myfile); - - - - - - - } - - + } $file =$this->addfile(); $emergencyitemcode = $this->input->post('materialCode'.$i); $myfile = array('FilePath'=>$file,'MaterialCode'=>$emergencyitemcode,'PONO'=>$PONO,'IGRNO'=>$IGRNO); - $result= $this->purchaseorder_model->fileupload($myfile); - - - - + $result= $this->purchaseorder_model->fileupload($myfile); } - //if($result > 0) - // { - - echo ""; redirect('purchaseorder/PurchaseOrderList','refresh'); - // } } /** - * This function is used to load the purchaseorder list + * To load the purchaseorder list */ function PurchaseOrderList() { $this->load->library('pagination'); - $count = $this->purchaseorder_model->purchaseorderListingCount(''); - $returns = $this->paginationCompress ( "purchaseorderListing/", $count, 5 ); - - //$this->purchaseorder_model->UpdateRequistItemStatus(); $this->purchaseorder_model->UpdateRequistionStatus(); $data['POData'] = $this->purchaseorder_model->purchaseorderListing(); - $this->global['pageTitle'] = 'Resico : Purchase Orders'; if($this->DEPCode == PURCHASE ) { - - $this->loadViews("POlist", $this->global, $data, NULL); - + $this->loadViews("POlist", $this->global, $data, NULL); } - - else + else { $this->loadViews("access", $this->global, $data, NULL); - } } + + /** + *Validation for dropdown + */ function Req_validate($selectValue) { - //echo 'select_validate method called'; - // 'none' is the first option and the text says something like "-Choose one-" + if(strlen($selectValue) == 0) { $this->form_validation->set_message('Req_validate', 'Please Select Requisition Number to Create PO.'); @@ -899,7 +713,7 @@ $RequestedBy = $this->input->post('drpDepartment'); } /** - * This function used to show the Purchase Order Screen + * To show the Purchase Order Screen */ function CreatePurchaseOrder() @@ -913,7 +727,7 @@ $RequestedBy = $this->input->post('drpDepartment'); if($this->form_validation->run() == FALSE) { $this->requisition(); - //echo 'Validate method called'; + } else { @@ -933,20 +747,19 @@ $RequestedBy = $this->input->post('drpDepartment'); $ReqArray[] = $SID->ReqNo ; $result[] = $this->purchaseorder_model->getRawPOMaterialList($SID->ReqNo); $ReqType = $SID->ReqType; - //echo $SID->ReqNo; - + endforeach; - //print_r ($result); + $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $Year = $dt->format('Y'); $data['CostList'] = $this->purchaseorder_model->getCostCenterbyRequist('',$Year,$ReqType); - $data['MaterialList'] = $result; //$this->purchaseorder_model->getRawMaterialList($ReqType,$ReqArray); - //print_r ($data['MaterialList']); + $data['MaterialList'] = $result; $data['RequistionDetails'] = $this->purchaseorder_model->getRequistDetails($ReqArray); $data['CompanyDetails'] = $this->purchaseorder_model->getCompanyInformation(); $data['MaxPODate'] = $this->purchaseorder_model->getLastCreatedPODate(); $ViewName = ''; + if($ReqType == REVENUE) { $ViewName = 'Purchaseorder'; @@ -955,6 +768,7 @@ $RequestedBy = $this->input->post('drpDepartment'); { $ViewName = 'servicePurchaseorder'; } + $this->loadViews($ViewName, $this->global,$data, NULL); } } @@ -975,7 +789,9 @@ $RequestedBy = $this->input->post('drpDepartment'); } } - //To View/Update Purchase Order + /** + * To View/Update Emergency Purchase Order + **/ function EditPurchaseOrder() { $PONO = $_GET['PONO']; @@ -987,27 +803,28 @@ $RequestedBy = $this->input->post('drpDepartment'); $data['ReqList'] = $Req ; $result = array(); $ReqArray = array(); + foreach ($Req as $SID): $ReqArray[] = $SID->ReqNo ; $result[] = $this->purchaseorder_model->getRawPOMaterialList($SID->ReqNo); endforeach; - $data['MaterialList'] = $result;//$this->purchaseorder_model->getRawMaterialList($ReqType,$ReqArray); + + $data['MaterialList'] = $result; $data['Suplist'] = $this->purchaseorder_model->getSupplierName(); $data['RequistionDetails'] = $this->purchaseorder_model->getRequistDetails($ReqArray); $data['POMaster'] = $this->purchaseorder_model->GetServicePurchaseOrder($PONO); $data['MaxPODate'] = $this->purchaseorder_model->getLastCreatedPODate(); $data['TaxType'] = $this->purchaseorder_model->getConfigValue('C006'); $data['FreightType'] = $this->purchaseorder_model->getConfigValue('C018'); + if($ReqType == SERVICE) { - $data['POItem'] = $this->purchaseorder_model->GetServicePurchaseOrderDetails($PONO); $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); $this->global['pageTitle'] = 'Resico : Edit Revenue Purchase order form'; $this->loadViews("editRevenuepurchaseorder", $this->global, $data, NULL); @@ -1015,18 +832,16 @@ $RequestedBy = $this->input->post('drpDepartment'); } - // To get the Material value based on the MaterialCode + /** + * To get the Material value based on the MaterialCode + **/ function getDetailsforReq() { - - $SearchFilter= $this->input->post('id'); - // $reqDate= $this->input->post('ReqDate'); $DeptCode = $SearchFilter[0]; $MatType = $SearchFilter[1]; $ReqNo = $SearchFilter[2]; - // $ReqDetai = $this->purchaseorder_model->getRequistDetails( $EmpID ); - + $CostList = $this->requistion_model->GetCostCenterByDept( $DeptCode); $HTML = ""; @@ -1055,11 +870,12 @@ $RequestedBy = $this->input->post('drpDepartment'); } } - // print_r($HTML1); - + die(json_encode(array('MatDetail' =>$HTML1,'Cost'=> $HTML))); } - /* This method to get the status based on the Department selection in th + + /** + * This method to get the status based on the Department selection in th */ function getStatusByDepartment() { @@ -1077,15 +893,16 @@ $RequestedBy = $this->input->post('drpDepartment'); $HTML .=""; } } - //echo $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'); - // $reqDate= $this->input->post('ReqDate'); + $CostCode = $SearchFilter[0]; $ReqType = $SearchFilter[1]; print_r($SearchFilter); @@ -1095,41 +912,41 @@ $RequestedBy = $this->input->post('drpDepartment'); $Year = $dt->format('Y'); $this->load->model('purchaseorder_model'); $result = $this->purchaseorder_model->GetAvailableBudgetAmount($CostCode,$Year,$ReqType); - //print_r($result); + $AvilBudAmt = ''; if(count($result)>0) { $AvilBudAmt = $result[0]['BudgetAmount'] - $result[0]['Totalvalue']; } - // echo 'Test'; print_r($AvilBudAmt); - //die(json_encode(array('Cost' => $AvilBudAmt))); + } - + /** + * To Convert the dateformat (date with time) and stored into DB + */ function getDateformat($Val) { $date = new DateTime($Val,new DateTimeZone('Asia/Kolkata')); - // print_r($date); $retDate = $date->format('Y-m-d H:i:s'); return $retDate; } - /* Method to get the Requistion list based on the search filter*/ - + + /** + * Method to get the Requistion list based on the search filter + **/ function SearchListofRequistion() { $SearchFilter= $this->input->post('id'); - // $reqDate= $this->input->post('ReqDate'); $DEPCode = $SearchFilter[0]; $Status = $SearchFilter[1]; $rng = $SearchFilter[2]; - // $ToDate = $SearchFilter[3]; $FromDate =''; $ToDate = ''; - // echo $rng; + $Dt = explode("-",$rng); - // print_r( $Dt); + if(count( $Dt)>1) { $FDate = $Dt[0]; @@ -1137,11 +954,8 @@ $RequestedBy = $this->input->post('drpDepartment'); $FromDate = $this->getDateformat($FDate); $ToDate = $this->getDateformat($TDate); } - //echo $FromDate; - // print_r($Dt); $result = $this->purchaseorder_model->getRequistionListbySearch($DEPCode,$Status,$FromDate,$ToDate); - $HTML=""; for ($i = 0; $i < count($result); $i++) { @@ -1157,9 +971,7 @@ $RequestedBy = $this->input->post('drpDepartment'); $HTML.=" ". $ReqNo." - - ".$ReqType." - + ".$ReqType." ".$Reqedby." ".$ReqDate." ".$Status." @@ -1167,12 +979,13 @@ $RequestedBy = $this->input->post('drpDepartment'); ".$Designation." "; } - //print_r( $HTML); die(json_encode(array('ReqList' =>$HTML))); } - /* To View the request details*/ + /** + * To View the request details + **/ function ListPORequistion() { $ReqNo= $this->input->post('id'); @@ -1198,8 +1011,6 @@ $RequestedBy = $this->input->post('drpDepartment'); ".$Quantity." "; - //$index = $index + 1; - } $CostCenter = ""; @@ -1212,12 +1023,12 @@ $RequestedBy = $this->input->post('drpDepartment'); $CostCenter .=""; } } - //echo $HTML; - //echo $CostCenter; die(json_encode(array('Items' =>$HTML,'Requist'=>$ReqList,'Cost'=>$CostCenter))); } - //This used to Create Revenue Purchase Order + /** + * To Create Revenue Purchase Order + **/ function addNewPurchaseOrder() { $POdt =$this->input->post('PODate'); @@ -1252,12 +1063,7 @@ $RequestedBy = $this->input->post('drpDepartment'); { $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++) { @@ -1319,15 +1125,15 @@ $RequestedBy = $this->input->post('drpDepartment'); { $LineItemNo = $POLineItem[0]['LineItemNo']; } - //echo $LineItemNo; + if(trim($POType) == REVENUE ) { - // echo 'Success'; + $RevenueTaxList = array('LineItemNo'=>$LineItemNo, 'DiscountType'=>$DiscountType,'DiscountValue'=>$DiscountValue,'AfterDiscount'=>$AfterDiscount,'PackagingType'=>$PackagingType,'PackagingValue'=>$PackagingValue,'PackagingCalulatedOn'=>$PackagingOption,'AfterPackagingValue'=>$AfterPackagingValue,'FreightType'=>$FreightType, 'FreightValue'=>$FreightValue,'AfterFreightValue'=>$AfterFreightValue,'ExciseDuty'=>$ExciseValue,'ExciseDutyCalulatedOn'=>$ExciseOption,'AfterExciseDuty'=>$AfterExciseValue,'Vat'=>$VatValue,'AfterVAT'=>$AfterVatValue,'VatCalulatedOn'=>$VatOption, 'CST'=>$CSTValue,'AfterCST'=>$AfterCSTValue,'CSTCalulatedOn'=>$CSTOption,'GST'=>$GSTValue,'AfterGST'=>$AfterGSTValue,'OtherTaxes'=>$OtherTaxValue,'AfterOtherTaxes'=>$AfterOtherTaxValue,'Insurance'=>$InsuranceValue,'TotalValue'=>$TotalOrderValue, 'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt); $RevenueList = $this->purchaseorder_model->addRevenueTax($RevenueTaxList); - //echo 'Revenue tax Success'; + } } @@ -1335,7 +1141,10 @@ $RequestedBy = $this->input->post('drpDepartment'); echo 'Purchase Order Created Successfully! PO Number Is: '.$PONO ; } - //This used to Edit the Revenue Purchase Order + + /** + * This used to Edit the Revenue Purchase Order + **/ function EditRevenuePurchaseOrder() { $PONO =$this->input->post('txtPONO'); @@ -1360,17 +1169,13 @@ $RequestedBy = $this->input->post('drpDepartment'); $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $updateddt = $dt->format('Y-m-d H:i:s'); $Local_Interstate=$this->input->post('Range'); - // PO Master + // PO Master $POList = array('SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrderValueSummary,'PODate'=>$PODate,'Status'=>$POStatus,'ServiceDescription'=>$SpcialInstruction,'UpdateBY'=>$updatedBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'UpdatedOn'=>$updateddt,'CapitalRange'=>$Local_Interstate ); $POMaster = $this->purchaseorder_model->updatePOMaster($PONO,$POList); $LineItemStatus = REQITEM_NEW; - - - - //echo $RowCount; for ($i = 1; $i <= $RowCount; $i++) { @@ -1465,24 +1270,25 @@ $RequestedBy = $this->input->post('drpDepartment'); echo 'Purchase Order Updated Successfully! PO Number Is: '.$PONO ; } + + /** + * To load pagenotfound view + */ function pageNotFound() { $this->global['pageTitle'] = 'Resico : 404 - Page Not Found'; - $this->loadViews("404", $this->global, NULL, NULL); } + /** + * To load revenue PO for PDF + */ public function revenuepoprint($PONO) { - // Load all views as normal - - - //$PONO = $_GET['PO']; - + $data['CompanyDetails'] = $this->purchaseorder_model->getCompanyInformation(); $data['POItem'] = $this->purchaseorder_model->GetRevenuePurchaseOrderDetailsForPDF($PONO); - // Add header to pdf //$this->load->view('includes/pdfheader'); @@ -1505,6 +1311,10 @@ $RequestedBy = $this->input->post('drpDepartment'); $this->dompdf->stream("RevenuePOReport.pdf",$data,$php); } + + /** + * To load service PO for PDF + */ public function servicepoprint($PONO) { @@ -1532,8 +1342,10 @@ $RequestedBy = $this->input->post('drpDepartment'); $this->dompdf->stream("ServicePOReport.pdf",$data,$php); } + + /** - * This function used to load the Delete the Requistion Items + * To load the Delete the Requistion Items */ function DeletePODetails() { @@ -1550,14 +1362,12 @@ $RequestedBy = $this->input->post('drpDepartment'); $MaterialCode = $ReqList[2]; $POType = $ReqList[3]; } - // print_r($ReqList); - - - If($POType == REVENUE) + + if($POType == REVENUE) { $this->purchaseorder_model->DeletePORevenueTax($LineItemNo); } - else If($POType == SERVICE) + else if($POType == SERVICE) { $this->purchaseorder_model->DeletePOServiceTax($LineItemNo); } diff --git a/application/controllers/monthlypay.php b/application/controllers/monthlypay.php index fca9aadf..57d8155a 100755 --- a/application/controllers/monthlypay.php +++ b/application/controllers/monthlypay.php @@ -366,7 +366,6 @@ class monthlypay extends BaseController { $this->session->set_flashdata('error', 'updation failed'); } - //echo success; redirect('monthlyListings'); } @@ -374,7 +373,75 @@ class monthlypay extends BaseController } + /** + * To load employee payment details for permission screen + **/ + function permissionslip() + { + $this->global['pageTitle'] = 'Resico : Permission Slip'; + + $data['emplists']=$this->monthlypay_model->emplist(); + + $this->loadviews('permission',$this->global,$data,NULL); + } + + /** + * To store new permission details into DB. + **/ + function addper() + { + $EmpID = $this->input->post('emp'); + $Date =$this->input->post('date'); + $From = $this->input->post('timepicker1'); + $To = $this->input->post('timepicker2'); + $Shift = $this->input->post('shift'); + $Permission = $this->input->post('Pretime'); + $Reason= $this->input->post('Reason'); + $Createdby = $this->session->userdata('userId'); + + $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); + $Createdtime = $dt->format('Y-m-d H:i:s'); + + $Permissiondata = array('EmpID'=>$EmpID,'Date'=>$Date,'From'=>$From,'To'=>$To,'Shift'=>$Shift,'Permission'=>$Permission,'Reason'=>$Reason,'Createby'=>$Createdby,'Createdtime'=>$Createdtime); + + $result = $this->monthlypay_model->addper($Permissiondata); + redirect('monthlypay/permissionlist'); + + } + + /** + * To get permission slip details for listing + */ + function permissionlist(){ + + $this->global['pageTitle'] = 'Resico : Permission Listing'; + $data['permissionlist']=$this->monthlypay_model->perlist(); + $this->loadviews('permissionlist',$this->global,$data,NULL); + } + + /** + * To display permissionslip details for PDF + */ + function permissionpdf($SNO){ + + $data['per'] = $this->monthlypay_model->pdf($SNO); + + $this->load->view($this->config->item('admin_folder') .'/permissionpdf',$data); + + $mpdf=new mPDF('utf-8','A4-P',10, 10,10, 10, 10, 38, 4, 6); + $mpdf->SetDisplayMode('fullpage'); + $mpdf->SetHTMLHeader($HtmlHeading); + + $html = $this->load->view('permissionpdf',$data,true); + + $mpdf->SetDisplayMode('fullpage'); + $mpdf->setAutoTopMargin = 'stretch'; + $mpdf->setAutoBottomMargin = 'stretch'; + $mpdf->WriteHTML($html); + $mpdf->Output("Permission".$data.'.pdf','I',$php); + } + /** * To load pagenotfound view */ diff --git a/application/controllers/purchaseorder.php b/application/controllers/purchaseorder.php index 0050dd5d..2818d785 100644 --- a/application/controllers/purchaseorder.php +++ b/application/controllers/purchaseorder.php @@ -7,7 +7,7 @@ require APPPATH . '/third_party/mpdf/mpdf.php'; /** * Class : purchaseorder (Purchase order - Controller) * purchaseorder Class to control all po related operations. - * @author : Venba InfoTech + * @author : Venba Info Tech * @version : 1.1 * @since : 18 November 2017 */ @@ -35,15 +35,18 @@ class purchaseorder extends BaseController $this->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); + $this->loadViews("viewfullpurchaseorder", $this->global,Null); - } - function advancerequest() + } + + /** + * To load Advance Request screen + */ + function advancerequest() { $this->global['pageTitle'] = 'Resico : Advance Request'; @@ -51,6 +54,10 @@ class purchaseorder extends BaseController $this->loadViews("advancerequest", $this->global, $data, NULL); } + + /** + * To Create PO from Requisition Listing + */ function requisition() { $data['DeptList'] = $this->purchaseorder_model->getDepartmentListForAllReq(); @@ -67,7 +74,7 @@ class purchaseorder extends BaseController /** - * This function is used to load the purchaseorder list + * To List the all PurchaseOrder */ function PurchaseOrderList() { @@ -82,23 +89,26 @@ class purchaseorder extends BaseController } + /** + * Validation - if user pick two or more requisition check box means + */ function Req_validate($selectValue) { if(strlen($selectValue) == 0) { $this->form_validation->set_message('Req_validate', 'Please Select Requisition Number to Create PO.'); return false; + } + else // user picked something + { + return true; + } } - else // user picked something - { - return true; - } -} /** - * This function used to show the Purchase Order Screen + * To show the Purchase Order Screen */ - function CreatePurchaseOrder() + function CreatePurchaseOrder() { $this->form_validation->set_rules('txtReqNo', 'txtReqNo', 'callback_Req_validate'); @@ -111,166 +121,132 @@ 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(); - // print_r($data['Payment']); - - $data['WorkStatus']=$this->purchaseorder_model->getStatus(7); - - - - + $this->global['pageTitle'] = 'Resico : Purchase order' ; - $SelectedReq = json_decode($this->input->post('txtReqNo')); + $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 == '') - { + $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; + } + endforeach; $data['MaterialList'] = $result; - //print_r($data['MaterialList']); + /* 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(); - //print_r($data['CompanyDetails']); - // $data['MaxPODate'] = $this->purchaseorder_model->getLastCreatedPODate(); $data['MaxPODate'] = $this->purchaseorder_model->getLastReleasedPODate(); $data['Currency']=$this->purchaseorder_model->GetCurrencytype(); $data['INRSYMBOL']=$this->purchaseorder_model->GetINRCurrencytype('INR'); - //print_r($data['INRSYMBOL']); $AvlimportBudget = $this->purchaseorder_model->GetAvailableImportBudgetAmount($CostCode,$FYdt,$ReqType); - - //print_r($AvlimportBudget); - - // $AvlBudget = $this->purchaseorder_model->GetAvailableBudgetAmount($CostCode,$Year,$ReqType); - - //print_r($AvlimportBudget); - - - 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); } } + + /** + * For pdf Based on PONO and req.type its get revalant potype pdf function + */ 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); @@ -279,27 +255,40 @@ class purchaseorder extends BaseController - + /** + * To load revenue po pdf screen + */ function CreaterevenuePOPrint() { $this->load->View("revenuepopdf", NULL); - } + } + /** + * To load service po pdf screen + */ function CreateservicePOPrint() { $this->load->View("servicepopdf", NULL); - } + } + /** + * To load import po pdf screen + */ function CreateimportPOPrint() { $this->load->View("importpopdf", NULL); - } + } + /** + * To load capital po pdf screen + */ function CreatecapitalPOPrint() { $this->load->View("capitalpopdf", NULL); - } - //To View/Update Purchase Order - - function EditPurchaseOrder() - { + } + + /** + * To View/Update Purchase Order + */ + function EditPurchaseOrder() + { $PONO = $_GET['PONO']; $ReqType = $_GET['ReqType']; @@ -309,66 +298,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;//$this->purchaseorder_model->getRawMaterialList($ReqType,$ReqArray); + $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) - { + $data['RequistionDetails'] = $ReqDetails; + + foreach ($data['RequistionDetails'] as $ReqDet) + { + + $Status=$ReqDet->Status; + } - $Status=$ReqDet->Status; - } + $data['POSTATUS']=$this->purchaseorder_model->GetPOStatus($Status); + + foreach ($data['POSTATUS'] as $POST) + { + $Status=$POST->StatusName; + } - $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']; - } + $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); - //$data['POSTATUS']=$this->purchaseorder_model->GetServicePurchaseOrder($PONO); - //print_r($data['POMaster']); foreach ($data['POMaster'] as $Exc) { $exRate=$Exc->ExchangeRate; @@ -382,125 +370,112 @@ 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->GetWorkStatus('C019'); - - $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']; - } - //print_r($data['AvlBudAmt']); - $data['POItem'] = $this->purchaseorder_model->GetImportPurchaseOrderDetails($PONO); - // print_r($data['POItem']); - $data['Currency']=$this->purchaseorder_model->GetCurrencytype(); - foreach($data['POMaster'] as $CUR) - { - //print_r($CUR->CurrencyType); - $Currency=$CUR->CurrencyType; - } - // $data[$Rate->ExchangeRate]=$Rate->ExchangeRate; - $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); - //print_r($data['PaymentTerms']); - $unicode =''; - foreach ($data['CurrencyDetail'] as $Detail) - { - $unicode=$Detail->FontCode2000; - } - foreach ($data['CurrencyDetail'] as $Detail) - { - $currencycode=$Detail->Currency_Code; - } - //print_r($unicode); - $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); - - //$CapitalRange=''; - foreach($data['POItem'] as $Rate) - { + foreach($data['POItem'] as $Rate) + { $exRate=$Rate->ExchangeRate; $CapitalRange=$Rate->CapitalRange; - } - foreach($data['POItem'] as $CUR) - { - - $Currency=$CUR->CurrencyType; - } + } - if($CapitalRange=='0'){ - $data['CurrencyDetail']=$this->purchaseorder_model->GetCurrencyDetail($Currency); + foreach($data['POItem'] as $CUR) + { + $Currency=$CUR->CurrencyType; + } + + 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); + } } - - + // function PurchaseOrderFinanceView() { $PONO = $_GET['PONO']; $POType = $_GET['POType']; - $ReqType= $_GET['ReqType']; $Req = $this->purchaseorder_model->getRequistionNoFromPO($PONO); @@ -514,59 +489,59 @@ class purchaseorder extends BaseController $result[] = $this->purchaseorder_model->getRawPOMaterialList($SID->ReqNo); endforeach; - $data['MaterialList'] = $result;//$this->purchaseorder_model->getRawMaterialList($ReqType,$ReqArray); + $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); - //$data['POSTATUS']=$this->purchaseorder_model->GetServicePurchaseOrder($PONO); - //print_r($data['POMaster']); + foreach ($data['POMaster'] as $Exc) { $exRate=$Exc->ExchangeRate; @@ -582,152 +557,127 @@ 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'); - - - //print_r($AvlBudget); - - - if(count($AvlBudget)>0) - { - $data['AvlBudAmt'] = $AvlBudget[0]['BudgetAmount'] - $AvlBudget[0]['Totalvalue']; - } - //print_r($data['AvlBudAmt']); - $data['POItem'] = $this->purchaseorder_model->GetImportPurchaseOrderDetails($PONO); - // print_r($data['POItem']); - $data['Currency']=$this->purchaseorder_model->GetCurrencytype(); - foreach($data['POMaster'] as $CUR) - { - //print_r($CUR->CurrencyType); - $Currency=$CUR->CurrencyType; - } - // $data[$Rate->ExchangeRate]=$Rate->ExchangeRate; - $data['CurrencyDetail']=$this->purchaseorder_model->GetCurrencyDetail($Currency); - $data['PaymentTerms']=$this->purchaseorder_model->GetPaymentTerms($PONO); - $data['PoTypeOptions'] = $this->purchaseorder_model->getConfigValue('C026'); - //print_r($data['PaymentTerms']); - $unicode =''; - foreach ($data['CurrencyDetail'] as $Detail) - { - $unicode=$Detail->FontCode2000; - } - foreach ($data['CurrencyDetail'] as $Detail) - { - $currencycode=$Detail->Currency_Code; - } - //print_r($unicode); - $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) - { + 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'){ $data['POItem'] = $this->purchaseorder_model->getDomesticCapitalPurchaseOrderDetails($PONO); - } + } $data['requestedBy'] = $this->purchaseorder_model->GetRequesedByDetails($PONO); - - //$CapitalRange=''; - 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'); - // $reqDate= $this->input->post('ReqDate'); - $DeptCode = $SearchFilter[0]; - $MatType = $SearchFilter[1]; - $ReqNo = $SearchFilter[2]; - // $ReqDetai = $this->purchaseorder_model->getRequistDetails( $EmpID ); - - $CostList = $this->requistion_model->GetCostCenterByDept( $DeptCode); + { + $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) - { + $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); + { + $Code = $CostList[$j]['CostCenterCode']; + $Name = $CostList[$j]['CostCenterName']; + $HTML .=""; + } + } + $MaterialDetails = $this->purchaseorder_model->getRawMaterialListForPO($MatType,$ReqNo); - $HTML1 = ""; + $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 .=""; - - } - - } - // print_r($HTML1); - + { + $Code = $MaterialDetails[$j]['MaterialCode']; + $Name = $MaterialDetails[$j]['MaterialName']; + $HTML1 .=""; + } + } die(json_encode(array('MatDetail' =>$HTML1,'Cost'=> $HTML))); - } - /* This method to get the status based on the Department selection in th - */ + } + + + /** + * To get the status based on the Department selection + */ function getStatusByDepartment() { $DepId = $this->input->post('id'); @@ -744,168 +694,170 @@ class purchaseorder extends BaseController $HTML .=""; } } - //echo $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'); - // $reqDate= $this->input->post('ReqDate'); + $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); - //print_r($result); - $AvilBudAmt = ''; + $result = $this->purchaseorder_model->GetAvailableBudgetAmount($CostCode,$Year,$ReqType); + + $AvilBudAmt = ''; if(count($result)>0) { $AvilBudAmt = $result[0]['BudgetAmount'] - $result[0]['Totalvalue']; } - - print_r($AvilBudAmt); + print_r($AvilBudAmt); } - - function getDateformat($Val) + /** + * To Convert the dateformat (date with time) and stored into DB + */ + function getDateformat($Val) { $date = new DateTime($Val,new DateTimeZone('Asia/Kolkata')); $retDate = $date->format('Y-m-d H:i:s'); return $retDate; } - /* Method to get the Requistion list based on the search filter*/ - + + /** + * Method 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*/ + /** + * 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." + "; + + } - //$index = $index + 1; - - } - - $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))); } - //This used to Create Revenue Purchase Order - + /** + * To Create Revenue Purchase Order + */ 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'); - //$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 = ''; + } + + $POType = $this->input->post('POType'); $Modeofshipment=$this->input->post('addmodeofshipment'); $supplierreference=$this->input->post('addsupplierreference'); $supplieroffno=$this->input->post('addsupplierofferno'); @@ -913,54 +865,45 @@ 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); - - // print_r($POList); - // die(); - + + // 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); - $POMaster = $this->purchaseorder_model->addPOMaster($POList,$POType,$revenuetype); - - $PONO = ''; - if(count($POMaster)>0) - { + $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); @@ -968,40 +911,38 @@ 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); - //print_r($POLineItemList); + $POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList); $LineItemNo = ''; @@ -1009,45 +950,44 @@ class purchaseorder extends BaseController { $LineItemNo = $POLineItem[0]['LineItemNo']; } - //echo $LineItemNo; if(trim($POType) == REVENUE ) { - // echo 'Success'; + $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); - //print_r($RevenueTaxList); + $RevenueList = $this->purchaseorder_model->addRevenueTax($RevenueTaxList); - //echo 'Revenue tax Success'; + } } } echo 'Purchase Order Created Successfully! PO Number Is: '.$PONO ; - } - //This used to Edit the Revenue Purchase Order + } + + + /** + * To Edit the Revenue Purchase Order + */ function EditRevenuePurchaseOrder() { - //echo "EDIT REBEIE"; - //die(); $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'); - //$Deliverydt = $this->getDateformat($dt); $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'); @@ -1056,44 +996,37 @@ 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'); - //echo $RowCount . "-" . $DeletedRow; - //die(); $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); - //print_r($POList); - //die(); - $POMaster = $this->purchaseorder_model->updatePOMaster($PONO,$POList); + + // 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); + + $LineItemStatus = REQITEM_NEW; + for ($i = 1; $i <= $RowCount; $i++) + { - $LineItemStatus = REQITEM_NEW; - - //echo "OUT"; - for ($i = 1; $i <= $RowCount; $i++) - { - //echo "IN"; $MaterialCode = $this->input->post('materialCode'.$i); $Quantity = $this->input->post('quantity'.$i); $Reqnumber = $this->input->post('Reqnumber'.$i); @@ -1107,50 +1040,47 @@ 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); - //print_r($POLineItemList); - $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 @@ -1159,7 +1089,6 @@ 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); - //print_r($POLineItemList); $POLineItem = $this->purchaseorder_model->updatePOLineItem($PONO,$POLineItemNo,$POLineItemList); } @@ -1167,7 +1096,6 @@ 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); - //print_r($RevenueTaxList); $RevenueList = $this->purchaseorder_model->addRevenueTax($RevenueTaxList); } @@ -1175,256 +1103,169 @@ 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); - //print_r($RevenueTaxList); + $this->purchaseorder_model->updateRevenueTax($LineItemNo,$RevenueTaxList); - } - } + } + } - } + } echo 'Purchase Order Updated Successfully! PO Number Is: '.$PONO ; - } + } + + /** + * To load pagenotfound view + */ function pageNotFound() { $this->global['pageTitle'] = 'Resico : 404 - Page Not Found'; $this->loadViews("404", $this->global, NULL, NULL); } - - public function revenuepoprint($PONO) + + /** + * To load revenue po datas for pdf + */ + public function revenuepoprint($PONO) { - // Load all views as normal - - - //$PONO = $_GET['PO']; + // 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); - // Add header to pdf - //$this->load->view('includes/pdfheader'); - - // Load the pdf page with multiviews - // $this->load->View("revenuepopdf", $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("RevenuePOReport".$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)); - + $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'); + $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->Image('files/images/frontcover.jpg', 0, 0, 210, 297, 'jpg', '', true, false); $mpdf->SetHTMLHeader($HtmlHeading); $html = $this->load->view('revenuepopdf',$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->setAutoTopMargin = 'stretch'; $mpdf->setAutoBottomMargin = 'stretch'; - //$stylesheet = file_get_contents('assets/css/mpdfstyletables.css'); - //$mpdf->WriteHTML($stylesheet, 1); $mpdf->WriteHTML($html); - //$mpdf->writeHTMLHeaders(); - - $mpdf->Output('RevenuePOReport'.$PONO.'.pdf','I'); - -} + $mpdf->Output('RevenuePOReport'.$PONO.'.pdf','I'); + } - - - public function servicepoprint($PONO) - { - - // $this->load->view('includes/pdfheader'); - - // Load the pdf page with multiviews - $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'); - - //print_r( $data['CurrencySymbol']); - - $TotalOrderValue=0; - $Currencycode=''; - foreach ($data['POItem'] as $POValue) - { - + /** + * 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); + } + $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); - // $this->load->View("servicepopdf", $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("ServicePOReport".$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); - $mpdf->SetWatermarkImage('./assets/images/mpdf.png', 8, 10 ); - $mpdf->showWatermarkImage = 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'); - } + 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->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('servicepopdf',$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('ServicePOReport'.$PONO.'.pdf','I'); + $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'); -} + } - - - - - -public function importpoprint($PONO) +/** + * Index Page for this controller (default function of the class) + */ + public function importpoprint($PONO) { - // echo $PONO; - // die(); - //$this->load->view('includes/pdfheader'); - - // Load the pdf page with multiviews - $Requester=''; + $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); - //print_r( $data['RequistionDetails']); + foreach ($data['POItem'] as $Reqdby) { $Requester=$Reqdby->Requestedby; @@ -1432,7 +1273,6 @@ public function importpoprint($PONO) } - foreach ($data['POItem'] as $CURTYPE) { $Currencycode=$CURTYPE->CurrencyType; @@ -1446,38 +1286,30 @@ public function importpoprint($PONO) } $data['DEPCODE']=$this->purchaseorder_model->GerRequesterDep($Depcode); - //print_r($data['Requestername']); $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; - - //$totalAmt=sprintf("%.2f", $ProductPrice); - //$data['TotalAmountInWords']= $this->convertNumber($totalAmt); - //print_r($data['TotalAmountInWords']); - - //$this->load->View("importpopdf", $data); - - - $CurrencyType=''; - if(!empty($data['POItem'])){ - $CurrencyType=$data['POItem'][0]->CurrencyType; - } - //echo $CurrencyType; - - if($CurrencyType=='') - { + $CurrencyType=''; + + if(!empty($data['POItem'])){ + $CurrencyType=$data['POItem'][0]->CurrencyType; + } + if($CurrencyType=='') + { $data['CurrencySymbol']=$this->purchaseorder_model->GerCurrencyCodeName('INR'); } else @@ -1485,17 +1317,11 @@ public function importpoprint($PONO) $data['CurrencySymbol']=$this->purchaseorder_model->GerCurrencyCodeName($CurrencyType); } - // $TotalOrderValue=$data['POItem'][0]->$TotalOrderValue; - //print_r($data['POItem'][0]); - - $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) @@ -1504,60 +1330,29 @@ public function importpoprint($PONO) $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); - // $data['TotalAmountInWords']= $this->convertNumberSymbol($totalAmt,$SymbolCurrency,$SymbolCurrencyName,$PaiseVal); - - - // $this->load->View("importpopdf", $data); - - // $this->load->View("mririmportpopdf", $data); - - - // Add header to pdf - //s $this->load->view('includes/pdffooter'); + $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'); - // Get output html - // $php = $this->output->get_output(); + if($PoStatus == PO_RELEASED || $PoStatus == PO_SERVICE_COMPLETED || $PoStatus == MRIR_APPROVED || $PoStatus == MRIR_REJECTED || $PoStatus == IGR_CREATED || $PoStatus==''){ - // 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->set_paper(array(0, 0, 841.89, 1190.55), 'landscape'); - // $this->dompdf->load_html($php); - // $this->dompdf->render(); - //$data['Attachment'] = FALSE; - // $this->dompdf->stream("ImportPOReport".$PONO.".pdf",$data,$php); + $mpdf->SetWatermarkText(''); - - /// - $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); - $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'); - } + } + else{ + $mpdf->SetWatermarkText('DRAFT'); + } + $mpdf->watermark_font = 'DejaVuSansCondensed'; + $mpdf->showWatermarkText = true; - $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('importpopdf',$data,true); //$mpdf=new mPDF('utf-8', array(500,500)); @@ -1624,7 +1419,9 @@ public function importpoprint($PONO) } - +/** + * Index Page for this controller (default function of the class) + */ function addNewImportPurchaseOrder() {//echo ("ggh"); @@ -1828,7 +1625,9 @@ function addNewImportPurchaseOrder() echo 'Purchase Order Created Successfully! PO Number Is: '.$PONO ; } - +/** + * Index Page for this controller (default function of the class) + */ function EditImportPurchaseOrder() { @@ -2149,7 +1948,9 @@ function addNewImportPurchaseOrder() return $retDate; } - + /** + * Index Page for this controller (default function of the class) + */ function ApprovePO() { $StatusCode= Trim($_POST['SCode']); @@ -2205,7 +2006,9 @@ function addNewImportPurchaseOrder() } - + /** + * Index Page for this controller (default function of the class) + */ function ReleasePO() { $StatusCode= Trim($_POST['SCode']); @@ -3095,7 +2898,9 @@ $amountInWords = $name." " . $result.$paise ." ". $points." Only"; } - +/** + * Index Page for this controller (default function of the class) + */ function addadvancerequest() { diff --git a/application/controllers/quality.php b/application/controllers/quality.php index 4dc33a88..543ee5c2 100644 --- a/application/controllers/quality.php +++ b/application/controllers/quality.php @@ -5,7 +5,7 @@ require APPPATH . '/libraries/BaseController.php'; /** * Class : quality (Quality Controller) * quality Class to control all quality related operations. - * @author : VenbaInfoTech - + * @author : Venba Info Tech * @version : 1.1 * @since : 09 December 2017 */ @@ -30,6 +30,7 @@ class quality extends BaseController $data['products'] = $this->quality_model->getAllprodcuts(); $data['customers'] = $this->quality_model->getAllcustomers(); $data['existspec'] = $this->quality_model->getAllspec(); + $data['existspecinward'] = $this->quality_model->getAllspecInward(); $this->global['pageTitle'] = 'Resico : Quality Master'; $this->loadViews("qualitymasterlistview", $this->global, $data , NULL); } @@ -40,7 +41,7 @@ class quality extends BaseController public function reportList() { $data['records'] = $this->quality_model->getTestMasterforList(); - $this->global['pageTitle'] = 'Resico : Quality Master'; + $this->global['pageTitle'] = 'Resico : Prodcut Report List '; $this->loadViews("reportmasterlist", $this->global, $data , NULL); } @@ -49,8 +50,11 @@ class quality extends BaseController */ function addNewPage() { - $data['products'] = $this->quality_model->getAllprodcuts(); - $data['customers'] = $this->quality_model->getAllcustomers(); + $data['productsoutward'] = $this->quality_model->getAllprodcuts(); + $data['customersoutward'] = $this->quality_model->getAllcustomers(); + $data['productsinward'] = $this->quality_model->getAllprodcutsInward(); + $data['customersinward'] = $this->quality_model->getAllcustomersInward(); + $this->global['pageTitle'] = 'Resico : Quality Master'; $this->loadViews("qualitymaster", $this->global, $data , NULL); } @@ -63,6 +67,8 @@ class quality extends BaseController $product = $this->input->post('param2'); $customer = $this->input->post('param3'); $jsondata = $this->input->post('param1'); + $type = $this->input->post('param4'); + $createdby = $this->session->userdata ( 'userId' ); $phpdata = json_decode($jsondata); $total = 0; @@ -80,14 +86,14 @@ class quality extends BaseController if($isExist[0]->count == 0) { - $tostore = array('customer_id'=>$customer,'product_id'=>$product,'testtype'=>$name,'uom'=>$uom,'min'=>$min,'max'=>$max,'temp'=>$temp,'created_by'=>$createdby); + $tostore = array('customer_id'=>$customer,'product_id'=>$product,'testtype'=>$name,'uom'=>$uom,'min'=>$min,'max'=>$max,'temp'=>$temp,'type'=>$type,'created_by'=>$createdby); $res = $this->quality_model->addSpecMast($tostore); } else if($isExist[0]->count == 1) { - $tostore = array('uom'=>$uom,'min'=>$min,'max'=>$max,'temp'=>$temp,'updated_by'=>$createdby); + $tostore = array('uom'=>$uom,'min'=>$min,'max'=>$max,'temp'=>$temp,'type'=>$type,'updated_by'=>$createdby); $res = $this->quality_model->updateSpecMast($tostore,$product,$customer,$name); } @@ -162,20 +168,35 @@ class quality extends BaseController function printReportPDF() { - + $type = ''; + $html = ''; + $filename = ''; + if($this->input->post('type')) + { + $type = $this->input->post('type'); + } $reportid = $this->input->post('rid'); - $data['reportdata'] = $this->quality_model->getIndividualReportData($reportid); - $filename = 'PRE DESPATCH INSPECTION REPORT'.$reportid; - $html = $this->load->View("viewindreportpdf",$data,true); - require APPPATH . '/third_party/mpdf/mpdf.php'; - $mpdf=new mPDF('utf-8','A4-P',7,10,10, 10, 10, 24, 4, 6); - $mpdf->SetDisplayMode('fullpage'); + + if($type != 'INWARD' or $type == ''){ + $data['reportdata'] = $this->quality_model->getIndividualReportData($reportid); + $filename = 'PRE DESPATCH INSPECTION REPORT'.$reportid; + $html = $this->load->View("viewindreportpdf",$data,true); + } + else if($type == 'INWARD') + { + $data['reportdata'] = $this->quality_model->getIndividualInwardReportData($reportid); + $filename = 'INWARD MATERIAL INSPECTION REPORT'.$reportid; + $html = $this->load->View("viewindinwardreportpdf",$data,true); + } + require APPPATH . '/third_party/mpdf/mpdf.php'; + $mpdf=new mPDF('utf-8','A4-P',7,10,10, 10, 10, 24, 4, 6); + $mpdf->SetDisplayMode('fullpage'); - $mpdf->list_indent_first_level = 1; - $mpdf->setAutoTopMargin = 'stretch'; - $mpdf->setAutoBottomMargin = 'stretch'; - $mpdf->WriteHTML($html); - $mpdf->Output($filename.'.pdf','I'); + $mpdf->list_indent_first_level = 1; + $mpdf->setAutoTopMargin = 'stretch'; + $mpdf->setAutoBottomMargin = 'stretch'; + $mpdf->WriteHTML($html); + $mpdf->Output($filename.'.pdf','I'); } @@ -205,10 +226,14 @@ class quality extends BaseController $batchno = $this->input->post('param5'); $chart = $this->input->post('param7'); $batchno = date_format(date_create($batchno),'Y-m-d'); + $approver = $this->input->post('param6'); + $testphpdata = json_decode($testjson,true); $loiphpdata = json_decode($loijson,true); + $afsphpdata = json_decode($afsjson,true); + $createdon = date('Y-m-d H:i:s'); $createby = $this->session->userdata ( 'userId' ); @@ -229,7 +254,7 @@ class quality extends BaseController $remarks1 = ''; foreach($testphpdata as $data) { - + $descrition = $data['Description']; $min = $data['SpecificationMin']; $max = $data['SpecificationMax']; @@ -286,6 +311,116 @@ class quality extends BaseController echo "Report Data Saved Successfully!"; + } + + + function saveInwardTestReportData() + { + + date_default_timezone_get('Asia/Kolkata'); + $testjson = $this->input->post('param1'); + $loijson = $this->input->post('param2'); + $afsjson = $this->input->post('param3'); + + $igrno = $this->input->post('param4'); + $igrlineitemno = $this->input->post('param5'); + $chart = $this->input->post('param7'); + $report_date = $this->input->post('param8'); + $report_date = date_format(date_create($report_date),'Y-m-d'); + + $approver = $this->input->post('param6'); + + $testphpdata = json_decode($testjson,true); + $loiphpdata = json_decode($loijson,true); + + $afsphpdata = json_decode($afsjson,true); + + $createdon = date('Y-m-d H:i:s'); + $createby = $this->session->userdata ( 'userId' ); + + $masterreportdata = array('igrno'=>$igrno,'igrlineitemno'=>$igrlineitemno,'batchdate'=>$report_date,'createdby'=>$createby,'createdon'=>$createdon,'approvedby'=>$approver,'chartdata'=>$chart); + $MASTERID = $this->quality_model->saveMasterTestData($masterreportdata); + + + foreach($testphpdata as $data) + { + + $descrition = $data['Description']; + $min = $data['SpecificationMin']; + $max = $data['SpecificationMax']; + $uom = $data['SpecificationUOM']; + $act1 = $data['ACT X1']; + $act2 = $data['ACT X2']; + $act3 = $data['ACT X3']; + $average = $data['Average']; + $results = $data['Results']; + $remarks1 = $data['Remarks']; + $testreportdata = array('testreport_id'=>$MASTERID,'description'=>$descrition,'min'=>$min,'max'=>$max,'UOM'=>$uom,'act1'=>$act1,'act2'=>$act2,'act3'=>$act3,'average'=>$average,'result'=>$results,'remarks'=>$remarks1); + $reportid = $this->quality_model->saveTestReportData($testreportdata); + } + + foreach($loiphpdata as $loi) + { + $start = $loi['Heating Timestart']; + $end = $loi['Heating Timeend']; + $temp = $loi['Temp *c']; + $w1 = $loi['Crucible Weight w1(g)']; + $w2 = $loi['Before Heatingw2(g)']; + $w3 = $loi['After Heatingw3(g)']; + $loip = $loi['L.O.I %']; + $remark = $loi['Remarks']; + $loitabledata = array('testreport_id'=>$MASTERID,'start_time'=>$start,'end_time'=>$end,'temp'=>$temp,'w1'=>$w1,'w2'=>$w2,'w3'=>$w3,'loi_percentage'=>$loip,'remarks'=>$remark); + $loiid = $this->quality_model->saveTestReportLOIData($loitabledata); + + } + + $count =0; + foreach($afsphpdata as $afs) + { + $count++; + if($count != 12){ + $ssize = $afs['Sieve Size µm']; + $mesh_size = $afs['Mesh Size']; + $sandweight = $afs['Sand Weight']; + $Percentage = $afs['Percentage']; + $Multiplier = $afs['Multiplier']; + $Product = $afs['Product']; + $afstabledata = array('testreport_id'=>$MASTERID,'sieve_size'=>$ssize,'mesh_size'=>$mesh_size,'sandweight'=>$sandweight,'percentage'=>$Percentage,'multiplier'=>$Multiplier,'product'=>$Product); + $afsid = $this->quality_model->saveTestReportAFSData($afstabledata); + } + } + + echo "Report Data Saved Successfully!"; + + + } + + + function addNewInward_Report() + { + $data['records'] = $this->quality_model->getIGRNOforReport(); + $data['emplist'] = $this->quality_model->getEmplistforReport(); + $this->global['pageTitle'] = 'Siddharth : Inward Inspection'; + $this->loadViews("inward_report_create", $this->global,$data,NULL); + + } + + + function getIGRLineItemNo() + { + $igrno = $this->input->post('param1'); + $data['igrdetails'] = $this->quality_model->getIGRLineItemNo($igrno); + echo json_encode($data['igrdetails']); + + } + + + function getIGRDetails() + { + $igrno = $this->input->post('param1'); + $igrlineitemno = $this->input->post('param2'); + $data['igrdetails'] = $this->quality_model->getIGRDataforReport($igrno,$igrlineitemno); + echo json_encode($data['igrdetails']); } /** diff --git a/application/controllers/report.php b/application/controllers/report.php index e01485c5..bdc03bfc 100755 --- a/application/controllers/report.php +++ b/application/controllers/report.php @@ -14,13 +14,13 @@ class report extends BaseController /** * This is default constructor of the class */ - public function __construct() - { + { parent::__construct(); $this->load->model('dahsboard_Model'); $this->isLoggedIn(); - } + } + public function pending_report() { @@ -36,8 +36,9 @@ class report extends BaseController $this->loadViews("access", $this->global, $data, NULL); } - } - public function releasedPO() + } + + public function releasedPO() { $this->global['pageTitle'] = 'Order Value - Released Reports - '; @@ -54,7 +55,8 @@ class report extends BaseController $this->loadViews("access", $this->global, $data, NULL); } - } + } + public function openorderPO() { @@ -73,7 +75,8 @@ class report extends BaseController $this->loadViews("access", $this->global, $data, NULL); } - } + } + public function TotalOrd() { @@ -95,7 +98,8 @@ class report extends BaseController $this->loadViews("access", $this->global, $data, NULL); } - } + } + public function ccr() { @@ -466,16 +470,20 @@ class report extends BaseController $cname = $this->input->post('client_name'); $prod = $this->input->post('item_name'); $ab=$this->input->post('financialyear'); + $cat = $this->input->get('cat'); $fa=substr($ab,0,-5); $aa=substr($ab,5,5); $m=$this->input->post('month'); $frm = $this->input->post('from_date'); $t = $this->input->post('to_date'); + $sid=$this->input->get('sid'); + $mid = $this->input->get('mid'); + $d = $this->input->get('d'); //print_r($prod); $data['material']=$this->dahsboard_Model->material_name(); $data['cust']=$this->dahsboard_Model->customer_name(); $data['finyear']=$this->dahsboard_Model->report_finyear(); - $data['purchase']=$this->dahsboard_Model->ireport_purchase($cname,$prod,$fa,$aa,$m,$frm,$t); + $data['purchase']=$this->dahsboard_Model->ireport_purchase($cname,$prod,$fa,$aa,$m,$frm,$t,$sid,$mid,$d); if($this->DEPCode == MANAGEMENT) { @@ -515,6 +523,7 @@ class report extends BaseController $this->global['pageTitle'] = 'Resico : Reports'; //$this->input->post('btn_submit'); $cname = $this->input->get('cname'); + $cat = $this->input->get('cat'); $prod = $this->input->get('prod'); $ab=$this->input->get('ab'); $fa=substr($ab,0,-5); @@ -530,7 +539,7 @@ class report extends BaseController $data['material']=$this->dahsboard_Model->material_name(); $data['cust']=$this->dahsboard_Model->customer_name(); $data['finyear']=$this->dahsboard_Model->report_finyear(); - $data['purchase']=$this->dahsboard_Model->ireport_purchase_link($cname,$prod,$fa,$aa,$m,$frm,$t,$sid,$mid,$d); + $data['purchase']=$this->dahsboard_Model->ireport_purchase_link($cname,$prod,$fa,$aa,$m,$frm,$t,$sid,$mid,$d,$cat); } if($this->DEPCode == MANAGEMENT) @@ -751,7 +760,147 @@ class report extends BaseController $this->loadViews("access", $this->global, $data, NULL); } + } + + public function rawi_cumulative() + { + + $this->global['pageTitle'] = 'Resico : Reports'; + + //print_r($prod); + + $data['cum']=$this->dahsboard_Model->rawi_report_cumulative(); + + if($this->DEPCode == MANAGEMENT) + { + $this->loadviews("Report_cumulative_raw",$this->global,$data, NULL); + } + + else + { + $this->loadViews("access", $this->global, $data, NULL); + } + + } + public function rawi_cum_year() + { + + $this->global['pageTitle'] = 'Resico : Reports'; + //$mat=$this->input->get('mid'); + $cat=$this->input->get('cat'); + //print_r($sup); + + $data['cum_year']=$this->dahsboard_Model->rawi_report_cum_year($cat); + $this->loadviews("Report_cumulative_year_raw",$this->global,$data, NULL); + + } + public function rawi_cum_month() + { + + $this->global['pageTitle'] = 'Resico : Reports'; + //$mat=$this->input->get('mid'); + $cat=$this->input->get('cat'); + + //print_r($prod); + + $data['cum_month']=$this->dahsboard_Model->rawi_report_cum_month($cat); + $this->loadviews("Report_cumulative_month_raw",$this->global,$data, NULL); + + } + public function rawi_cum_day() + { + + $this->global['pageTitle'] = 'Resico : Reports'; + //$mat=$this->input->get('mid'); + $cat=$this->input->get('cat'); + //print_r($prod); + + $data['cum_day']=$this->dahsboard_Model->rawi_report_cum_day($cat); + $this->loadviews("Report_cumulative_day_raw",$this->global,$data, NULL); + + } + public function rawi_consolidate() + { + + $this->global['pageTitle'] = 'Resico : Reports'; + //$this->input->post('btn_submit'); + $cname = $this->input->post('client_name'); + $ab=$this->input->post('financialyear'); + $fa=substr($ab,0,-5); + $aa=substr($ab,5,5); + //print_r($prod); + $data['material']=$this->dahsboard_Model->category(); + $data['cust']=$this->dahsboard_Model->customer_name(); + $data['finyear']=$this->dahsboard_Model->report_finyear(); + $data['spurchse']=$this->dahsboard_Model->rawi_report_consolidate($cname,$fa,$aa); + + if($this->DEPCode == MANAGEMENT) + { + $this->loadviews("Report_consolidate_raw",$this->global,$data, NULL); + } + else + { + $this->loadViews("access", $this->global, $data, NULL); + } + + } + public function rawi_consolidate_month() + { + + $this->global['pageTitle'] = 'Resico : Reports'; + //$this->input->post('btn_submit'); + $cat = $this->input->get('cat'); + $sup = $this->input->get('sup'); + //$mat = $this->input->get('mid'); + $m = $this->input->get('m'); + $ab=$this->input->get('ab'); + $fa=substr($ab,0,-5); + $aa=substr($ab,5,5); + //print_r($prod); + $data['material']=$this->dahsboard_Model->material_name(); + $data['cust']=$this->dahsboard_Model->customer_name(); + $data['finyear']=$this->dahsboard_Model->report_finyear(); + $data['spurchse']=$this->dahsboard_Model->rawi_consolidate_month($m,$cat,$sup,$fa,$aa); + // print_r( $data['spurchse']); + if($this->DEPCode == MANAGEMENT) + { + $this->loadviews("Report_consolidate_month",$this->global,$data, NULL); + } + else + { + $this->loadViews("access", $this->global, $data, NULL); + } + + } + public function rawi_consolidate_year() + { + + $this->global['pageTitle'] = 'Resico : Reports'; + //$this->input->post('btn_submit'); + $cat = $this->input->get('cat'); + $sup = $this->input->get('sup'); + //$mat = $this->input->get('mid'); + $ab=$this->input->get('ab'); + $fa=substr($ab,0,-5); + $aa=substr($ab,5,5); + //print_r($prod); + $data['material']=$this->dahsboard_Model->material_name(); + $data['cust']=$this->dahsboard_Model->customer_name(); + $data['finyear']=$this->dahsboard_Model->report_finyear(); + $data['spurchse']=$this->dahsboard_Model->rawi_consolidate_year($cat,$sup,$fa,$aa); + // print_r( $data['spurchse']); + if($this->DEPCode == MANAGEMENT) + { + $this->loadviews("Report_consolidate_year",$this->global,$data, NULL); + } + else + { + $this->loadViews("access", $this->global, $data, NULL); + } + + } + public function cashbook() { @@ -764,9 +913,9 @@ class report extends BaseController $data['getTotalrevenuePoCount'] = $this->dahsboard_Model->getTotalrevenuePoCount(); $data['cashbook']=$this->dahsboard_Model->cashbook(); - $income="INCOME"; - $expense="EXPENSE"; - $data['monthlywiseincome']=$this->dahsboard_Model->monthwise_data($income); + $income="RECEIPT"; + $expense="PAYMENT"; + $data['monthlywiseincome']=$this->dahsboard_Model->monthwise_data($income); $data['monthlywiseexpense']=$this->dahsboard_Model->monthwise_data($expense); $data['todayincome']=$this->dahsboard_Model->today_data($income); $data['todayexpense']=$this->dahsboard_Model->today_data($expense); @@ -905,6 +1054,24 @@ public function Viewtoday() } } + public function depmenu() + { + $this->global['pageTitle'] = 'Cashbook - viewtoday '; + $data['depmenu']=$this->dahsboard_Model->departmentmenu(); + $data['Indiancurrency']=$this->dahsboard_Model->INRSymbol(); + $this->loadviews("cashbookdepmenu",$this->global,$data, NULL); + } + public function cashbookmenudepartment() + { + $sid=$_GET['sid']; + + $this->global['pageTitle'] = 'Cashbook - department - '; + $data['menudepartmentwise']=$this->dahsboard_Model->menudepartmentwise($sid); + $data['Indiancurrency']=$this->dahsboard_Model->INRSymbol(); + //print_r($data['departmentwise']); + $this->loadviews("cashbookdepday",$this->global,$data, NULL); + } + } ?> diff --git a/application/controllers/reportlistcontroller.php b/application/controllers/reportlistcontroller.php index 172f4756..15029546 100644 --- a/application/controllers/reportlistcontroller.php +++ b/application/controllers/reportlistcontroller.php @@ -3,37 +3,34 @@ require APPPATH . '/libraries/BaseController.php'; /** - * Class : User (UserController) - * User Class to control all user related operations. - * @author : Kishor Mali + * Class : reportlistcontroller ( Report List Controller) + * reportlistcontroller Class to control all report related operations. + * @author : Venba Info Tech * @version : 1.1 - * @since : 15 November 2016 + * @since : 12 December 2017 */ class reportlistcontroller extends BaseController { /** - * This is default constructor of the class + * Default constructor of the class */ public function __construct() { parent::__construct(); $this->load->model('user_model'); - $this->load->library('form_validation'); - + $this->load->library('form_validation'); $this->isLoggedIn(); } /** - * This function used to load the first screen of the user + * Index Page for this controller(default function of the class) */ public function index() { $this->global['pageTitle'] = 'Reports list '; $this->loadViews("reportslink", $this->global , NULL); } - - - + } ?> diff --git a/application/controllers/requisitionform.php b/application/controllers/requisitionform.php index 6cfcdfd2..f246d5f2 100644 --- a/application/controllers/requisitionform.php +++ b/application/controllers/requisitionform.php @@ -23,63 +23,53 @@ class requisitionform extends BaseController $this->isLoggedIn(); } /** - * This function used to load the first screen of the Requistion + * To load the Requistion Listing screen */ function requisitionlisting() { $this->global['pageTitle'] = 'Resico : Requisition Listing'; $userID = $this->session->userdata ( 'userId' ); - - // $data['ReqList'] = $this->requistion_model->getRequistListUserID($userID); - $data['Status'] = $this->requistion_model->CheckDraftStatus($userID); - - $data['TotNoOfLine'] =$this->requistion_model->getRequistionList($userID); - - + $data['Status'] = $this->requistion_model->CheckDraftStatus($userID); + $data['TotNoOfLine'] =$this->requistion_model->getRequistionList($userID); $this->loadViews("requisitionlisting", $this->global, $data, NULL); - } + } + /** - * This function used to load the first screen of the requisition Form + * To load the requisition Form */ - function requisition() { $this->global['pageTitle'] = 'Resico : Raise Requisition'; $data['RequestType'] = $this->requistion_model->getConfigValue('C020'); - $data['EmpList'] = $this->requistion_model->getAllEmployees(); - $data['ServiceOption'] = $this->requistion_model->getConfigValue('C022'); + $data['ServiceOption'] = $this->requistion_model->getConfigValue('C022'); + $userID = $this->session->userdata ( 'userId' ); - $data['Emp'] = $this->requistion_model->getEmpIdByUserID($userID); - + $data['Emp'] = $this->requistion_model->getEmpIdByUserID($userID); $data['CostCenter'] = $this->requistion_model->getCostCenterUserID($userID); $this->loadViews("requisitionform", $this->global, $data,null); } - /** - * This function used to load the first screen of the Requistion List Approval Screen + /** + * To load the Requistion List Approval Screen */ function requisitionlistApproval() { - $this->global['pageTitle'] = 'Resico : Requisition Approval'; - - $data['Status']= $this->requistion_model->getStatus(); - - $userID = $this->session->userdata ( 'userId' ); - - $data['AppList'] = $this->requistion_model->getApproverRequistList($userID); + $this->global['pageTitle'] = 'Resico : Requisition Approval'; + $data['Status']= $this->requistion_model->getStatus(); + $userID = $this->session->userdata ( 'userId' ); + $data['AppList'] = $this->requistion_model->getApproverRequistList($userID); - - $this->loadViews("requisitionlistapproval", $this->global, $data, NULL); + $this->loadViews("requisitionlistapproval", $this->global, $data, NULL); } /** - * This function used to load the Edit Requistion Form + * To load the Edit Requistion Form */ function EditRequistionForm() { @@ -87,14 +77,17 @@ class requisitionform extends BaseController $ReqNo= $_GET['ReqNo']; $ReqType= $_GET['ReqType']; - - $userID = $this->session->userdata ( 'userId' ); - + $userID = $this->session->userdata ( 'userId' ); + $data['ReqDetails'] = $this->requistion_model->getRequistDetails($ReqNo,'Yes'); - $this->load->model('purchaseorder_model'); - $POType= $this->purchaseorder_model->GetPOType($ReqNo); - $ReqPOType = ''; - if(count($POType) > 0) + + $this->load->model('purchaseorder_model'); + + $POType= $this->purchaseorder_model->GetPOType($ReqNo); + + $ReqPOType = ''; + + if(count($POType) > 0) { for($i=0;$irequistion_model->getEditRequistItemList($ReqNo); $data['CostCenter'] = $this->requistion_model->getCostCenterUserID($userID); $data['MaterialCode'] = $this->requistion_model->EditMaterialCode($ReqNo, $ReqType); - $data['ServiceOption'] = $this->requistion_model->getConfigValue('C022'); - $this->loadViews("editrequisitionform", $this->global, $data, NULL); - } - /** - * This function used to load the Delete the Requistion Items + $data['ServiceOption'] = $this->requistion_model->getConfigValue('C022'); + $this->loadViews("editrequisitionform", $this->global, $data, NULL); + } + + /** + * To load the Delete the Requistion Items */ function DeleteRequistionForm() { $ReqList= $this->input->post('id'); - $ReqNo =''; - $MaterialCode = ''; + $ReqNo =''; + $MaterialCode = ''; + if(count($ReqList) > 0) { $ReqNo = $ReqList[0]; - $MaterialCode = $ReqList[1]; + $MaterialCode = $ReqList[1]; } $this->requistion_model->DeleteRequistionLineItem( $ReqNo,$MaterialCode); @@ -139,23 +132,26 @@ class requisitionform extends BaseController echo "Successfully Deleted the Line item".$ReqNo; } - /** - * This function used to load the Delete the Requistion Items + /** + * To load the Delete the Requistion Number */ function DeleteReqNo() { $ReqNo= $this->input->post('id'); - $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); - $updateddt = $dt->format('Y-m-d H:i:s'); + $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); + $updateddt = $dt->format('Y-m-d H:i:s'); $Request = array('Status'=>REQ_DELETED,'updatedOn'=>$updateddt); - + $this->requistion_model->UpdateRequistion( $Request,$ReqNo); echo "Successfully Deleted the ".$ReqNo; } + /** + * To load the Requistion List Approval Screen + */ function SearchRequistList() { $userID = $this->session->userdata ( 'userId' ); @@ -168,7 +164,7 @@ class requisitionform extends BaseController $Status= ''; if(count( $Dt)>1) { - $FDate = $Dt[0]."-".$Dt[1]."-".$Dt[2]; + $FDate = $Dt[0]."-".$Dt[1]."-".$Dt[2]; $TDate = $Dt[3]."-".$Dt[4]."-".$Dt[5]; $FromDate = $this->getDateformat($FDate); $ToDate = $this->getDateformat($TDate); @@ -196,15 +192,18 @@ class requisitionform extends BaseController } - - function getDateformat($Val) + /** + * To Convert the dateformat (date with time) and stored into DB + */ + function getDateformat($Val) { - $date = new DateTime($Val); - $retDate = $date->format('Y-m-d H:i:s'); - return $retDate; + $date = new DateTime($Val); + $retDate = $date->format('Y-m-d H:i:s'); + return $retDate; } - /** - * This function used to load the Employee details based on the EmpID selection + + /** + * To load the Employee details based on the EmpID selection */ function GetSelectedEmpDetails() { @@ -214,7 +213,8 @@ class requisitionform extends BaseController $DeptCode = $empDetails[0]['DEPCode']; $CostList = $this->requistion_model->GetCostCenterByDept( $DeptCode); $HTML = ""; - $BudAmount = ""; + $BudAmount = ""; + if(count($CostList) > 0) { for ($j = 0; $j < count($CostList); $j++) @@ -224,38 +224,39 @@ class requisitionform extends BaseController $HTML .=""; } } - if(count($CostList) == 1) + + if(count($CostList) == 1) { - $FYStart = ''; - $FYEnd = ''; - $FiscalYear = $this->costcenter_model->getFiscalYear(); - if(!empty($FiscalYear)) + $FYStart = ''; + $FYEnd = ''; + $FiscalYear = $this->costcenter_model->getFiscalYear(); + if(!empty($FiscalYear)) { - foreach ($FiscalYear as $Fy) - { - $FYStart =$Fy->StartYear; - $FYEnd =$Fy->EndYear; - } + foreach ($FiscalYear as $Fy) + { + $FYStart =$Fy->StartYear; + $FYEnd =$Fy->EndYear; + } + } - } - - $FYdt = $FYStart." - ".$FYEnd ; - $this->load->model('purchaseorder_model'); + $FYdt = $FYStart." - ".$FYEnd ; + $this->load->model('purchaseorder_model'); - $result = $this->purchaseorder_model->GetAvailableBudgetAmount($CostCode,$FYdt,$ReqType); - //print_r($result); - $AvilBudAmt = '0'; - if(count($result)>0) - { - $BudAmount = $result[0]['BudgetAmount'] - $result[0]['Totalvalue']; - } - - - } + $result = $this->purchaseorder_model->GetAvailableBudgetAmount($CostCode,$FYdt,$ReqType); + + $AvilBudAmt = '0'; + if(count($result)>0) + { + $BudAmount = $result[0]['BudgetAmount'] - $result[0]['Totalvalue']; + } + } die(json_encode(array('emp' => $empDetails,'Cost' => $HTML,'AvlAmount' => $BudAmount))); } + /** + * To get the costcenter's budget amount by using Request type and Financal year + */ function getAvailableBudAmount() { $ReqType = $_GET['ReqType']; @@ -264,26 +265,25 @@ class requisitionform extends BaseController $FYEnd = ''; $FiscalYear = $this->costcenter_model->getFiscalYear(); if(!empty($FiscalYear)) - { - foreach ($FiscalYear as $Fy) - { + { + foreach ($FiscalYear as $Fy) + { $FYStart =$Fy->StartYear; $FYEnd =$Fy->EndYear; - } + } + } - } - - $FYdt = $FYStart." - ".$FYEnd ; - $this->load->model('purchaseorder_model'); + $FYdt = $FYStart." - ".$FYEnd ; + $this->load->model('purchaseorder_model'); - $Cost = $this->purchaseorder_model->GetAvailableBudgetAmount($CostCode,$FYdt,$ReqType); + $Cost = $this->purchaseorder_model->GetAvailableBudgetAmount($CostCode,$FYdt,$ReqType); - - //$Cost = $this->requistion_model->GetAvailableBudgetAmount( $CostCode,$Year,$ReqType); - - die(json_encode(array('Cost' =>$Cost))); + die(json_encode(array('Cost' =>$Cost))); } - // To get the Material code based on the Request type + + /** + * To get the Material code based on the Request type + */ function getMaterialCode() { @@ -294,8 +294,8 @@ class requisitionform extends BaseController $UOM = ""; $HTML = ""; - if(count($MaterialCode) > 0) - { + if(count($MaterialCode) > 0) + { for ($j = 0; $j < count($MaterialCode); $j++) { $Code = $MaterialCode[$j]['MaterialCode']; @@ -303,14 +303,16 @@ class requisitionform extends BaseController $HTML .=""; } - $MaterialName = $MaterialCode[0]['MaterialName']; - $UOM = $MaterialCode[0]['UOM']; + $MaterialName = $MaterialCode[0]['MaterialName']; + $UOM = $MaterialCode[0]['UOM']; } - die(json_encode(array('Material' =>$HTML,'MaterialName'=>$MaterialName,'UOM'=>$UOM))); + die(json_encode(array('Material' =>$HTML,'MaterialName'=>$MaterialName,'UOM'=>$UOM))); } - // To get the Material value based on the MaterialCode + /** + * To get the Material value based on the MaterialCode + * */ function getMaterialDetails() { @@ -318,15 +320,12 @@ class requisitionform extends BaseController $MaterialDetails = $this->requistion_model->getRawMaterialList($Material); - die(json_encode(array('MatDetail' =>$MaterialDetails))); } - /* - To Insert the Requistion Details to Database - */ - /** - * This function is used to add new Cost to the system + + /** + * To add new Requistions to the system */ function addNewRequistion() { @@ -340,10 +339,10 @@ class requisitionform extends BaseController } else { - $Status= $_GET['ID']; - $RequestType = strtoupper(trim($this->input->post('RequestType'))); - $Requestedby = strtoupper(trim($this->input->post('EmpID'))); - $RequestedbyDept = $this->session->userdata ( 'DEPCode' ); + $Status= $_GET['ID']; + $RequestType = strtoupper(trim($this->input->post('RequestType'))); + $Requestedby = strtoupper(trim($this->input->post('EmpID'))); + $RequestedbyDept = $this->session->userdata ( 'DEPCode' ); $CostCenter = $this->input->post('CostCenter'); $CreateBy = $this->session->userdata ( 'userId' ); $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); @@ -354,44 +353,41 @@ class requisitionform extends BaseController $comma_separated = explode(':', $DeletedRow); $serviceSchedule = $this->input->post('serviceSchedule'); - $servicePeriod = $this->input->post('serviceSchedule'); - // $noOfService = $this->input->post('noOfService'); + $servicePeriod = $this->input->post('serviceSchedule'); + $noOfService = 1; - $IsExists = $this->requistion_model->RequistionIsExists($Requestedby); - // print_r($IsExists); + $IsExists = $this->requistion_model->RequistionIsExists($Requestedby); + - if(count( $IsExists) == 0) - { - //echo 'Not Exists'; - $Request = array('ReqType'=>$RequestType, 'Requestedby'=>$Requestedby,'ReqDate'=>$createddt,'CostCenterCode'=>$CostCenter,'Status'=>$Status,'CreatedDate'=>$createddt,'CreatedBy'=>$CreateBy,'Schedule_Type'=>$serviceSchedule,'NumberOfService'=>$noOfService,'Service_Period'=>$servicePeriod,'RequestedDept'=>$RequestedbyDept); - - //print_r($Request); - + if(count( $IsExists) == 0) + { + + $Request = array('ReqType'=>$RequestType, 'Requestedby'=>$Requestedby,'ReqDate'=>$createddt,'CostCenterCode'=>$CostCenter,'Status'=>$Status,'CreatedDate'=>$createddt,'CreatedBy'=>$CreateBy,'Schedule_Type'=>$serviceSchedule,'NumberOfService'=>$noOfService,'Service_Period'=>$servicePeriod,'RequestedDept'=>$RequestedbyDept); $Req = $this->requistion_model->addRequistion($Request); } else { - //echo 'Exists'; $Request = array('ReqType'=>$RequestType, 'Requestedby'=>$Requestedby,'ReqDate'=>$createddt,'Status'=>$Status,'CreatedDate'=>$createddt,'CreatedBy'=>$CreateBy,'CostCenterCode'=>$CostCenter,'Schedule_Type'=>$serviceSchedule,'NumberOfService'=>$noOfService,'Service_Period'=>$servicePeriod,'RequestedDept'=>$RequestedbyDept); $UpdateReq = $this->requistion_model->UpdateRequistion($Request,$IsExists[0]['ReqNo']); } $ReqNumber = ''; - if(count($Req)>0) - { + + if(count($Req)>0) + { $ReqNumber = $Req[0]['ReqNo']; - } - else - { + } + else + { $ReqNumber = $IsExists[0]['ReqNo']; - } + } - $SkipInsert = False; - for ($i = 1; $i <= $RowCount; $i++) - { - $SkipInsert = "False"; - if( count($comma_separated) > 0) - { + $SkipInsert = False; + for ($i = 1; $i <= $RowCount; $i++) + { + $SkipInsert = "False"; + if( count($comma_separated) > 0) + { for($j = 1; $j < count($comma_separated); $j++) { $deletedRow = $comma_separated[$j] ; @@ -403,30 +399,36 @@ class requisitionform extends BaseController } } - } + } - if($SkipInsert == "False") - { + if($SkipInsert == "False") + { $MaterialCode = $this->input->post('MaterialCode'.$i); $Quantity = $this->input->post('Quantity'.$i); $ReqDetails = array('ReqNo'=>$ReqNumber, 'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity); $this->requistion_model->addRequistionDetails($ReqDetails,$ReqNumber); - } + } - } - if($Status == REQ_DRAFT) - { + } + if($Status == REQ_DRAFT) + { echo 'Successfully Saved the Requistion details.Requistion No is '.$ReqNumber; - } - else - { + } + else + { echo 'Successfully Created the Requistion details.Requistion No is '.$ReqNumber; - } + } } - } + } + + + + /** + * To Store the Requistions edited values + */ function EditRequistion() { $Status = $this->input->post('txtStatus'); @@ -439,8 +441,8 @@ class requisitionform extends BaseController $DeletedRow = $this->input->post('txtDeletedRow'); $RowCount = $this->input->post('txtRowCount'); $serviceSchedule = $this->input->post('serviceSchedule'); - $servicePeriod = $this->input->post('serviceSchedule'); - // $noOfService = $this->input->post('noOfService'); + $servicePeriod = $this->input->post('serviceSchedule'); + $noOfService = 1; if(strlen($Status) > 1) { @@ -449,75 +451,69 @@ class requisitionform extends BaseController } else { - $Request = array( 'Status'=>REQ_PENDING_APPROVAL,'updatedOn'=>$updatedDate,'CostCenterCode'=>$CostCenter,'Schedule_Type'=>$serviceSchedule,'NumberOfService'=>$noOfService,'Service_Period'=>$servicePeriod); - $UpdateReq = $this->requistion_model->UpdateRequistion($Request, $ReqNumber); + $Request = array( 'Status'=>REQ_PENDING_APPROVAL,'updatedOn'=>$updatedDate,'CostCenterCode'=>$CostCenter,'Schedule_Type'=>$serviceSchedule,'NumberOfService'=>$noOfService,'Service_Period'=>$servicePeriod); + $UpdateReq = $this->requistion_model->UpdateRequistion($Request, $ReqNumber); } $comma_separated = explode(':', $DeletedRow); - /* Table value update and Insert in the table */ - //echo "RowCOunt:" .$RowCount; - $SkipInsert = False; - for ($i = 1; $i <= $RowCount; $i++) - { - $SkipInsert = "False"; - if( count($comma_separated) > 0) - { + /* Table value update and Insert in the table */ + + $SkipInsert = False; + for ($i = 1; $i <= $RowCount; $i++) + { + $SkipInsert = "False"; + 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") - { + if($SkipInsert == "False") + { $MaterialCode = $this->input->post('MaterialCode'.$i); $Quantity = $this->input->post('Quantity'.$i); $IsExists = $this->requistion_model->LineItemIsExists($ReqNumber,$MaterialCode); if(count( $IsExists) == 0) { - $ReqDetails = array('ReqNo'=>$ReqNumber, 'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'UpdatedBy'=>$UpdatedBy,'UpdatedOn'=>$updatedDate); - + $ReqDetails = array('ReqNo'=>$ReqNumber, 'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'UpdatedBy'=>$UpdatedBy,'UpdatedOn'=>$updatedDate); $this->requistion_model->addRequistionDetails($ReqDetails,$ReqNumber); } else { $ReqDetails = array('ReqNo'=>$ReqNumber, 'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'UpdatedBy'=>$UpdatedBy,'UpdatedOn'=>$updatedDate); - $this->requistion_model->UpdateRequistionLineItem($ReqDetails,$ReqNumber,$MaterialCode); } - - - } + + } - } - echo 'Successfully updated the Requistion details .Requistion No is '.$ReqNumber; - // $this->requisitionlisting(); - - - - - } -/* To Edit the request*/ - function ViewRequest() - { + } + echo 'Successfully updated the Requistion details .Requistion No is '.$ReqNumber; + + } + +/** + * To Edit the request + **/ +function ViewRequest() +{ - $ReqNo= $this->input->post('id'); + $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++) - { + $ReqList = $this->requistion_model->getRequistDetails($ReqNo); + $DepNo = $ReqList[0]['DEPCode']; + + $HTML=""; + for ($i = 0; $i < count($result); $i++) + { $SNo = $i + 1; $MaterialCode = $result[$i]['MaterialCode']; $MaterialName = $result[$i]['MaterialName']; @@ -538,41 +534,34 @@ class requisitionform extends BaseController ".$StatusName." "; - //$index = $index + 1; - } $CostCode = ''; $ReqType = ''; $FYStart = ''; - $FYEnd = ''; - $this->load->model('costcenter_model'); - $FiscalYear = $this->costcenter_model->getFiscalYear(); - if(!empty($FiscalYear)) + $FYEnd = ''; + $this->load->model('costcenter_model'); + $FiscalYear = $this->costcenter_model->getFiscalYear(); + if(!empty($FiscalYear)) { - foreach ($FiscalYear as $Fy) - { - $FYStart =$Fy->StartYear; - $FYEnd =$Fy->EndYear; - } - - } - + foreach ($FiscalYear as $Fy) + { + $FYStart =$Fy->StartYear; + $FYEnd =$Fy->EndYear; + } + } $FYdt = $FYStart." - ".$FYEnd ; $this->load->model('purchaseorder_model'); if(count($ReqList)>0) { - - $ReqType = $ReqList[0]['ReqType']; - + $ReqType = $ReqList[0]['ReqType']; $CostCode = $ReqList[0]['CostCenterCode']; } $POType= $this->purchaseorder_model->GetPOType($ReqNo); - $ReqPOType = ''; - if(count($POType) > 0) - { - + $ReqPOType = ''; + if(count($POType) > 0) + { for($i=0;$ipurchaseorder_model->GetAvailableCapitalBudgetAmount($CostCode,$FYdt,$ReqType); - - - // } - - if($ReqType== CAPITAL&&$RequestType!=IMPORT ) { $AvlBudget = $this->purchaseorder_model->GetAvailableCapitalBudgetAmount($CostCode,$FYdt,$RequestType); - - } - - - // else if($ReqType== CAPITAL&&$RequestType==IMPORT) - // { - - // $AvlBudget = $this->purchaseorder_model->GetAvailableImportBudgetAmount($CostCode,$FYdt,$RequestType); - // } - - - // else if($ReqType== IMPORT) - // { - // $AvlBudget = $this->purchaseorder_model->GetAvailableImportBudgetAmount($CostCode,$FYdt,$RequestType); - // } else - { $AvlBudget = $this->purchaseorder_model->GetAvailableBudgetAmount($CostCode,$FYdt,$ReqType); } - - // $AvlBudget = $this->purchaseorder_model->GetAvailableBudgetAmount($CostCode,$FYdt,$ReqType); - //print_r($result); $AvilBudAmt = '0'; if(count($AvlBudget)>0) { $AvilBudAmt = $AvlBudget[0]['BudgetAmount'] - $AvlBudget[0]['Totalvalue']; } - //echo $AvilBudAmt; + die(json_encode(array('Items' =>$HTML,'Requist'=>$ReqList,'AvilBudAmount'=>number_format($AvilBudAmt,2)))); } - + + /** + * For requistion approval status + */ function ApproveRequest() { $Status= Trim($_GET['Status']); @@ -648,18 +609,19 @@ class requisitionform extends BaseController $ReqNo= $_GET['ReqNo']; $Remarks = trim($this->input->post('id')); $ApprovedBy = $this->session->userdata ( 'userId' ); - $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); - $ApprovedDate = $dt->format('Y-m-d H:i:s'); + $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); + $ApprovedDate = $dt->format('Y-m-d H:i:s'); $Request = array('Status'=>$Status,'Comments'=>$Remarks,'ApprovedOn'=>$ApprovedDate,'Approvedby'=>$ApprovedBy); $this->requistion_model->UpdateRequistion($Request,$ReqNo); - echo "Successfully Updated the Requistion No: ".$ReqNo; - - } + echo "Successfully Updated the Requistion No: ".$ReqNo; + } + /** + * To load pagenotfound view + */ function pageNotFound() { $this->global['pageTitle'] = 'Resico : 404 - Page Not Found'; - $this->loadViews("404", $this->global, NULL, NULL); } } diff --git a/application/controllers/servicepurchaseorder.php b/application/controllers/servicepurchaseorder.php index 3e6f0cde..4a787351 100644 --- a/application/controllers/servicepurchaseorder.php +++ b/application/controllers/servicepurchaseorder.php @@ -6,7 +6,7 @@ require APPPATH . '/libraries/BaseController.php'; /** * Class : servicepurchaseorder (Service Purchase Order Details - Controller) - * User Class to control all user related operations. + * servicepurchaseorder Class to control all service po related operations. * @author : Venba Info Tech - * @version : 1.1 * @since : 15 November 2017 @@ -14,51 +14,56 @@ require APPPATH . '/libraries/BaseController.php'; class servicepurchaseorder extends BaseController { /** - * This is default constructor of the class + * default constructor of the class */ public function __construct() { parent::__construct(); $this->load->model('purchaseorder_model'); - $this->load->library('session'); - $this->load->library('form_validation'); + $this->load->library('session'); + $this->load->library('form_validation'); $this->load->model('requistion_model'); $this->isLoggedIn(); } - + + /** + * To load Service PO Billing + */ function viewServicePOReportForBilling() - { + { $this->global['pageTitle'] = 'Resico : Service Purchase Order for Billing'; $data["Billing"] = $this->purchaseorder_model->GetServicePOListforBilling(); - - //print_r($data["Billing"]); $this->loadViews("serviceporeport", $this->global,$data,null); - } - - function UpdateServicePOStatus() - { + } + + /** + * To Change Status of Service PO. + */ + function UpdateServicePOStatus() + { $this->global['pageTitle'] = 'Resico : Update Service PO Status'; - $data['PO'] = $this->purchaseorder_model->GetServicePOListforStatusUpdate(); - $data['WorkStatus']=$this->purchaseorder_model->getStatus(7); - + $data['PO'] = $this->purchaseorder_model->GetServicePOListforStatusUpdate(); + $data['WorkStatus']=$this->purchaseorder_model->getStatus(7); $this->loadViews("statusofservicepurchaseorder", $this->global,$data,Null); - } - + } + /** + * To Get Po details for Service PO Billing + */ function getPODetails() { $PONO = $this->input->post('id'); - $PO=$PONO; - $result = $this->purchaseorder_model->GetPODetailforBillingServicePO($PO); + $PO=$PONO; + $result = $this->purchaseorder_model->GetPODetailforBillingServicePO($PO); $HTML=""; - for ($i = 0; $i < count($result); $i++) - { + for ($i = 0; $i < count($result); $i++) + { $SNo = $i + 1; $ReqNo = $result[$i]['ReqNo']; $Reqedby = $result[$i]['FirstName']; @@ -93,28 +98,26 @@ class servicepurchaseorder extends BaseController echo $HTML; } + /** + * To Update Service PO Status + */ function UpdateServiceStatus() { $PONO = $this->input->post('PONO'); $WorkStatus = $this->input->post('WorkStatus'); - - + $Remarks = $this->input->post('Remarks'); + $updatedBy = $this->session->userdata ( 'userId' ); + $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); + $updateddt = $dt->format('Y-m-d H:i:s'); - $updatedBy = $this->session->userdata ( 'userId' ); - $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); - $updateddt = $dt->format('Y-m-d H:i:s'); - if($WorkStatus== SERVICE_COMPLETED ){ - $POStatus=PO_SERVICE_COMPLETED; - $POList = array('UpdateBY'=>$updatedBy,'UpdatedOn'=>$updateddt,'ServiceWorkStatusRemarks'=>$Remarks,'ServiceWorkStatus'=>$WorkStatus,'Status'=>$POStatus); - - - - - $PO=$PONO; -$result = $this->purchaseorder_model->GetPODetailforBillingServicePO($PO); - + if($WorkStatus== SERVICE_COMPLETED ){ + + $POStatus=PO_SERVICE_COMPLETED; + $POList = array('UpdateBY'=>$updatedBy,'UpdatedOn'=>$updateddt,'ServiceWorkStatusRemarks'=>$Remarks,'ServiceWorkStatus'=>$WorkStatus,'Status'=>$POStatus); + $PO=$PONO; + $result = $this->purchaseorder_model->GetPODetailforBillingServicePO($PO); for ($i = 0; $i < count($result); $i++) { @@ -124,80 +127,79 @@ $result = $this->purchaseorder_model->GetPODetailforBillingServicePO($PO); $ReqList = $this->purchaseorder_model->updateReqDetail($PONO,$POStatus,$MaterialCode); } - - - - // $ReqList = $this->purchaseorder_model->updateReqDetail($PONO,$POStatus); - $this->purchaseorder_model->UpdateReceivedQtyforServicePO($PONO,$updateddt,$updatedBy); - } - else{ - $POList = array('UpdateBY'=>$updatedBy,'UpdatedOn'=>$updateddt,'ServiceWorkStatusRemarks'=>$Remarks,'ServiceWorkStatus'=>$WorkStatus); - } - - - $POMaster = $this->purchaseorder_model->updatePOMaster($PONO,$POList); + $this->purchaseorder_model->UpdateReceivedQtyforServicePO($PONO,$updateddt,$updatedBy); + } + else{ + $POList = array('UpdateBY'=>$updatedBy,'UpdatedOn'=>$updateddt,'ServiceWorkStatusRemarks'=>$Remarks,'ServiceWorkStatus'=>$WorkStatus); + } + + $POMaster = $this->purchaseorder_model->updatePOMaster($PONO,$POList); $this->UpdateServicePOStatus(); - echo ""; + echo ""; } - // To get the available Budget Amount + + /** + * To get the available Budget Amount + **/ function AvilBudgetAmount() - { - // echo 'Controller called'; - $this->load->model('costcenter_model'); - $CostCode = $this->input->post('id'); - $ReqType = $_GET['ReqType']; - $FYStart = ''; - $FYEnd = ''; - $FiscalYear = $this->costcenter_model->getFiscalYear(); - if(!empty($FiscalYear)) - { + { + + $this->load->model('costcenter_model'); + $CostCode = $this->input->post('id'); + $ReqType = $_GET['ReqType']; + $FYStart = ''; + $FYEnd = ''; + $FiscalYear = $this->costcenter_model->getFiscalYear(); + if(!empty($FiscalYear)) + { foreach ($FiscalYear as $Fy) { $FYStart =$Fy->StartYear; $FYEnd =$Fy->EndYear; } - } + } - $FYdt = $FYStart." - ".$FYEnd ; - $this->load->model('purchaseorder_model'); - $result = array(); - - if($ReqType== CAPITAL) - { + $FYdt = $FYStart." - ".$FYEnd ; + $this->load->model('purchaseorder_model'); + $result = array(); + + if($ReqType== CAPITAL) + { $result = $this->purchaseorder_model->GetAvailableCapitalBudgetAmount($CostCode,$FYdt,$ReqType); - } - else if($ReqType== IMPORT) - { + } + else if($ReqType== IMPORT) + { $result = $this->purchaseorder_model->GetAvailableImportBudgetAmount($CostCode,$FYdt,$ReqType); - } - else - { + } + else + { $result = $this->purchaseorder_model->GetAvailableBudgetAmount($CostCode,$FYdt,$ReqType); - } - //print_r($result); - $AvilBudAmt = '0'; - if(count($result)>0) - { + } + + $AvilBudAmt = '0'; + if(count($result)>0) + { $AvilBudAmt = $result[0]['BudgetAmount'] - $result[0]['Totalvalue']; - } - - // echo 'Test'; - print_r($AvilBudAmt); - //die(json_encode(array('Cost' => $AvilBudAmt))); + } + print_r($AvilBudAmt); + } - - function getDateformat($Val) + /** + * To convert the dateformat (date with time) and store to DB + */ + function getDateformat($Val) { $date = new DateTime($Val,new DateTimeZone('Asia/Kolkata')); - // print_r($date); $retDate = $date->format('Y-m-d H:i:s'); return $retDate; } - //This used to Create Service Purchase Order + /** + * To Create Service Purchase Order + */ function addNewServicePurchaseOrder() { diff --git a/application/controllers/storerequisition.php b/application/controllers/storerequisition.php index b40563e5..6848b2a0 100644 --- a/application/controllers/storerequisition.php +++ b/application/controllers/storerequisition.php @@ -4,7 +4,7 @@ require APPPATH . '/libraries/BaseController.php'; /** * Class :storerequisition (Store Requisition Detail - Controller ) - * User Class to control all user related operations. + * storerequisition Class to control all store related operations. * @author : Venba Info Tech - * @version : 1.1 * @since : 18 November 2017 @@ -12,52 +12,69 @@ require APPPATH . '/libraries/BaseController.php'; class storerequisition extends BaseController { /** - * This is default constructor of the class + * default constructor of the class */ public function __construct() { parent::__construct(); - //$this->load->model('monthlypay_model'); $this->load->library('session'); $this->load->library('form_validation'); - // $this->load->library('pagination'); - $this->isLoggedIn(); } + /** - * This function used to load the first screen of the user + * Index Page for this controller (default function of the class) */ - public function index() + public function index() { //$this->global['pageTitle'] = 'Resico : storesrequisitionslip'; //$this->loadviews('storesrequisitionslip',$this->global); } + /** + * To load the Add store requisition screen + */ function addstorerequisitionslip() { $this->global['pageTitle'] = 'Resico : Add Store Requisition'; $this->loadviews('addstorerequisitionslip',$this->global); } + + /** + * To load the store requisition list screen + */ function storerequisitionlist() { $this->global['pageTitle'] = 'Resico : Store Requisition List'; $this->loadviews('storerequisitionlist',$this->global); } + + /** + * To load the store requisition listing + */ function storerequisitionlisting() { $this->global['pageTitle'] = 'Resico : Store Requisition Listing'; $this->loadviews('storerequisitionlisting',$this->global); } + + /** + * To load the approval store requisition screen + */ function approvalstorerequisition() { $this->global['pageTitle'] = 'Resico : Approval Store Requisition'; $this->loadviews('approvalstorerequisitionslip',$this->global); } + + /** + * To load pagenotfound screen + */ function pageNotFound() { $this->global['pageTitle'] = 'Resico : 404 - Page Not Found'; diff --git a/application/controllers/storerequisitionlist.php b/application/controllers/storerequisitionlist.php index 3a18cc1a..25a805ed 100644 --- a/application/controllers/storerequisitionlist.php +++ b/application/controllers/storerequisitionlist.php @@ -4,7 +4,7 @@ require APPPATH . '/libraries/BaseController.php'; /** * Class :storerequisitionlist (Store Stock list details - Controller) - * User Class to control all user related operations. + * storerequisitionlist Class to control all Store's-stock related operations. * @author : Venba Info Tech - * @version : 1.1 * @since : 18 November 2017 @@ -12,58 +12,58 @@ require APPPATH . '/libraries/BaseController.php'; class storerequisitionlist extends BaseController { /** - * This is default constructor of the class + * Default constructor of the class */ public function __construct() { parent::__construct(); $this->load->model('storerequistion_model'); - $this->load->library('session'); $this->load->library('form_validation'); - $this->isLoggedIn(); } -/*ADD Store requisition line item -*/ - function addstores() - - { - - $this->global['pageTitle'] = 'Resico : StoreRequisition Listing'; - $userId= $this->session->userdata ('userId'); - $data['DEPCode'] = $this->session->userdata('DEPCode'); + /** + * For Store requisition listing (NOTE : this listing descripted - what are the store requistion) + **/ + function addstores() + { + $this->global['pageTitle'] = 'Resico : Created Store Requisition Listing'; + + $userId= $this->session->userdata ('userId'); + + $data['DEPCode'] = $this->session->userdata('DEPCode'); $data['DepName'] = $this->session->userdata('DepartmentName'); - $data['cost'] = $this->storerequistion_model->getCostUser($userId); $data['MaterialList'] = $this->storerequistion_model->getRawMaterialList(); - $this->loadViews("addstorerequisitionslip", $this->global,$data,null); - } + } - - function addstore() + /** + * Store requisition listing is under Draft status (this hide the raise StoreRequisition button). + **/ + function addstore() { $this->global['pageTitle'] = 'Resico : StoreRequisition Listing'; - $userId= $this->session->userdata ('userId'); + + $userId= $this->session->userdata ('userId'); $data['Store'] = $this->storerequistion_model->Storeall($userId); $this->loadViews("storerequisition", $this->global,$data,null); } - /** - * This function used to load the Delete the StoreRequistion Items + /** + * Its handles Store Requistion Delete Operations ( in Store Requistion listing ) */ function DeleteReqNo() { $StoreReqNo= $this->input->post('id'); - $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); - $updateddt = $dt->format('Y-m-d H:i:s'); + $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); + $updateddt = $dt->format('Y-m-d H:i:s'); $Request = array('Status'=>REQ_DELETED,'updatedOn'=>$updateddt); $this->storerequistion_model->UpdateRequistion($StoreReqNo,$Request); @@ -72,33 +72,29 @@ class storerequisitionlist extends BaseController } -/* The Function Edit Store Requistion list */ + /** + * For editing purpose and it has oldest all store requistion. + */ function EditStoreRequistion() { $StoreReqNo = $_GET['StoreReqNo']; - //$StoreReqNo= $this->input->post('id'); - $this->global['pageTitle'] = 'Resico : StoreRequisition Listing'; + $this->global['pageTitle'] = 'Resico : Edit StoreRequisition'; $this->load->model('storerequistion_model'); - $data['cost'] = $this->storerequistion_model->editRequistDetails($StoreReqNo); - - $data['Status'] = $this->storerequistion_model->getStoreRequistionStatus($StoreReqNo); - - $data['MaterialList'] = $this->storerequistion_model->getRawMaterialList(); + $data['cost'] = $this->storerequistion_model->editRequistDetails($StoreReqNo); + $data['Status'] = $this->storerequistion_model->getStoreRequistionStatus($StoreReqNo); + $data['MaterialList'] = $this->storerequistion_model->getRawMaterialList(); $data['DepName'] = $this->session->userdata('DepartmentName'); $data['LineItem']=$this ->storerequistion_model->editstorerequistions($StoreReqNo); $this->loadViews("editstorerequisition", $this->global,$data,null); } - - - - - /**get the date formatted**/ - - function getDateformat($Val) + /** + * To convert the dateformat (date with time) and store to DB + */ + function getDateformat($Val) { $date = new DateTime($Val); $retDate = $date->format('Y-m-d H:i:s'); @@ -106,8 +102,9 @@ class storerequisitionlist extends BaseController } - /**This function is used to add new StoreRequestion to the system */ - + /** + * For new StoreRequestion values inserted into DB + */ function addNewRequistion() { @@ -119,115 +116,103 @@ class storerequisitionlist extends BaseController $createddt = $dt->format('Y-m-d H:i:s'); $DeletedRow = $this->input->post('txtDeletedRow'); $RowCount = $this->input->post('txtRowCount'); - // echo $RowCount; - // die(); $Status = $this->input->post('txtStatus'); $Requestedby = $this->session->userdata ( 'EmpID' ); $comma_separated = explode(':', $DeletedRow); - //echo 'done'; $StoreReqNo =''; - $StoreItemStatus =STORE_OPEN; - $Request = array( 'Requestedby'=>$Requestedby,'DepartmentCode'=>$DEPCode,'ReqDate'=>$createddt,'CostCenterCode'=>$CostCenter,'Status'=>$Status,'CreatedDate'=>$createddt,'CreatedBy'=>$CreateBy); - //print_r($Request); - $Req = $this->storerequistion_model->addRequistion($Request); + $StoreItemStatus =STORE_OPEN; + $Request = array( 'Requestedby'=>$Requestedby,'DepartmentCode'=>$DEPCode,'ReqDate'=>$createddt,'CostCenterCode'=>$CostCenter,'Status'=>$Status,'CreatedDate'=>$createddt,'CreatedBy'=>$CreateBy); + + $Req = $this->storerequistion_model->addRequistion($Request); - if(count($Req)>0) - { - $StoreReqNo = $Req[0]['StoreReqNo']; - //printf_r($ReqNumber); - } - //echo $StoreReqNo; - - - - $SkipInsert = False; + if(count($Req)>0) + { + $StoreReqNo = $Req[0]['StoreReqNo']; + } + + $SkipInsert = False; - for ($i = 1; $i <= $RowCount; $i++) - { - $SkipInsert = "False"; - if( count($comma_separated) > 0) - { - - for($j = 1; $j < count($comma_separated); $j++) - { - $deletedRow = $comma_separated[$j]; - - if($deletedRow == $i ) - { + for ($i = 1; $i <= $RowCount; $i++) + { + $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") - { + $SkipInsert = "True"; + break; + } + } + } + if($SkipInsert == "False") + { $MaterialCode = $this->input->post('MaterialCode'.$i); $QuantityRequired=$this->input->post('Quantity'.$i); $Remarks=$this->input->post('Remarks'.$i); $Request = array('MaterialCode'=>$MaterialCode,'Status'=>$StoreItemStatus ,'QuantityRequired'=>$QuantityRequired,'Remarks'=>$Remarks,'StoreReqNo'=>$StoreReqNo); - - $addReq=$this->storerequistion_model->addstoreRequistion($Request); - } - } + } + } - if($Status == STORE_DRAFT) - { - echo 'Successfully Saved the Store Requistion details'; - } - else - { - echo 'Successfully Created the Store Requistion details'; - } + if($Status == STORE_DRAFT) + { + echo 'Successfully Saved the Store Requistion details'; + } + else + { + echo 'Successfully Created the Store Requistion details'; + } } - - + /** + * For Store requisition listing (NOTE : this listing descripted - only approved store requistion) + */ function addstorerequisitionlist() { - $this->global['pageTitle'] = 'Resico : StoreRequisition Listing'; + $this->global['pageTitle'] = 'Resico : Store Requisition Listing'; $this->load->model('storerequistion_model'); $data['Status']= $this->storerequistion_model->getStatus(); $data['TotNoOfLine']=$this->storerequistion_model->getRequistionList(); - //print_r($data['TotNoOfLine']); - $this->loadViews("storerequisitionlisting", $this->global,$data,null); + + $this->loadViews("storerequisitionlisting", $this->global,$data,null); } - //To issue Store Requistion + /** + * To issue Store Requistion + **/ function issuestorerequisition() { $this->global['pageTitle'] = 'Resico : Issue StoreRequisition'; $this->load->model('storerequistion_model'); - $StoreReqNo= $_GET['ReqNo']; + $StoreReqNo= $_GET['ReqNo']; $data['ReqItem'] = $this->storerequistion_model->getRequistItemList($StoreReqNo); - $data['ReqListDetails'] = $this->storerequistion_model->getRequistDetails($StoreReqNo); - //print_r($data['ReqItem']); + $data['ReqListDetails'] = $this->storerequistion_model->getRequistDetails($StoreReqNo); $this->loadViews("issueStoreRequistion", $this->global,$data,null); - } - //update with existing one with new one + } + + /** + * To Update with existing one with new one (Issued Requistion) + * */ function UpdateIssueRequistion() { - - //echo 'ffd'; - // die(); $ReqNO = $this->input->post('txtReqNo'); $RowCount = $this->input->post('txtRowCount'); - //echo $RowCount; - //die(); - $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); + $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $createddt = $dt->format('Y-m-d H:i:s'); $UPdateby=$this->session->userdata('userId'); @@ -235,22 +220,15 @@ class storerequisitionlist extends BaseController $UPdateon = $date->format('Y-m-d H:i:s'); - //$ItemStatus = STORE_ISSUSED; - for ($i = 1; $i <= $RowCount; $i++) { $MaterialCode = $this->input->post('MaterialCode'.$i); -// echo $MaterialCode; + $IssuedQuantity = $this->input->post('txtIssuedQuantity'.$i); $Reqqty= $this->input->post('txtqty'.$i); - // echo $Reqqty; - // die(); $savedqty=$this->storerequistion_model->getSavedQty($ReqNO,$MaterialCode); - // if($reqstatus==) - // print_r($savedqty); - // die(); $Qtyissued=0; foreach($savedqty as $Qty) { @@ -258,8 +236,6 @@ class storerequisitionlist extends BaseController } $ActQty=$Qtyissued+$IssuedQuantity; - // echo $ActQty; - // die(); if($Reqqty>$ActQty) @@ -272,26 +248,14 @@ class storerequisitionlist extends BaseController $ItemStatus = STORE_ISSUSED; } - //echo $ItemStatus; - //die(); - // echo'Material issed'; if(strlen($IssuedQuantity)>0) { $Remarks = $this->input->post('txtRemarks'.$i); - - //echo $IssuedQuantity; - //die (); $CreatedBy = $this->session->userdata('userId'); - - - $storerequisition = array('StoreReqNo'=>$ReqNO,'MaterialCode'=>$MaterialCode,'QuantityIssued'=>$ActQty,'Status'=>$ItemStatus,'StoreComments'=>$Remarks,'UpdatedOn'=>$createddt,'UpdatedBy'=>$CreatedBy); - - - //print_r($storerequisition); - //die(); - + $storerequisition = array('StoreReqNo'=>$ReqNO,'MaterialCode'=>$MaterialCode,'QuantityIssued'=>$ActQty,'Status'=>$ItemStatus,'StoreComments'=>$Remarks,'UpdatedOn'=>$createddt,'UpdatedBy'=>$CreatedBy); + $this->storerequistion_model->UpdateStoreRequistionItem($storerequisition,$ReqNO,$MaterialCode); @@ -302,8 +266,6 @@ class storerequisitionlist extends BaseController $avlQty = $getAvailableqty[0]['Quantity']; } $BalanceQty=$avlQty-$IssuedQuantity; - // echo $BalanceQty; - // die(); $updatStock = array('Quantity'=>$BalanceQty,'Status'=>'0', 'Remarks'=>'Stock Deducted For'.$ReqNO,'UpdatedOn'=>$UPdateon,'UpdatedBy'=>$UPdateby); @@ -314,7 +276,6 @@ class storerequisitionlist extends BaseController $StoreReqNo=$ReqNO; $reqstatus=$this->storerequistion_model->getstatuscount('ST037',$ReqNO); $reqstatuscount=0; - //print_r($reqstatus); foreach ($reqstatus as $Req) { $reqstatuscount=$Req->SCount; @@ -332,7 +293,7 @@ class storerequisitionlist extends BaseController } - // echo $reqstatuscount; + $updatestatus=array('Status' =>$reqStatus); @@ -344,50 +305,50 @@ class storerequisitionlist extends BaseController } } - //die(); + echo ""; redirect('storerequisitionlisting','refresh'); } -/* this function use to search StoreRequistlist*///search bar - function SearchRequistLists() + + /** + * For Store Requisition listing (Note: this listing descripted - Approve the store requisition ) + **/ + function SearchRequistLists() { - $userID = $this->session->userdata ( 'userId' ); - - - $data['AppList'] = $this->storerequistion_model->getApproverRequistList($userID); - //print_r($data['AppList']); - $this->global['pageTitle'] = 'Resico : ApprovalStoreRequisitionSlip'; - $data['Status']= $this->storerequistion_model->getStatus(); + $userID = $this->session->userdata ( 'userId' ); + $data['AppList'] = $this->storerequistion_model->getApproverRequistList($userID); + $this->global['pageTitle'] = 'Resico : Approval Store Requisition Listing'; + $data['Status']= $this->storerequistion_model->getStatus(); - $this->loadViews("approvalstorerequisitionslip", $this->global, $data, NULL); + $this->loadViews("approvalstorerequisitionslip", $this->global, $data, NULL); } - /*Approve Completed*/ + /** + * To change the approval storerequisition status ( Approve Completed are not) + */ function ApproveRequest() { $Status= Trim($_GET['Status']); - //$StoreReqNo=$this->input->post('StoreReqNo'); $StoreReqNo = trim($this->input->post('id')); $Remarks=trim($this->input->post('newcomments')); $ApprovedBy = $this->session->userdata ( 'userId' ); - $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); - $ApprovedDate = $dt->format('Y-m-d H:i:s'); + $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); + $ApprovedDate = $dt->format('Y-m-d H:i:s'); $Request = array('Status'=>$Status,'Comments'=>$Remarks,'ApprovedOn'=>$ApprovedDate,'Approvedby'=>$ApprovedBy); + $this->storerequistion_model->UpdateRequistion($StoreReqNo,$Request); - echo "Successfully Updated the Requistion No: ".$StoreReqNo; + echo "Successfully Updated the Requistion No: ".$StoreReqNo; } - /** - * This function used to load the first screen of the Requistion List Approval Screen - */ + /*to load the first screen of the Requistion List Approval Screen*/ function requisitionlistApproval() { $this->global['pageTitle'] = 'Resico :Approvalstorerequisitionlist'; @@ -439,8 +400,11 @@ class storerequisitionlist extends BaseController die(json_encode(array('Items' =>$HTML,'Requist'=>$ReqList))); } - - function UpdateStoreRequistion() + + /** + * For stored new values after edited StoreRequistion information. + */ + function UpdateStoreRequistion() { $CostCenter = $this->input->post('CostCenter'); @@ -480,6 +444,7 @@ class storerequisitionlist extends BaseController if($deletedRow == $i ) { + $SkipInsert = "True"; break; } @@ -523,22 +488,20 @@ class storerequisitionlist extends BaseController } - /** - * This function used to load the Delete the Requistion Items + /** + * Its handles Store Requistion Line item Delete Operations ( add & edit Store Requistion screen) */ - function DeleteRequistionForm() - { - - + function DeleteRequistionForm() + { $ReqList= $this->input->post('id'); $StoreReqNo =''; $MaterialCode = ''; - if(count($ReqList) > 0) - { - $StoreReqNo = $ReqList[0]; - $MaterialCode = $ReqList[1]; - } - + if(count($ReqList) > 0) + { + $StoreReqNo = $ReqList[0]; + $MaterialCode = $ReqList[1]; + } + $this->storerequistion_model->DeleteRequistionLineItem( $StoreReqNo,$MaterialCode); echo "Successfully Deleted the Line item".$StoreReqNo; diff --git a/application/controllers/storestatus.php b/application/controllers/storestatus.php index 6ec06667..eab927e2 100644 --- a/application/controllers/storestatus.php +++ b/application/controllers/storestatus.php @@ -28,12 +28,11 @@ class storestatus extends BaseController public function index() { $this->global['pageTitle'] = 'Resico Industries : Store Status'; - - $this->loadViews("storestatus", $this->global, NULL , NULL); + $this->loadViews("storestatus", $this->global, NULL , NULL); } /** - * To load the Supplier list + * To descripted Store Stock Availability list */ function storeavailability() { @@ -48,8 +47,8 @@ class storestatus extends BaseController } /** - * To load the Supplier list - */ + * Its handles add stock details Operation. + */ function AddStock() { @@ -77,9 +76,9 @@ class storestatus extends BaseController } /** - * To load the Supplier list - */ - function UpdateStock() + * Its handles updated stock details Operations. + */ + function UpdateStock() { $MaterialCode = $this->input->post('EditMaterialCode'); @@ -106,11 +105,10 @@ class storestatus extends BaseController } /** - * To load the Supplier list + * Its handles view all stock details. */ function viewStockHistory() { - $MaterialCode= $this->input->post('id'); $result = $this->store_model->GetStockHisory($MaterialCode); diff --git a/application/controllers/user.php b/application/controllers/user.php index 637ca394..ca2bcacd 100644 --- a/application/controllers/user.php +++ b/application/controllers/user.php @@ -158,55 +158,202 @@ function attendancemonth() } - -function attendanceyear() -{ - $CURMONTH = date('m'); - $CURDATE = date('d'); - $EmpID= $this->input->post('id'); - $day = array(); - - $result = $this->dahsboard_Model->attendanceyear($EmpID); - $yearabs = $this->dahsboard_Model->getAllAttendance($EmpID,$CURMONTH); - $TotalNoofDays = $result[0]->TotalWorkingDays; - $DaysWorked = $result[0]->DaysWorked; - - - $values=0; - - $weekdays = array(); - $date = date('d'); - - $Work= array_sum($weekdays); - - for($j=1;$j<=$date;$j++) - { - $weekdays[] = 'WH'.$j; +public function getFinancialStartDate() { + $CURMONTH = date('n'); + $CURYEAR = date('Y'); + $FINYEAR = 0; + if($CURMONTH >= 4 ) { + $FINYEAR = $CURYEAR; + }else { + $FINYEAR = $CURYEAR-1; } - foreach ($yearabs as $day ) { - foreach ($day as $key => $value) { - foreach ($weekdays as $weeks) { + + $dateInString = $FINYEAR.'-4-1'; + $result = date_create($dateInString); + return $result; + } + + public function getFinancialEndDate() { + $CURMONTH = date('n'); + $CURYEAR = date('Y'); + $FINYEAR = 0; + if($CURMONTH < 4 ) { + $FINYEAR = $CURYEAR; + }else { + $FINYEAR = $CURYEAR+1; + } + + $dateInString = $FINYEAR.'-3-31'; + $result = date_create($dateInString); + return $result; + } + + function attendanceyear() + { + $CURMONTH = date('m'); + $CURDATE = date('d'); + + + $EmpID= $this->input->post('id'); + $day = array(); + + + $datejoin=$this->dahsboard_Model->joindate($EmpID); + + $DateofJoiningInString = $datejoin[0]->DateofJoining; + $DateofJoining = date_create($DateofJoiningInString); - if($weeks == $key) - { - if($value != 0){ - $values++; - } - } - } - } - } + + + $finStart = $this->getFinancialStartDate(); + $finEnd = $this->getFinancialEndDate(); + + + $JoinedMonth = date_format($DateofJoining,"n"); + + if($DateofJoining >= $finStart && $DateofJoining <= $finEnd) { + + $JoinedMonthAttendance = $this->dahsboard_Model->getAllAttendance($EmpID,$JoinedMonth); + + + $doj_month =date_format($DateofJoining,"n"); + $doj_year= date_format($DateofJoining,"Y"); + $doj_day= date_format($DateofJoining,"j"); + + $joinedMonthDaysCount = cal_days_in_month(CAL_GREGORIAN, $doj_month, $doj_year); + $joinedMonthWorkingDayCount = $joinedMonthDaysCount - $doj_day; + + + + $joinedMonthDays =0; + for($j=$doj_day;$j<=$joinedMonthDaysCount;$j++) + { + $weekdays[] = 'WH'.$j; + } + foreach ($JoinedMonthAttendance as $day ) { + //print_r($weekda); + foreach ($day as $key => $value) { + foreach ($weekdays as $weeks) { + + if($weeks == $key) + { + if($value!= 0){ + + $joinedMonthDays++; + } + } + + } + + + } + } + + + + + $result = $this->dahsboard_Model->attendanceyear($EmpID, $JoinedMonth + 1); + $yearabs = $this->dahsboard_Model->getAllAttendance($EmpID,$CURMONTH); + + //print_r($yearabs);exit(); + $TotalNoofDays = $result[0]->TotalWorkingDays; + $DaysWorked = $result[0]->DaysWorked; + + + $values=0; + + $weekdays = array(); + $date = date('d'); + + $Work= array_sum($weekdays); + + for($j=1;$j<=$date;$j++) + { + $weekdays[] = 'WH'.$j; + } + foreach ($yearabs as $day ) { + //print_r($weekda); + foreach ($day as $key => $value) { + foreach ($weekdays as $weeks) { + + if($weeks == $key) + { + if($value != 0){ + + $values++; + } + } + + } + + + } + } + + + $TotalNoofDays = $TotalNoofDays+$CURDATE + $joinedMonthWorkingDayCount ; + $DaysWorked = $DaysWorked+$values+$joinedMonthDays; + + $final_res = round(($DaysWorked /$TotalNoofDays) * 100); + $data['workeds']=$DaysWorked; + $data['yeardata'] = $final_res; + $data['totaldays'] = $TotalNoofDays; + + + echo json_encode($data); + + + }else { + $result = $this->dahsboard_Model->attendanceyear($EmpID, 4); + $yearabs = $this->dahsboard_Model->getAllAttendance($EmpID,$CURMONTH); + - $TotalNoofDays = $TotalNoofDays+$CURDATE; - $DaysWorked = $DaysWorked+$values; - - $final_res = round(($DaysWorked /$TotalNoofDays) * 100); - $data['workeds']=$DaysWorked; - $data['yeardata'] = $final_res; - $data['totaldays'] = $TotalNoofDays; + $TotalNoofDays = $result[0]->TotalWorkingDays; + $DaysWorked = $result[0]->DaysWorked; + + + $values=0; + + $weekdays = array(); + $date = date('d'); + + $Work= array_sum($weekdays); + + for($j=1;$j<=$date;$j++) + { + $weekdays[] = 'WH'.$j; + } + foreach ($yearabs as $day ) { + //print_r($weekda); + foreach ($day as $key => $value) { + foreach ($weekdays as $weeks) { + + if($weeks == $key) + { + if($value != 0){ + + $values++; + } + } + + } + + + } + } + + $TotalNoofDays = $TotalNoofDays+$CURDATE; + $DaysWorked = $DaysWorked+$values; + + $final_res = round(($DaysWorked /$TotalNoofDays) * 100); + $data['workeds']=$DaysWorked; + $data['yeardata'] = $final_res; + $data['totaldays'] = $TotalNoofDays; + + echo json_encode($data); + } + } - echo json_encode($data); -} /** * To load the user list diff --git a/application/models/dahsboard_model.php b/application/models/dahsboard_model.php index 47a5e87f..7bf0c338 100755 --- a/application/models/dahsboard_model.php +++ b/application/models/dahsboard_model.php @@ -1,121 +1,131 @@ -db->query($sql); - return $query->result(); - - } - - - function totloan() - { - - $sql="select sum(Loan_Amount)as totloan FROM T_Loan_Master"; - $query =$this->db->query($sql); - return $query->result(); - - } - - - function totpay() - { - - $sql="select sum(Paid_Amount)as totpay FROM T_Loan_Master"; - $query =$this->db->query($sql); - return $query->result(); - - } - - function totrec() - { - - $sql="select sum(Loan_Amount), sum(Paid_Amount),sum(Loan_Amount)-sum(Paid_Amount) as totrec FROM T_Loan_Master"; - $query =$this->db->query($sql); - return $query->result(); - - } - - function emplist() - { - - $sql="select EmpID,CONCAT(FirstName,' ',LastName) as name FROM T_Employee_Details where IsActive ='1'"; - $query =$this->db->query($sql); - return $query->result(); - - - - } - - - function attyesterday($WH,$date) - { - //echo $EmpID.'-'.$dates; - $sql="select ".$WH." from T_Attendance where Month_Year = ? and EmpID in (select EmpID from T_Attendance)"; - $query = $this->db->query($sql,array($date)); - //return - return $query->result_array(); - } - - - function attendance($EmpID,$dates) - { - //echo $EmpID.'-'.$dates; - $sql="select * from T_Attendance where EmpID =? and Month_Year=?"; - $query = $this->db->query($sql,array($EmpID,$dates)); - - return $query->result(); - - } - function getAllAttendance($EmpID,$CURMONTH) - { - $sql="select * from T_Attendance where EmpID =? and month(Month_Year)=?"; - $query = $this->db->query($sql,array($EmpID,$CURMONTH)); - - return $query->result(); - } - - function daysalary($EmpID,$dates) - { - //print_r($dates);die; - $sql= "select * FROM T_Emp_Pay_Data as pay - - join T_Attendance att on att.EmpID = pay.EmpID - where att.Month_Year = ? and att.EmpID = ?;"; - $query = $this->db->query($sql,array($dates,$EmpID)); - - return $query->result(); - - } - - - - function attendanceyear($EmpID) - { - - // $sql="select Att.EmpID,Att.Month_Year,Att.*,NoofDays,Days_Worked,emp.DateofJoining from T_Attendance Att - // join T_Employee_Details as emp on emp.EmpID = Att.EmpID - // where Att.Month_Year between ? and ? and Att.EmpID = ?"; - $sql = 'select sum(NoofDays) as TotalWorkingDays,sum(Days_worked) as DaysWorked from T_Attendance where - case - when (month(Month_Year) >=4) then - (YEAR(Month_Year) = YEAR(CURRENT_DATE) and MONTH(Month_Year) >= 4 ) or ( YEAR(Month_Year) = YEAR(CURRENT_DATE)+1 and MONTH(Month_Year) <= 3 ) - else - (YEAR(Month_Year) = YEAR(CURRENT_DATE)-1 and MONTH(Month_Year) >= 4 ) or ( YEAR(Month_Year) = YEAR(CURRENT_DATE) and MONTH(Month_Year) <= 3 ) - end and EmpID = ? and month(Month_Year) != month(current_date());'; - $query= $this->db->query($sql,array($EmpID)); - return $query->result(); - - - - } - + function totemp() + { + + $sql="select count(EmpID) as totemp FROM T_Employee_Details where IsActive ='1'"; + $query =$this->db->query($sql); + return $query->result(); + + } + + + function totloan() + { + + $sql="select sum(Loan_Amount)as totloan FROM T_Loan_Master"; + $query =$this->db->query($sql); + return $query->result(); + + } + + + function totpay() + { + + $sql="select sum(Paid_Amount)as totpay FROM T_Loan_Master"; + $query =$this->db->query($sql); + return $query->result(); + + } + + function totrec() + { + + $sql="select sum(Loan_Amount), sum(Paid_Amount),sum(Loan_Amount)-sum(Paid_Amount) as totrec FROM T_Loan_Master"; + $query =$this->db->query($sql); + return $query->result(); + + } + + function emplist() + { + +$sql="select EmpID,CONCAT(FirstName,' ',LastName) as name FROM T_Employee_Details where IsActive ='1'"; + $query =$this->db->query($sql); + return $query->result(); + + + + } + + + function attyesterday($WH,$date) + { + //echo $EmpID.'-'.$dates; + $sql="select ".$WH." from T_Attendance where Month_Year = ? and EmpID in (select EmpID from T_Attendance)"; + $query = $this->db->query($sql,array($date)); + //return + return $query->result_array(); +} + + +function attendance($EmpID,$dates) + { + //echo $EmpID.'-'.$dates; + $sql="select * from T_Attendance where EmpID =? and Month_Year=?"; + $query = $this->db->query($sql,array($EmpID,$dates)); + + return $query->result(); + +} +function getAllAttendance($EmpID,$CURMONTH) +{ + $sql="select * from T_Attendance where EmpID =? and month(Month_Year)=?"; + $query = $this->db->query($sql,array($EmpID,$CURMONTH)); + + return $query->result(); +} +function joindate($EmpID) +{ + $sql="select DateofJoining from T_Employee_Details where EmpID =? "; + $query = $this->db->query($sql,array($EmpID)); + + return $query->result(); +} + + + + +function daysalary($EmpID,$dates) +{ + //print_r($dates);die; + $sql= "select * FROM T_Emp_Pay_Data as pay + +join T_Attendance att on att.EmpID = pay.EmpID +where att.Month_Year = ? and att.EmpID = ?;"; + $query = $this->db->query($sql,array($dates,$EmpID)); + + return $query->result(); + +} + + + + function attendanceyear($EmpID , $MONTH) + { + + // $sql="select Att.EmpID,Att.Month_Year,Att.*,NoofDays,Days_Worked,emp.DateofJoining from T_Attendance Att + // join T_Employee_Details as emp on emp.EmpID = Att.EmpID + // where Att.Month_Year between ? and ? and Att.EmpID = ?"; + $sql = 'select sum(NoofDays) as TotalWorkingDays,sum(Days_worked) as DaysWorked from T_Attendance where + case + when (month(Month_Year) >=4) then + (YEAR(Month_Year) = YEAR(CURRENT_DATE) and MONTH(Month_Year) >= ? ) or ( YEAR(Month_Year) = YEAR(CURRENT_DATE)+1 and MONTH(Month_Year) <= 3 ) + else + (YEAR(Month_Year) = YEAR(CURRENT_DATE)-1 and MONTH(Month_Year) >= ? ) or ( YEAR(Month_Year) = YEAR(CURRENT_DATE) and MONTH(Month_Year) <= 3 ) + end and EmpID = ? and month(Month_Year) != month(current_date());'; + $query= $this->db->query($sql,array($MONTH, $MONTH, $EmpID)); + return $query->result(); + + + + } + function totalpurchaseorder(){ @@ -451,7 +461,7 @@ function reqdetail(){ function report_relpo(){ - $sql="select Mast.PONO,Mast.POType,date_format(Mast.CreatedDate,'%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 CreatedDate,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 @@ -472,7 +482,7 @@ group by Mast.PONO"; function report_openpending(){ - $sql="select Mast.PONO as PONO,Mast.POType as POType,date_format(Mast.CreatedDate,'%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 CreatedDate,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 @@ -493,7 +503,7 @@ group by PONO,POType,Dept_Name"; function report_total($fa,$aa){ - $sql="select Dept_Details.DepartmentName As Dept_Name, + $sql="select ifnull(Dept_Details.DepartmentName,'-') As Dept_Name, SUM(CASE WHEN Mast.Status = 'ST015' THEN 1 ELSE 0 END) AS PO_Created, SUM(CASE WHEN Mast.Status = 'ST025' THEN 1 ELSE 0 END) AS Approved, SUM(CASE WHEN Mast.Status = 'ST051' THEN 1 ELSE 0 END) AS Approver_Onhold, @@ -505,9 +515,8 @@ group by PONO,POType,Dept_Name"; SUM(CASE WHEN Mast.Status = 'ST045' THEN 1 ELSE 0 END) AS MRIR_Rejected, SUM(CASE WHEN Mast.Status = 'ST056' THEN 1 ELSE 0 END) AS Special_po from T_PO_Detail Mast -JOIN T_Requestion_Master as Req on Req.ReqNo=Mast.ReqNo -JOIN T_Employee_Details as Emp_Det on Emp_Det.EmpID=Req.RequestedBy -JOIN T_DepartmentDetails Dept_Details on Dept_Details.DEPCode=Emp_Det.Departmentcode +left JOIN T_Requestion_Master as Req on Req.ReqNo=Mast.ReqNo +left JOIN T_DepartmentDetails Dept_Details on Dept_Details.DEPCode=Req.RequestedDept where Mast.PODate >= '".$fa."-04-01' and Mast.PODate <= '".$aa."-03-31' group by Dept_Name"; $query = $this->db->query($sql); @@ -551,7 +560,7 @@ JOIN T_CostCenter_Master Cost_Mast on Cost_Center_Budget.CostCenterCode=Cost_Mas JOIN T_CostCenter_Departments CostCentDept on CostCentDept.CostCenterCode=Cost_Mast.CostCenterCode JOIN T_DepartmentDetails Dept_Details on Dept_Details.DEPCode= CostCentDept.DEPCode left JOIN T_Service_Tax st on st.LineItemNo = PO_Line_Item.LineItemNo -WHERE Cost_Center_Budget.BudgetType = po.POType and date(po.CreatedDate) >= '".$fa."-04-01' and date(po.CreatedDate) <= '".$aa."-03-31' +WHERE Cost_Center_Budget.BudgetType = po.POType and date(po.PODate) >= '".$fa."-04-01' and date(po.PODate) <= '".$aa."-03-31' group by Cost_Center_Budget.CostCenterCode,Cost_Center_Budget.BudgetYear,Cost_Center_Budget.BudgetType order by Cost_Center_Budget.CostCenterCode"; @@ -566,7 +575,7 @@ order by Cost_Center_Budget.CostCenterCode"; function report_MMSupplier(){ - $sql="select po.CreatedDate as Material_Date,po.SupplierID,sup.SupplierName,pl.MaterialCode,mm.MaterialName,mm.MaterialType,mm.UOM,mm.HSNCODE + $sql="select po.PODate as Material_Date,po.SupplierID,sup.SupplierName,pl.MaterialCode,mm.MaterialName,mm.MaterialType,mm.UOM,mm.HSNCODE from T_PurchaseOrder_Master po join T_PurchaseOrder_LineItem pl on pl.PONO=po.PONO join T_MaterialMaster mm on mm.MaterialCode=pl.MaterialCode @@ -609,8 +618,8 @@ order by monthname(matv.CreatedDate)"; function report_purchase($cname,$prod,$fa,$aa,$m,$frm,$t){ - $sql="SELECT pm.PONO as pono,date_format(pm.CreatedDate,'%d-%m-%Y') as created_date, -TIME_FORMAT(pm.CreatedDate,'%l:%i %p') as created_time, + $sql="SELECT pm.PONO as pono,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, round(ifnull(sum(pl.Quantity * pl.Rate),0),2) as value, @@ -638,7 +647,7 @@ left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo left join T_Revenue_Tax rt on rt.LineItemNo = pl.LineItemNo where -pm.Status != 'ST030' "; +pm.Status != 'ST030' and pm.Status != 'ST056' "; if ($cname!= ''){ @@ -650,12 +659,12 @@ 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')"; } if ($m!= ''){ - $sql.="and monthname(pm.CreatedDate) = '".$m."'"; + $sql.="and monthname(pm.PODate) = '".$m."'"; } @@ -663,8 +672,8 @@ if ($cname!= ''){ $fromd= date("Y-m-d",strtotime($frm)); $tod=date("Y-m-d",strtotime($t)); - $sql.="and date(pm.CreatedDate) >= '".$fromd."' - and date(pm.CreatedDate) <= '".$tod."'"; + $sql.="and date(pm.PODate) >= '".$fromd."' + and date(pm.PODate) <= '".$tod."'"; } if ($prod!= ''){ @@ -683,8 +692,8 @@ $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.CreatedDate,'%d-%m-%Y') as created_date, -TIME_FORMAT(pm.CreatedDate,'%l:%i %p') as created_time, + $sql="SELECT pm.PONO as pono,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, round(ifnull(sum(pl.Quantity * pl.Rate),0),2) as value, @@ -712,7 +721,7 @@ left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo left join T_Revenue_Tax rt on rt.LineItemNo = pl.LineItemNo where -pm.Status != 'ST030' "; +pm.Status != 'ST030' and pm.Status != 'ST056' "; if ($cname!= ''){ @@ -724,12 +733,12 @@ 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')"; } if ($m!= ''){ - $sql.="and monthname(pm.CreatedDate) = '".$m."'"; + $sql.="and monthname(pm.PODate) = '".$m."'"; } @@ -737,8 +746,8 @@ if ($cname!= ''){ $fromd= date("Y-m-d",strtotime($frm)); $tod=date("Y-m-d",strtotime($t)); - $sql.="and date(pm.CreatedDate) >= '".$fromd."' - and date(pm.CreatedDate) <= '".$tod."'"; + $sql.="and date(pm.PODate) >= '".$fromd."' + and date(pm.PODate) <= '".$tod."'"; } if ($prod!= ''){ @@ -758,7 +767,7 @@ if ($cname!= ''){ } if ($d!= ''){ - $sql.=" and date(pm.CreatedDate) = '".$d."' "; + $sql.=" and date(pm.PODate) = '".$d."' "; } @@ -773,9 +782,9 @@ $sql.="group by pono,material_name,supplier_name"; $sql="SELECT - CASE WHEN MONTH(CreatedDate)>=4 THEN - concat(YEAR(CreatedDate), '-',YEAR(CreatedDate)+1) - ELSE concat(YEAR(CreatedDate)-1,'-', YEAR(CreatedDate)) END AS financial_year + CASE WHEN MONTH(PODate)>=4 THEN + concat(YEAR(PODate), '-',YEAR(PODate)+1) + ELSE concat(YEAR(PODate)-1,'-', YEAR(PODate)) END AS financial_year FROM T_PurchaseOrder_Master GROUP BY financial_year"; $query = $this->db->query($sql); @@ -787,13 +796,13 @@ GROUP BY financial_year"; function report_year_wise(){ - $sql="SELECT sd.SupplierID as sid,mm.MaterialCode as mid,pm.CreatedDate as created_date,ifnull(sum(pl.Quantity),0) as quantity,round(ifnull(sum(pl.Quantity * pl.Rate),0),2) as total + $sql="SELECT sd.SupplierID as sid,mm.MaterialCode as mid,pm.POdate as created_date,ifnull(sum(pl.Quantity),0) as quantity,round(ifnull(sum(pl.Quantity * pl.Rate),0),2) as total FROM T_PurchaseOrder_Master pm 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 left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo -where pm.Status != 'ST030' +where pm.Status != 'ST030' and pm.Status != 'ST056' group by month(created_date)"; $query = $this->db->query($sql); return $query->result(); @@ -810,6 +819,11 @@ group by month(created_date)"; $sql="SELECT distinct MaterialName FROM T_MaterialMaster;"; $query = $this->db->query($sql); return $query->result(); + } + function category(){ + $sql="SELECT distinct Category FROM T_MaterialMaster;"; + $query = $this->db->query($sql); + return $query->result(); } function report_month_wise($mont){ $month= date("m",strtotime($mont)); @@ -821,7 +835,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 left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo -where pm.Status != 'ST030' and sd.SupplierName is not null and month(pm.CreatedDate)= ? and year(pm.CreatedDate) = ? +where pm.Status != 'ST030' and pm.Status != 'ST056' and sd.SupplierName is not null and month(pm.PODate)= ? and year(pm.PODate) = ? group by supplier_name,material_name"; $query = $this->db->query($sql,array($month,$year)); return $query->result(); @@ -834,7 +848,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 left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo -where pm.Status != 'ST030' and sd.SupplierName is not null and date(pm.CreatedDate) >= '$a-04-01' and date(pm.CreatedDate) <= '$b-03-31' +where pm.Status != 'ST030' and pm.Status != 'ST056' and sd.SupplierName is not null and date(pm.POdate) >= '$a-04-01' and date(pm.PODate) <= '$b-03-31' group by supplier_name,material_name"; $query = $this->db->query($sql,array()); return $query->result(); @@ -884,7 +898,7 @@ left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo left join T_Revenue_Tax rt on rt.LineItemNo = pl.LineItemNo where -pm.Status != 'ST030' "; +pm.Status != 'ST030' and pm.Status != 'ST056' "; if ($cname!= ''){ @@ -896,12 +910,12 @@ 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')"; } if ($m!= ''){ - $sql.="and monthname(pm.CreatedDate) = '".$m."'"; + $sql.="and monthname(pm.PODate) = '".$m."'"; } @@ -909,8 +923,8 @@ if ($cname!= ''){ $fromd= date("Y-m-d",strtotime($frm)); $tod=date("Y-m-d",strtotime($t)); - $sql.="and date(pm.CreatedDate) >= '".$fromd."' - and date(pm.CreatedDate) <= '".$tod."'"; + $sql.="and date(pm.PODate) >= '".$fromd."' + and date(pm.PODate) <= '".$tod."'"; } $sql.= "group by supplier_name"; @@ -923,37 +937,37 @@ if ($cname!= ''){ $sql="select sd.SupplierID as sid,mm.MaterialCode as mid,sd.SupplierName as supplier_name,mm.MaterialName as material_name, -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, +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 join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID -where pm.Status != 'ST030' "; +where pm.Status != 'ST030' and pm.Status != 'ST056' "; if ($cname!= ''){ @@ -965,7 +979,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')"; } @@ -983,12 +997,12 @@ FROM T_PurchaseOrder_Master pm 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 sd.SupplierName is not null and +where pm.Status != 'ST030' and pm.Status != 'ST056' and sd.SupplierName is not null 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 supplier_name,material_name ) as year left join @@ -997,8 +1011,8 @@ FROM T_PurchaseOrder_Master pm 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 sd.SupplierName is not null and -month(pm.CreatedDate) = month(current_date()) +where pm.Status != 'ST030' and pm.Status != 'ST056' and sd.SupplierName is not null and +month(pm.PODate) = month(current_date()) group by supplier_name,material_name ) as month on month.supplier_name=year.supplier_name and month.material_name=year.material_name left join @@ -1007,8 +1021,8 @@ FROM T_PurchaseOrder_Master pm 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 sd.SupplierName is not null and -date(pm.CreatedDate) = current_date() +where pm.Status != 'ST030' and pm.Status != 'ST056' and sd.SupplierName is not null and +date(pm.PODate) = current_date() group by supplier_name,material_name ) as today on today.supplier_name=month.supplier_name and today.material_name=month.material_name group by supplier_name,material_name @@ -1023,7 +1037,7 @@ FROM T_PurchaseOrder_Master pm 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 sd.SupplierName is not null and month(pm.CreatedDate) = month(current_date()) and sd.SupplierID = '".$sup."' and mm.MaterialCode = '".$mat."' +where pm.Status != 'ST030' and pm.Status != 'ST056' and sd.SupplierName is not null and month(pm.PODate) = month(current_date()) and sd.SupplierID = '".$sup."' and mm.MaterialCode = '".$mat."' group by supplier_name,material_name"; $query = $this->db->query($sql); return $query->result(); @@ -1035,12 +1049,12 @@ FROM T_PurchaseOrder_Master pm 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 sd.SupplierName is not null and +where pm.Status != 'ST030' and pm.Status != 'ST056' and sd.SupplierName is not null 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 sd.SupplierID = '".$sup."' and mm.MaterialCode = '".$mat."' group by supplier_name,material_name"; @@ -1054,18 +1068,18 @@ FROM T_PurchaseOrder_Master pm 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 sd.SupplierName is not null and -date(pm.CreatedDate) = current_date() and sd.SupplierID = '".$sup."' and mm.MaterialCode = '".$mat."' +where pm.Status != 'ST030' and pm.Status != 'ST056' and sd.SupplierName is not null and +date(pm.PODate) = current_date() and sd.SupplierID = '".$sup."' and mm.MaterialCode = '".$mat."' group by supplier_name,material_name"; $query = $this->db->query($sql); return $query->result(); } - function ireport_purchase($cname,$prod,$fa,$aa,$m,$frm,$t){ + function ireport_purchase($cname,$prod,$fa,$aa,$m,$frm,$t,$cat){ - $sql="SELECT pm.PONO as pono,date_format(pm.CreatedDate,'%d-%m-%Y') as created_date, -TIME_FORMAT(pm.CreatedDate,'%l:%i %p') as created_time, -mm.MaterialName as material_name,sd.SupplierName as supplier_name, + $sql="SELECT pm.PONO as pono,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, round(ifnull(sum(pl.Quantity * pl.Rate),0),2) as value, if(POType = 'IMPORT' or POType = 'CAPITAL',sum(pm.ExchangeRate),0) as exchange_rate, @@ -1091,8 +1105,7 @@ left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo left join T_Revenue_Tax rt on rt.LineItemNo = pl.LineItemNo -where -pm.Status != 'ST030' and pm.Status = 'ST056' "; +where pm.Status != 'ST030' and pm.Status = 'ST056' and pm.PONO in (select PONO from T_IGR_Master) "; if ($cname!= ''){ @@ -1104,12 +1117,12 @@ 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')"; } if ($m!= ''){ - $sql.="and monthname(pm.CreatedDate) = '".$m."'"; + $sql.="and monthname(pm.PODate) = '".$m."'"; } @@ -1117,8 +1130,8 @@ if ($cname!= ''){ $fromd= date("Y-m-d",strtotime($frm)); $tod=date("Y-m-d",strtotime($t)); - $sql.="and date(pm.CreatedDate) >= '".$fromd."' - and date(pm.CreatedDate) <= '".$tod."'"; + $sql.="and date(pm.PODate) >= '".$fromd."' + and date(pm.PODate) <= '".$tod."'"; } if ($prod!= ''){ @@ -1126,20 +1139,25 @@ if ($cname!= ''){ $sql.=" and mm.MaterialName = '".$prod."' "; } + if ($cat!= ''){ + + $sql.=" and mm.Category = '".$cat."' "; + + } -$sql.="group by pono,material_name,supplier_name"; +$sql.="group by pono,material_name,category,supplier_name"; //echo $sql; $query = $this->db->query($sql); return $query->result(); } - function ireport_purchase_link($cname,$prod,$fa,$aa,$m,$frm,$t,$sid,$mid,$d){ + function ireport_purchase_link($cname,$prod,$fa,$aa,$m,$frm,$t,$sid,$mid,$d,$cat){ - $sql="SELECT pm.PONO as pono,date_format(pm.CreatedDate,'%d-%m-%Y') as created_date, -TIME_FORMAT(pm.CreatedDate,'%l:%i %p') as created_time, -mm.MaterialName as material_name,sd.SupplierName as supplier_name, + $sql="SELECT pm.PONO as pono,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, round(ifnull(sum(pl.Quantity * pl.Rate),0),2) as value, if(POType = 'IMPORT' or POType = 'CAPITAL',sum(pm.ExchangeRate),0) as exchange_rate, @@ -1166,7 +1184,7 @@ left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo left join T_Revenue_Tax rt on rt.LineItemNo = pl.LineItemNo where -pm.Status != 'ST030' and pm.Status = 'ST056' "; +pm.Status != 'ST030' and pm.Status = 'ST056' and pm.PONO in (select PONO from T_IGR_Master) "; if ($cname!= ''){ @@ -1178,12 +1196,12 @@ 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')"; } if ($m!= ''){ - $sql.="and monthname(pm.CreatedDate) = '".$m."'"; + $sql.="and monthname(pm.PODate) = '".$m."'"; } @@ -1191,8 +1209,8 @@ if ($cname!= ''){ $fromd= date("Y-m-d",strtotime($frm)); $tod=date("Y-m-d",strtotime($t)); - $sql.="and date(pm.CreatedDate) >= '".$fromd."' - and date(pm.CreatedDate) <= '".$tod."'"; + $sql.="and date(pm.PODate) >= '".$fromd."' + and date(pm.PODate) <= '".$tod."'"; } if ($prod!= ''){ @@ -1212,14 +1230,19 @@ if ($cname!= ''){ } if ($d!= ''){ - $sql.=" and date(pm.CreatedDate) = '".$d."' "; + $sql.=" and date(pm.PODate) = '".$d."' "; + + } + if ($cat!= ''){ + + $sql.=" and mm.Category = '".$cat."' "; } -$sql.="group by pono,material_name,supplier_name"; -//echo $sql; +$sql.="group by pono,material_name,category,supplier_name"; +//ho $sql; $query = $this->db->query($sql); return $query->result(); } @@ -1227,13 +1250,13 @@ $sql.="group by pono,material_name,supplier_name"; function ireport_year_wise(){ - $sql="SELECT sd.SupplierID as sid,mm.MaterialCode as mid,pm.CreatedDate as created_date,ifnull(sum(pl.Quantity),0) as quantity,round(ifnull(sum(pl.Quantity * pl.Rate),0),2) as total + $sql="SELECT sd.SupplierID as sid,mm.MaterialCode as mid,pm.PODate as created_date,ifnull(sum(pl.Quantity),0) as quantity,round(ifnull(sum(pl.Quantity * pl.Rate),0),2) as total FROM T_PurchaseOrder_Master pm 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 left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo -where pm.Status != 'ST030' and pm.Status = 'ST056' +where pm.Status != 'ST030' and pm.Status = 'ST056' and pm.PONO in (select PONO from T_IGR_Master) group by month(created_date)"; $query = $this->db->query($sql); return $query->result(); @@ -1252,7 +1275,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 left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo -where pm.Status != 'ST030' and pm.Status = 'ST056' and sd.SupplierName is not null and month(pm.CreatedDate)= ? and year(pm.CreatedDate) = ? +where pm.Status != 'ST030' and pm.Status = 'ST056' and pm.PONO in (select PONO from T_IGR_Master) and sd.SupplierName is not null and pm.PONO in (select PONO from T_IGR_Master) and month(pm.PODate)= ? and year(pm.PODate) = ? group by supplier_name,material_name"; $query = $this->db->query($sql,array($month,$year)); return $query->result(); @@ -1265,7 +1288,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 left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo -where pm.Status != 'ST030' and pm.Status = 'ST056' and sd.SupplierName is not null and date(pm.CreatedDate) >= '$a-04-01' and date(pm.CreatedDate) <= '$b-03-31' +where pm.Status != 'ST030' and pm.Status = 'ST056' and pm.PONO in (select PONO from T_IGR_Master) and sd.SupplierName is not null and date(pm.PODate) >= '$a-04-01' and date(pm.PODate) <= '$b-03-31' group by supplier_name,material_name"; $query = $this->db->query($sql,array()); return $query->result(); @@ -1315,7 +1338,7 @@ left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo left join T_Revenue_Tax rt on rt.LineItemNo = pl.LineItemNo where -pm.Status != 'ST030' and pm.Status = 'ST056' "; +pm.Status != 'ST030' and pm.Status = 'ST056' and pm.PONO in (select PONO from T_IGR_Master) "; if ($cname!= ''){ @@ -1327,12 +1350,12 @@ 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')"; } if ($m!= ''){ - $sql.="and monthname(pm.CreatedDate) = '".$m."'"; + $sql.="and monthname(pm.PODate) = '".$m."'"; } @@ -1340,8 +1363,8 @@ if ($cname!= ''){ $fromd= date("Y-m-d",strtotime($frm)); $tod=date("Y-m-d",strtotime($t)); - $sql.="and date(pm.CreatedDate) >= '".$fromd."' - and date(pm.CreatedDate) <= '".$tod."'"; + $sql.="and date(pm.PODate) >= '".$fromd."' + and date(pm.PODate) <= '".$tod."'"; } $sql.= "group by supplier_name"; @@ -1354,6 +1377,234 @@ if ($cname!= ''){ $sql="select sd.SupplierID as sid,mm.MaterialCode as mid,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.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 +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) "; + +if ($cname!= ''){ + + $sql.="and sd.SupplierName = '".$cname."'"; + + } + + + + if ($fa and $aa != ''){ + + $sql.=" and (pm.PODate >= '".$fa."-04-01' and pm.PODate <= '".$aa."-03-31')"; + + } + + $sql.= "group by supplier_name,material_name"; + //echo $sql; + $query = $this->db->query($sql); + return $query->result(); + + } + function ireport_cumulative(){ + + $sql="SELECT year.sid as sid,year.mid as mid,year.supplier_name as supplier_name,year.material_name as material_name,year.quantity as quantity,year.total as total,month.mquantity as mquantity,month.mtotal as mtotal,today.tquantity as tquantity,today.ttotal as ttotal +FROM (SELECT sd.SupplierID as sid,mm.MaterialCode as mid,sd.SupplierName as supplier_name,ifnull(mm.MaterialName,'-') as material_name,ifnull(sum(pl.Quantity),0) as quantity,round(ifnull(sum(pl.Quantity * pl.Rate),0),2) as total +FROM T_PurchaseOrder_Master pm +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 +case + 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.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 supplier_name,material_name +) as year left join +(SELECT sd.SupplierID as sid,mm.MaterialCode as mid,sd.SupplierName as supplier_name,ifnull(mm.MaterialName,'-') as material_name,ifnull(sum(pl.Quantity),0) as mquantity,round(ifnull(sum(pl.Quantity * pl.Rate),0),2) as mtotal +FROM T_PurchaseOrder_Master pm +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.PODate) = month(current_date()) +group by supplier_name,material_name +) as month on month.supplier_name=year.supplier_name and month.material_name=year.material_name +left join +(SELECT sd.SupplierID as sid,mm.MaterialCode as mid,sd.SupplierName as supplier_name,ifnull(mm.MaterialName,'-') as material_name,IF(pl.Quantity IS NULL or pl.Quantity = '', 0, sum(pl.Quantity)) as tquantity,ifnull(sum(pl.Quantity * pl.Rate),0) as ttotal +FROM T_PurchaseOrder_Master pm +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.PODate) = current_date() +group by supplier_name,material_name +) as today on today.supplier_name=month.supplier_name and today.material_name=month.material_name +group by supplier_name,material_name +"; + $query = $this->db->query($sql); + return $query->result(); + } + function ireport_cum_month($sup=null,$mat=null){ + + $sql="SELECT sd.SupplierID as sid,mm.MaterialCode as mid,sd.SupplierName as supplier_name,ifnull(mm.MaterialName,'-') as material_name,IF(pl.Quantity IS NULL or pl.Quantity = '', 0, sum(pl.Quantity)) as tquantity,ifnull(sum(pl.Quantity * pl.Rate),0) as ttotal +FROM T_PurchaseOrder_Master pm +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.PODate) = month(current_date()) and sd.SupplierID = '".$sup."' and mm.MaterialCode = '".$mat."' +group by supplier_name,material_name"; + $query = $this->db->query($sql); + return $query->result(); + } + function ireport_cum_year($sup=null,$mat=null){ + + $sql="SELECT sd.SupplierID as sid,mm.MaterialCode as mid,sd.SupplierName as supplier_name,ifnull(mm.MaterialName,'-') as material_name,IF(pl.Quantity IS NULL or pl.Quantity = '', 0, sum(pl.Quantity)) as tquantity,ifnull(sum(pl.Quantity * pl.Rate),0) as ttotal +FROM T_PurchaseOrder_Master pm +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 +case + 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.PODate) = YEAR(CURRENT_DATE)-1 and MONTH(pm.PODate) >= 4 ) or ( YEAR(pm.PODate) = YEAR(CURRENT_DATE) and MONTH(pm.PODate) <= 3 ) + end + and sd.SupplierID = '".$sup."' and mm.MaterialCode = '".$mat."' +group by supplier_name,material_name"; + $query = $this->db->query($sql); + return $query->result(); + } + function ireport_cum_day($sup=null,$mat=null){ + + $sql="SELECT sd.SupplierID as sid,mm.MaterialCode as mid,sd.SupplierName as supplier_name,ifnull(mm.MaterialName,'-') as material_name,IF(pl.Quantity IS NULL or pl.Quantity = '', 0, sum(pl.Quantity)) as tquantity,ifnull(sum(pl.Quantity * pl.Rate),0) as ttotal +FROM T_PurchaseOrder_Master pm +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.PODate) = current_date() and sd.SupplierID = '".$sup."' and mm.MaterialCode = '".$mat."' +group by supplier_name,material_name"; + $query = $this->db->query($sql); + return $query->result(); + } + function rawi_report_cumulative(){ + + $sql="SELECT year.category as category,year.quantity as quantity,year.total as total,month.mquantity as mquantity,month.mtotal as mtotal,today.tquantity as tquantity,today.ttotal as ttotal +FROM (SELECT mm.Category as category,ifnull(sum(pl.Quantity),0) as quantity,round(ifnull(sum(pl.Quantity * pl.Rate),0),2) as total +FROM T_PurchaseOrder_Master pm +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 +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 ) + 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 ) + end +group by category +) as year left join +(SELECT mm.Category as category,ifnull(sum(pl.Quantity),0) as mquantity,round(ifnull(sum(pl.Quantity * pl.Rate),0),2) as mtotal +FROM T_PurchaseOrder_Master pm +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()) +group by category +) as month on month.category=year.category +left join +(SELECT mm.Category as category,IF(pl.Quantity IS NULL or pl.Quantity = '', 0, sum(pl.Quantity)) as tquantity,ifnull(sum(pl.Quantity * pl.Rate),0) as ttotal +FROM T_PurchaseOrder_Master pm +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() +group by category +) as today on today.category=month.category +group by category "; + $query = $this->db->query($sql); + return $query->result(); + } + function rawi_report_cum_year($cat=null){ + + $sql="SELECT mm.Category as category,sd.SupplierID as sid,mm.MaterialCode as mid,sd.SupplierName as supplier_name,ifnull(mm.MaterialName,'-') as material_name,IF(pl.Quantity IS NULL or pl.Quantity = '', 0, sum(pl.Quantity)) as tquantity,ifnull(sum(pl.Quantity * pl.Rate),0) as ttotal +FROM T_PurchaseOrder_Master pm +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 +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 ) + 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 ) + end + and mm.Category = '".$cat."' +group by supplier_name,material_name"; + $query = $this->db->query($sql); + //echo $sql; + return $query->result(); + } + function rawi_report_cum_month($cat=null){ + + $sql="SELECT mm.Category as category,sd.SupplierID as sid,mm.MaterialCode as mid,sd.SupplierName as supplier_name,ifnull(mm.MaterialName,'-') as material_name,IF(pl.Quantity IS NULL or pl.Quantity = '', 0, sum(pl.Quantity)) as tquantity,ifnull(sum(pl.Quantity * pl.Rate),0) as ttotal +FROM T_PurchaseOrder_Master pm +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."' +group by supplier_name,material_name"; + $query = $this->db->query($sql); + return $query->result(); + } + function rawi_report_cum_day($cat=null){ + + $sql="SELECT mm.Category as category,sd.SupplierID as sid,mm.MaterialCode as mid,sd.SupplierName as supplier_name,ifnull(mm.MaterialName,'-') as material_name,IF(pl.Quantity IS NULL or pl.Quantity = '', 0, sum(pl.Quantity)) as tquantity,ifnull(sum(pl.Quantity * pl.Rate),0) as ttotal +FROM T_PurchaseOrder_Master pm +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."' +group by supplier_name,material_name"; + $query = $this->db->query($sql); + echo $sql; + return $query->result(); + } + 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, @@ -1384,11 +1635,11 @@ FROM T_PurchaseOrder_Master pm 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' "; +where pm.Status != 'ST030' and pm.Status = 'ST056' and pm.PONO in (select PONO from T_IGR_Master) "; if ($cname!= ''){ - $sql.="and sd.SupplierName = '".$cname."'"; + $sql.="and mm.Category = '".$cname."'"; } @@ -1400,208 +1651,201 @@ if ($cname!= ''){ } - $sql.= "group by supplier_name,material_name"; + $sql.= "group by category"; //echo $sql; $query = $this->db->query($sql); return $query->result(); } - function ireport_cumulative(){ + function rawi_consolidate_month($m=null,$cat=null,$sup=null,$fa=null,$aa=null){ - $sql="SELECT year.sid as sid,year.mid as mid,year.supplier_name as supplier_name,year.material_name as material_name,year.quantity as quantity,year.total as total,month.mquantity as mquantity,month.mtotal as mtotal,today.tquantity as tquantity,today.ttotal as ttotal -FROM (SELECT sd.SupplierID as sid,mm.MaterialCode as mid,sd.SupplierName as supplier_name,ifnull(mm.MaterialName,'-') as material_name,ifnull(sum(pl.Quantity),0) as quantity,round(ifnull(sum(pl.Quantity * pl.Rate),0),2) as total + $sql="select mm.Category as category,sd.SupplierID as sid,sd.SupplierName as supplier_name,mm.MaterialCode as mid,mm.MaterialName as material_name, +sum(pl.Quantity) as quantity, +sum(pl.Quantity * pl.Rate) as total FROM T_PurchaseOrder_Master pm -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 sd.SupplierName is not null 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 ) - 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 ) - end -group by supplier_name,material_name -) as year left join -(SELECT sd.SupplierID as sid,mm.MaterialCode as mid,sd.SupplierName as supplier_name,ifnull(mm.MaterialName,'-') as material_name,ifnull(sum(pl.Quantity),0) as mquantity,round(ifnull(sum(pl.Quantity * pl.Rate),0),2) as mtotal +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."' "; +if ($fa and $aa != ''){ + + $sql.=" and (pm.CreatedDate >= '".$fa."-04-01' and pm.CreatedDate <= '".$aa."-03-31')"; + + } + $sql.= "group by category,supplier_name,material_name"; + $query = $this->db->query($sql); + //echo $sql; + return $query->result(); + } + function rawi_consolidate_year($cat=null,$sup=null,$fa=null,$aa=null){ + + $sql="select mm.Category as category,sd.SupplierID as sid,sd.SupplierName as supplier_name,mm.MaterialCode as mid,mm.MaterialName as material_name, +sum(pl.Quantity) as quantity, +sum(pl.Quantity * pl.Rate) as total FROM T_PurchaseOrder_Master pm -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 sd.SupplierName is not null and -month(pm.CreatedDate) = month(current_date()) -group by supplier_name,material_name -) as month on month.supplier_name=year.supplier_name and month.material_name=year.material_name -left join -(SELECT sd.SupplierID as sid,mm.MaterialCode as mid,sd.SupplierName as supplier_name,ifnull(mm.MaterialName,'-') as material_name,IF(pl.Quantity IS NULL or pl.Quantity = '', 0, sum(pl.Quantity)) as tquantity,ifnull(sum(pl.Quantity * pl.Rate),0) as ttotal -FROM T_PurchaseOrder_Master pm -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 sd.SupplierName is not null and -date(pm.CreatedDate) = current_date() -group by supplier_name,material_name -) as today on today.supplier_name=month.supplier_name and today.material_name=month.material_name -group by supplier_name,material_name -"; +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 +mm.Category = '".$cat."' "; +if ($fa and $aa != ''){ + + $sql.=" and (pm.CreatedDate >= '".$fa."-04-01' and pm.CreatedDate <= '".$aa."-03-31')"; + + } + $sql.= "group by category,supplier_name,material_name"; $query = $this->db->query($sql); + //echo $sql; return $query->result(); } - function ireport_cum_month($sup=null,$mat=null){ - - $sql="SELECT sd.SupplierID as sid,mm.MaterialCode as mid,sd.SupplierName as supplier_name,ifnull(mm.MaterialName,'-') as material_name,IF(pl.Quantity IS NULL or pl.Quantity = '', 0, sum(pl.Quantity)) as tquantity,ifnull(sum(pl.Quantity * pl.Rate),0) as ttotal -FROM T_PurchaseOrder_Master pm -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 sd.SupplierName is not null and month(pm.CreatedDate) = month(current_date()) and sd.SupplierID = '".$sup."' and mm.MaterialCode = '".$mat."' -group by supplier_name,material_name"; - $query = $this->db->query($sql); - return $query->result(); - } - function ireport_cum_year($sup=null,$mat=null){ - - $sql="SELECT sd.SupplierID as sid,mm.MaterialCode as mid,sd.SupplierName as supplier_name,ifnull(mm.MaterialName,'-') as material_name,IF(pl.Quantity IS NULL or pl.Quantity = '', 0, sum(pl.Quantity)) as tquantity,ifnull(sum(pl.Quantity * pl.Rate),0) as ttotal -FROM T_PurchaseOrder_Master pm -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 sd.SupplierName is not null 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 ) - 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 ) - end - and sd.SupplierID = '".$sup."' and mm.MaterialCode = '".$mat."' -group by supplier_name,material_name"; - $query = $this->db->query($sql); - return $query->result(); - } - function ireport_cum_day($sup=null,$mat=null){ - - $sql="SELECT sd.SupplierID as sid,mm.MaterialCode as mid,sd.SupplierName as supplier_name,ifnull(mm.MaterialName,'-') as material_name,IF(pl.Quantity IS NULL or pl.Quantity = '', 0, sum(pl.Quantity)) as tquantity,ifnull(sum(pl.Quantity * pl.Rate),0) as ttotal -FROM T_PurchaseOrder_Master pm -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 sd.SupplierName is not null and -date(pm.CreatedDate) = current_date() and sd.SupplierID = '".$sup."' and mm.MaterialCode = '".$mat."' -group by supplier_name,material_name"; - $query = $this->db->query($sql); - return $query->result(); - } - function cashbook() - { - $sql="SELECT date_format(tinc.date,'%d-%m-%Y')as date,tinc.type,tinc.total,tinc.towhom,tinc.description,tinc.account_code,ac.name FROM t_income_expense tinc join t_accountcode ac on ac.code=tinc.account_code where tinc.type='EXPENSE'"; - $query = $this->db->query($sql); - return $query->result(); - } - - function monthexpensereport() - { - $sql="SELECT date_format(tinc.date,'%d-%m-%Y')as date,tinc.type,sum(tinc.total)as total,tinc.towhom,tinc.description,tinc.account_code,monthname(tinc.date)as month,ac.name FROM t_income_expense as tinc join t_accountcode ac on ac.code=tinc.account_code where tinc.type='EXPENSE' and month(tinc.date)= month(current_date()) group by account_code order by total desc limit 10 "; - $query = $this->db->query($sql); - return $query->result(); - - } - - function yearexpensereport() - { - $sql="SELECT date_format(date,'%d-%m-%Y')as date,type,sum(total)as total,towhom,description,account_code,monthname(date)as month FROM t_income_expense where type='EXPENSE' and year(date)= year(current_date()) group by month order by total desc limit 10 "; - $query = $this->db->query($sql); - return $query->result(); - - } - function today_data($value='') - { - $sql="SELECT type,Sum(total) as todaydata FROM t_income_expense WHERE type = ? AND DATE(date) = CURRENT_DATE"; - $query = $this->db->query($sql,array($value)); - return $query->result(); - - } - - function monthwise_data($value='') - { - $sql="SELECT type,Sum(total) as monthlydata FROM t_income_expense WHERE type = ? AND MONTH(date) = MONTH(curdate())"; - $query = $this->db->query($sql,array($value)); - return $query->result(); - - } - function yearwise_data($value='') - { - - $sql="SELECT type,sum(total) as yearlydata from t_income_expense - where - type = ? and ((YEAR(date) = YEAR(CURRENT_DATE) and MONTH(date) >= 4) or (YEAR(date) = YEAR(CURRENT_DATE)+1 and MONTH(date) <= 3))"; + function cashbook() + { + $sql="SELECT date_format(tinc.date,'%d-%m-%Y')as date, + ifnull(case + when tinc.type = 'PAYMENT' + then tinc.total + end,'0') as expense, + ifnull(case + when tinc.type = 'RECEIPT' + then tinc.total + end, '0') as income, + ifnull(case + when tinc.type = 'PAYMENT' + then tinc.towhom + end,'-') as paymentname, + ifnull(case + when tinc.type = 'RECEIPT' + then tinc.towhom + end, '-') as receiptname, + tinc.total,tinc.towhom,tinc.description,tinc.type,tinc.account_code,ac.name FROM t_income_expense tinc join t_accountcode ac on ac.code=tinc.account_code "; + $query = $this->db->query($sql); + return $query->result(); + } + + function monthexpensereport() + { + $sql="SELECT date_format(tinc.date,'%d-%m-%Y')as date,tinc.type,sum(tinc.total)as total,tinc.towhom,tinc.description,tinc.account_code,monthname(tinc.date)as month,ac.name FROM t_income_expense as tinc join t_accountcode ac on ac.code=tinc.account_code where tinc.type='PAYMENT' and month(tinc.date)= month(current_date()) group by account_code order by total desc limit 10 "; + $query = $this->db->query($sql); + return $query->result(); + + } + + function yearexpensereport() + { + $sql="SELECT date_format(date,'%d-%m-%Y')as date,type,sum(total)as total,towhom,description,account_code,monthname(date)as month FROM t_income_expense where type='PAYMENT' and year(date)= year(current_date()) group by month order by total desc limit 10 "; + $query = $this->db->query($sql); + return $query->result(); + + } + function today_data($value='') + { + $sql="SELECT type,Sum(total) as todaydata FROM t_income_expense WHERE type = ? AND DATE(date) = CURRENT_DATE"; $query = $this->db->query($sql,array($value)); return $query->result(); - - } - function departmentwise($sid='',$d='') - { - $sql="SELECT date_format(tinc.date,'%d-%m-%Y')as date,tinc.type,tinc.total,tinc.towhom,.tinc.description, ac.name FROM - t_income_expense tinc join t_accountcode ac on ac.code=tinc.account_code - WHERE tinc.type='EXPENSE' and account_code = '$sid' and monthname(date)='$d'"; - $query = $this->db->query($sql); - //print_r($this->db->last_query()); - //echo $sql; - return $query->result(); - - } - function yearmonthwise($sid='') - { - $sql="SELECT date_format(tinc.date,'%d-%m-%Y')as date,tinc.type,sum(tinc.total)as total,monthname(tinc.date)as month,tinc.description,tinc.towhom,tinc.account_code,ac.name FROM t_income_expense tinc - join t_accountcode ac on ac.code=tinc.account_code - WHERE tinc.type='EXPENSE' and monthname(date) = ? group by account_code"; - $query = $this->db->query($sql,array($sid)); - //print_r($this->db->last_query()); - return $query->result(); - - } - //for dashboard graph in cashbook// - function gettoptotal(){ - $i=1; - - while($i<=12){ - $sql="SELECT sum(total) as tot FROM t_income_expense where month(date)= $i"; -// $sql="SELECT sum(total)as ttl,concat(sum(total),'-',account_code)as atotal FROM t_income_expense where month(date)= $i -// group by account_code order by ttl desc limit 4"; + + } + + function monthwise_data($value='') + { + $sql="SELECT type,Sum(total) as monthlydata FROM t_income_expense WHERE type = ? AND MONTH(date) = MONTH(curdate())"; + $query = $this->db->query($sql,array($value)); + return $query->result(); + + } + function yearwise_data($value='') + { - $query = $this->db->query($sql); - //print_r($this->db->last_query()); - //return $query->result(); - $array_result[]=$query->result(); - $i++; + $sql="SELECT type,sum(total) as yearlydata from t_income_expense + where + type = ? and ((YEAR(date) = YEAR(CURRENT_DATE) and MONTH(date) >= 4) or (YEAR(date) = YEAR(CURRENT_DATE)+1 and MONTH(date) <= 3))"; + $query = $this->db->query($sql,array($value)); + return $query->result(); + + } + function departmentwise($sid='',$d='') + { + $sql="SELECT date_format(tinc.date,'%d-%m-%Y')as date,tinc.type,tinc.total,tinc.towhom,.tinc.description, ac.name FROM + t_income_expense tinc join t_accountcode ac on ac.code=tinc.account_code + WHERE tinc.type='PAYMENT' and account_code = '$sid' and monthname(date)='$d'"; + $query = $this->db->query($sql); + //print_r($this->db->last_query()); + //echo $sql; + return $query->result(); + + } + function yearmonthwise($sid='') + { + $sql="SELECT date_format(tinc.date,'%d-%m-%Y')as date,tinc.type,sum(tinc.total)as total,monthname(tinc.date)as month,tinc.description,tinc.towhom,tinc.account_code,ac.name FROM t_income_expense tinc + join t_accountcode ac on ac.code=tinc.account_code + WHERE tinc.type='PAYMENT' and monthname(date) = ? group by account_code"; + $query = $this->db->query($sql,array($sid)); + //print_r($this->db->last_query()); + return $query->result(); + + } + //for dashboard graph in cashbook// + function gettoptotal(){ + $i=1; + + while($i<=12){ + $sql="SELECT sum(total) as tot FROM t_income_expense where month(date)= $i"; + // $sql="SELECT sum(total)as ttl,concat(sum(total),'-',account_code)as atotal FROM t_income_expense where month(date)= $i + // group by account_code order by ttl desc limit 4"; + + $query = $this->db->query($sql); + //print_r($this->db->last_query()); + //return $query->result(); + $array_result[]=$query->result(); + $i++; - } - - return $array_result; - + } + + return $array_result; + } function INRSymbol() - { - $sql='select FontCode2000 from T_Currency_Details where Currency_Code="INR"'; - $query=$this->db->query($sql); - return $query->result(); - } - function today() - { - $sql="SELECT date_format(tinc.date,'%d-%m-%Y')as date,tinc.type,tinc.total,tinc.towhom,tinc.description,tinc.account_code,tac.name FROM t_income_expense tinc - LEFT JOIN t_accountcode tac ON tac.code = tinc.account_code - WHERE DATE(date) = CURRENT_DATE"; - $query = $this->db->query($sql); - return $query->result(); - } - //for menu link in monthly payments// - function monthlypayments() - { - $sql="SELECT date_format(tinc.date,'%d-%m-%Y')as date,tinc.type,tinc.total,tinc.towhom,.tinc.description, ac.name FROM t_income_expense tinc join t_accountcode ac on ac.code=tinc.account_code WHERE MONTH(date) = MONTH(curdate()) group by account_code"; + { + $sql='select FontCode2000 from T_Currency_Details where Currency_Code="INR"'; + $query=$this->db->query($sql); + return $query->result(); + } + function today() + { + $sql="SELECT date_format(tinc.date,'%d-%m-%Y')as date,tinc.type,tinc.total,tinc.towhom,tinc.description,tinc.account_code,tac.name FROM t_income_expense tinc + LEFT JOIN t_accountcode tac ON tac.code = tinc.account_code + WHERE DATE(date) = CURRENT_DATE"; $query = $this->db->query($sql); - //print_r($this->db->last_query()); - return $query->result(); - - } - + return $query->result(); + } + //for menu link in monthly payments// + function monthlypayments() + { + $sql="SELECT date_format(tinc.date,'%d-%m-%Y')as date,tinc.type,tinc.total,tinc.towhom,.tinc.description, ac.name FROM t_income_expense tinc join t_accountcode ac on ac.code=tinc.account_code WHERE MONTH(date) = MONTH(curdate()) group by account_code"; + $query = $this->db->query($sql); + //print_r($this->db->last_query()); + return $query->result(); + + } + function departmentmenu() + { + $sql="SELECT tinc.type,sum(tinc.total)as total,tinc.account_code,ac.name FROM t_income_expense tinc + join t_accountcode ac on ac.code=tinc.account_code + group by account_code"; + $query = $this->db->query($sql); + //print_r($this->db->last_query()); + return $query->result(); + + } + function menudepartmentwise($sid='') + { + $sql="SELECT date_format(tinc.date,'%d-%m-%Y')as date,tinc.type,tinc.total,tinc.towhom,.tinc.description, ac.name FROM t_income_expense tinc join t_accountcode ac on ac.code=tinc.account_code + WHERE account_code = '$sid'"; + $query = $this->db->query($sql); + //print_r($this->db->last_query()); + //echo $sql; + return $query->result(); + + } } ?> \ No newline at end of file diff --git a/application/models/monthlypay_model.php b/application/models/monthlypay_model.php index c1ddac4c..69ad0f1f 100755 --- a/application/models/monthlypay_model.php +++ b/application/models/monthlypay_model.php @@ -255,6 +255,52 @@ function addNewmonthlisting($m_list) return TRUE; } + + /*permission form model */ + function emplist() + { + + $sql="select Emp.EmpID,CONCAT(FirstName,' ',LastName)as name ,Emp.Departmentcode, Dep.DepartmentName FROM T_Employee_Details as Emp +join T_DepartmentDetails as Dep on Dep.DEPCode=Emp.Departmentcode where Emp.IsActive = 1;"; + $query =$this->db->query($sql); + return $query->result(); + + + + } + + function addper($Permissiondata) + { + + //print_r($Permissiondata);die; + $this->db->insert('T_Permission',$Permissiondata); + $reuslt = $this->db->insert_id(); + return $reuslt; + } + + function perlist() + { + + $this->db->select('*'); + $this->db->from('T_Permission'); + $query =$this->db->get(); + return $query->result(); + + } + + function pdf($SNO) + { + $this->db->select('per.*,emp.FirstName,LastName,dep.DepartmentName'); + $this->db->from('T_Permission per'); + $this->db->join('T_Employee_Details emp','emp.EmpID = per.EmpID'); + $this->db->join('T_DepartmentDetails dep','dep.DEPCode = emp.Departmentcode'); + $this->db->where('per.SNO',$SNO ); + $query =$this->db->get(); + return $query->result(); + } + + + } ?> diff --git a/application/models/quality_model.php b/application/models/quality_model.php index 7482470f..f776ec62 100644 --- a/application/models/quality_model.php +++ b/application/models/quality_model.php @@ -18,6 +18,15 @@ class Quality_model extends CI_Model return $result->result(); } + function getAllprodcutsInward() + { + $this->db->select('MaterialCode,MaterialName'); + $this->db->from('T_MaterialMaster'); + $this->db->like('T_MaterialMaster.Category','raw material'); + $result = $this->db->get(); + return $result->result(); + } + function getAllcustomers() { $this->db->select('client_id,client_name'); @@ -26,6 +35,15 @@ class Quality_model extends CI_Model return $result->result(); } + function getAllcustomersInward() + { + $this->db->select('SupplierID,SupplierName'); + $this->db->from('T_SupplierDetailsN'); + $this->db->where('IsActive',1); + $result = $this->db->get(); + return $result->result(); + } + function checkExist($product,$customer,$name) { $this->db->select('count(*) as count'); @@ -69,6 +87,16 @@ class Quality_model extends CI_Model $result = $this->db->get(); return $result->result(); } + function getAllspecInward() + { + $this->db->select('T_Prodcut_Specification_Master.*,T_MaterialMaster.MaterialCode,T_MaterialMaster.MaterialName,T_SupplierDetailsN.SupplierID,T_SupplierDetailsN.SupplierName,count(*) as count'); + $this->db->from('T_Prodcut_Specification_Master'); + $this->db->join('T_MaterialMaster','T_Prodcut_Specification_Master.product_id=T_MaterialMaster.MaterialCode'); + $this->db->join('T_SupplierDetailsN','T_Prodcut_Specification_Master.customer_id=T_SupplierDetailsN.SupplierID'); + $this->db->group_by('product_id,customer_id'); + $result = $this->db->get(); + return $result->result(); + } function getIndividualSpec($prodcutid,$customerid) @@ -80,6 +108,20 @@ class Quality_model extends CI_Model $this->db->where('T_Prodcut_Specification_Master.product_id',$prodcutid); $this->db->where('T_Prodcut_Specification_Master.customer_id',$customerid); $result = $this->db->get(); + //print_r($result->result()); + if(empty($result->result())) + { + + $this->db->select('T_Prodcut_Specification_Master.*,T_MaterialMaster.MaterialCode,T_MaterialMaster.MaterialName as product_name,T_SupplierDetailsN.SupplierID,T_SupplierDetailsN.SupplierName as client_name'); + $this->db->from('T_Prodcut_Specification_Master'); + $this->db->join('T_MaterialMaster','T_Prodcut_Specification_Master.product_id=T_MaterialMaster.MaterialCode'); + $this->db->join('T_SupplierDetailsN','T_Prodcut_Specification_Master.customer_id=T_SupplierDetailsN.SupplierID'); + $this->db->where('T_Prodcut_Specification_Master.product_id',$prodcutid); + $this->db->where('T_Prodcut_Specification_Master.customer_id',$customerid); + $result = $this->db->get(); + + } + //exit(); return $result->result(); } @@ -111,10 +153,16 @@ class Quality_model extends CI_Model function getSpecifications($productid,$customerid) { - $this->db->where('product_id',$productid); - $this->db->where('customer_id',$customerid); - $res = $this->db->get('T_Prodcut_Specification_Master'); + //echo 'from model'.$productid.'-'.$customerid; + // $this->db->where('product_id',$productid); + // $this->db->where('customer_id',$customerid); + // $res = $this->db->get('T_Prodcut_Specification_Master'); + $sql = "Select * from T_Prodcut_Specification_Master where product_id = ? and customer_id = ?"; + $res = $this->db->query($sql,array($productid,$customerid)); + // print_r($this->db->last_query()); return $res->result(); + //print_r($res->result()); + } function getEmplistforReport() @@ -210,6 +258,52 @@ class Quality_model extends CI_Model } + function getIndividualInwardReportData($reportid) + { + + $this->db->select('T_Test_Report_Master.chartdata,T_Test_Report_Master.batchdate,T_Test_Report_Master.testreport_id,T_IGR_Master.IGRNO,T_IGR_Master.DeliveryChellanOrInvoiceNo,T_IGR_Master.DeliveryChellanDate,T_IGR_Details.IGRItemNo,T_IGR_Details.QuantityAsPerInvoice,T_MaterialMaster.MaterialCode,T_MaterialMaster.Materialname,T_SupplierDetailsN.SupplierID,T_SupplierDetailsN.SupplierName,T_Test_Report_Master.approvedby,T_Employee_Details.EmpID,T_Employee_Details.FirstName,T_Employee_Details.LastName'); + $this->db->from('T_Test_Report_Master'); + $this->db->join('T_IGR_Master','T_Test_Report_Master.igrno=T_IGR_Master.IGRNO'); + $this->db->join('T_IGR_Details','T_Test_Report_Master.igrlineitemno=T_IGR_Details.IGRItemNo'); + $this->db->join('T_PurchaseOrder_Master','T_IGR_Master.PONO=T_PurchaseOrder_Master.PONO'); + $this->db->join('T_MaterialMaster','T_IGR_Details.MaterialCode=T_MaterialMaster.MaterialCode'); + $this->db->join('T_SupplierDetailsN','T_PurchaseOrder_Master.SupplierID=T_SupplierDetailsN.SupplierID'); + $this->db->join('tbl_users','T_Test_Report_Master.createdby=tbl_users.userid'); + $this->db->join('T_Employee_Details','tbl_users.EmpID=T_Employee_Details.EmpID'); + $this->db->where('T_Test_Report_Master.testreport_id',$reportid); + + + $res = $this->db->get(); + $reportdata['master'] = $res->result(); + + $this->db->select('T_Test_Report.*'); + $this->db->from('T_Test_Report'); + $this->db->where('testreport_id',$reportid); + $res1 = $this->db->get(); + $reportdata['masterreport'] = $res1->result(); + + $this->db->select('T_Test_Report_LOI.*'); + $this->db->from('T_Test_Report_LOI'); + $this->db->where('testreport_id',$reportid); + $res1 = $this->db->get(); + $reportdata['masterreportloi'] = $res1->result(); + + $this->db->select('T_Test_Report_AFS.*'); + $this->db->from('T_Test_Report_AFS'); + $this->db->where('testreport_id',$reportid); + $res1 = $this->db->get(); + $reportdata['masterreportafs'] = $res1->result(); + + $this->db->select('T_Company_Details.CompanyName,T_Company_Details.Address,T_Company_Details.ProfilePic'); + $this->db->from('T_Company_Details'); + //$this->db->where('testreport_id',$reportid); + $res1 = $this->db->get(); + $reportdata['company'] = $res1->result(); + + return $reportdata; + + } + function getTestMasterforList() { $this->db->select('T_Test_Report_Master.testreport_id,T_Test_Report_Master.invoiceid,T_Test_Report_Master.batchdate,ip_clients.client_id,ip_clients.client_name,ip_products.product_id,ip_products.product_name,ip_products.product_description'); @@ -218,9 +312,96 @@ class Quality_model extends CI_Model $this->db->join('ip_clients','ip_invoices.client_id=ip_clients.client_id'); $this->db->join('ip_invoice_items','ip_invoices.invoice_id=ip_invoice_items.invoice_id'); $this->db->join('ip_products','ip_products.product_id=ip_invoice_items.item_product_id'); + //$this->db->where('T_Test_Report_Master.invoiceid','!=0'); $res = $this->db->get(); return $res->result(); } + + function getTestMasterforListInward() + { + // $this->db->select('T_Test_Report_Master.testreport_id,T_Test_Report_Master.igrno,T_Test_Report_Master.igrlineitemno,T_Test_Report_Master.batchdate,ip_clients.client_id,ip_clients.client_name,ip_products.product_id,ip_products.product_name,ip_products.product_description'); + // $this->db->from('T_Test_Report_Master'); + // $this->db->join('ip_invoices','T_Test_Report_Master.invoiceid=ip_invoices.invoice_number'); + // $this->db->join('ip_clients','ip_invoices.client_id=ip_clients.client_id'); + // $this->db->join('ip_invoice_items','ip_invoices.invoice_id=ip_invoice_items.invoice_id'); + // $this->db->join('ip_products','ip_products.product_id=ip_invoice_items.item_product_id'); + // $res = $this->db->get(); + // return $res->result(); + + $this->db->select('T_Test_Report_Master.batchdate,T_Test_Report_Master.testreport_id,T_IGR_Master.IGRNO,T_IGR_Master.DeliveryChellanOrInvoiceNo,T_IGR_Master.DeliveryChellanDate,T_IGR_Details.IGRItemNo,T_IGR_Details.QuantityAsPerInvoice,T_MaterialMaster.MaterialCode,T_MaterialMaster.Materialname,T_SupplierDetailsN.SupplierID,T_SupplierDetailsN.SupplierName,T_Test_Report_Master.approvedby,T_Employee_Details.EmpID,T_Employee_Details.FirstName,T_Employee_Details.LastName'); + $this->db->from('T_Test_Report_Master'); + $this->db->join('T_IGR_Master','T_Test_Report_Master.igrno=T_IGR_Master.IGRNO'); + $this->db->join('T_IGR_Details','T_Test_Report_Master.igrlineitemno=T_IGR_Details.IGRItemNo'); + $this->db->join('T_PurchaseOrder_Master','T_IGR_Master.PONO=T_PurchaseOrder_Master.PONO'); + $this->db->join('T_MaterialMaster','T_IGR_Details.MaterialCode=T_MaterialMaster.MaterialCode'); + $this->db->join('T_SupplierDetailsN','T_PurchaseOrder_Master.SupplierID=T_SupplierDetailsN.SupplierID'); + $this->db->join('tbl_users','T_Test_Report_Master.createdby=tbl_users.userid'); + $this->db->join('T_Employee_Details','tbl_users.EmpID=T_Employee_Details.EmpID'); + $this->db->order_by('testreport_id','desc'); + $res = $this->db->get(); + return $res->result(); + } + + function getIGRNOforReport() + { + // $this->db->distinct(); + // $this->db->select('IGRNO'); + // $this->db->from('T_IGR_Details'); + // $this->db->join('T_MaterialMaster','T_IGR_Details.MaterialCode=T_MaterialMaster.MaterialCode'); + // $this->db->like('T_MaterialMaster.Category','raw material'); + + $sql = 'select distinct IGRNO from T_IGR_Details + join T_MaterialMaster on T_IGR_Details.MaterialCode = T_MaterialMaster.MaterialCode + where T_MaterialMaster.Category like "%Raw Material%" order by IGRNO desc'; + $result = $this->db->query($sql); + return $result->result(); + } + + function getIGRLineItemNo($igrno) + { + // $this->db->select('IGRItemNo'); + // $this->db->from('T_IGR_Details'); + // $this->db->where('IGRNO',$igrno); + + $sql = 'select IGRItemNo from T_IGR_Details + join T_MaterialMaster on T_IGR_Details.MaterialCode = T_MaterialMaster.MaterialCode + where IGRNO = ? and T_MaterialMaster.Category like "%Raw Material%"'; + + $result = $this->db->query($sql,array($igrno)); + return $result->result(); + + + } + + + + function getIGRDataforReport($igrno,$igrlineitemno) + { + //echo $igrno.'-'.$igrlineitemno;die(); + // $this->db->select('T_IGR_Master.DeliveryChellanOrInvoiceNo,T_IGR_Master.DeliveryChellanDate,T_SupplierDetailsN.SupplierID,T_SupplierDetailsN.SupplierName,T_MaterialMaster.MaterialCode,T_MaterialMaster.MaterialName,T_IGR_Details.QuantityAsPerInvoice'); + // $this->db->from('T_IGR_Master'); + // $this->db->join('T_IGR_Details','T_IGR_Master.IGRNO=T_IGR_Details.IGRNO'); + // $this->db->join('T_MaterialMaster','T_IGR_Details.MaterialCode=T_MaterialMaster.MaterialCode'); + // $this->db->join('T_PurchaseOrder_Master','T_IGR_Master.PONO=T_PurchaseOrder_Master.PONO'); + // $this->db->join('T_SupplierDetailsN','T_PurchaseOrder_Master.SupplierID=T_SupplierDetailsN.SupplierID'); + + // $this->db->where('T_IGR_Details.IGRNO',$igrno); + // $this->db->where('T_IGR_Details.IGRItemNo',$igrlineitemno); + // $this->db->order_by('T_IGR_Master.IGRNO'); + // $res = $this->db->get(); + // return $res->result(); + + $sql = 'select T_IGR_Master.DeliveryChellanOrInvoiceNo, date_format(T_IGR_Master.DeliveryChellanDate,"%d-%m-%Y") as DeliveryChellanDate,T_SupplierDetailsN.SupplierID,T_SupplierDetailsN.SupplierName,T_MaterialMaster.MaterialCode, + T_MaterialMaster.MaterialName,T_IGR_Details.QuantityAsPerInvoice + from T_IGR_Master + join T_IGR_Details on T_IGR_Master.IGRNO=T_IGR_Details.IGRNO + join T_MaterialMaster on T_IGR_Details.MaterialCode=T_MaterialMaster.MaterialCode + join T_PurchaseOrder_Master on T_IGR_Master.PONO=T_PurchaseOrder_Master.PONO + join T_SupplierDetailsN on T_PurchaseOrder_Master.SupplierID=T_SupplierDetailsN.SupplierID + where T_IGR_Master.IGRNO = ? and T_IGR_Details.IGRItemNo = ?'; + $res = $this->db->query($sql,array($igrno,$igrlineitemno)); + return $res->result(); + } } ?> \ No newline at end of file diff --git a/application/views/Report_consolidate_inward.php b/application/views/Report_consolidate_inward.php index bef569f9..ae21799f 100644 --- a/application/views/Report_consolidate_inward.php +++ b/application/views/Report_consolidate_inward.php @@ -157,7 +157,7 @@ foreach ($spurchse as $result) { ?> - supplier_name;?> + supplier_name;?> material_name)) { echo $result->material_name ; } else {echo "-";} diff --git a/application/views/Report_consolidate_month.php b/application/views/Report_consolidate_month.php new file mode 100644 index 00000000..3fb6801c --- /dev/null +++ b/application/views/Report_consolidate_month.php @@ -0,0 +1,201 @@ + + + + + +
+ +
+ +
+
+

Report - Consolidate Month(input->get('m'); + echo $m; + ?>)

+
+ + +
+
+ + + + + + + + + + + + + + + + + input->get('ab'); + $month=date('F'); + $m = $this->input->get('m'); + //echo $month; + foreach($spurchse as $rel) + { + ?> + + + + + + + + + + + + + + + + + + + + + + + + + + +
CategorySupplier NameMaterial Name
QuantityValue  ()
+ category;?> + + supplier_name;?> + material_name;?>quantity); + echo round($rel->quantity);?>total,2,'.',''); + echo number_format($rel->total,2,'.','');?>
Total + + + + + + + + + + + + + +
+ +
+
+
+ +
+ +
+ + + + + + + + + + + \ No newline at end of file diff --git a/application/views/Report_consolidate_raw.php b/application/views/Report_consolidate_raw.php new file mode 100644 index 00000000..3c98f844 --- /dev/null +++ b/application/views/Report_consolidate_raw.php @@ -0,0 +1,708 @@ + + + + + +
+ +
+ +
+
+

Report - Consolidate (Category-Wise)

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

+ + +
+
+
+ + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + input->post('financialyear'); + foreach ($spurchse as $result) { ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
CategoryAprMayJunJulAugSepOctNovDecJanFebMarTotal
+ category;?> + + April); + ?> + April);?> + + May); + ?> + May);?> + + June); + ?> + June);?> + + July); + ?> + July);?> + + August); + ?> + August);?> + + September; + ?> + September);?> + + October); + ?> + October);?> + + November); + ?> + November);?> + + December); + ?> + December);?> + + January); + ?> + January);?> + + February); + ?> + February);?> + + March); + ?> + March);?> + + qtotal); + ?> + qtotal);?> +
Total + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + +
+ +
+ +
+ + + + + + + + + + + \ No newline at end of file diff --git a/application/views/Report_consolidate_year.php b/application/views/Report_consolidate_year.php new file mode 100644 index 00000000..1e923377 --- /dev/null +++ b/application/views/Report_consolidate_year.php @@ -0,0 +1,202 @@ + + + + + +
+ +
+ +
+
+

Report - Consolidate Month(input->get('ab'); + echo $m; + ?>)

+
+ + +
+
+ + + + + + + + + + + + + + + + + input->get('ab'); + + $month=date('F'); + //echo $month; + foreach($spurchse as $rel) + { + ?> + + + + + + + + + + + + + + + + + + + + + + + + + + +
CategorySupplier NameMaterial Name
QuantityValue  ()
+ category;?> + + supplier_name;?> + + material_name;?>quantity); + echo round($rel->quantity);?>total,2,'.',''); + echo number_format($rel->total,2,'.','');?>
Total + + + + + + + + + + + + + +
+ +
+
+
+ +
+ +
+ + + + + + + + + + + \ No newline at end of file diff --git a/application/views/Report_cumulative_day_inward.php b/application/views/Report_cumulative_day_inward.php index 9e4996a2..39458a7c 100644 --- a/application/views/Report_cumulative_day_inward.php +++ b/application/views/Report_cumulative_day_inward.php @@ -37,7 +37,7 @@ if(!empty($mms))
-

Report - Cumulative Today

+

Report - Cumulative Today - Inward

@@ -69,7 +69,7 @@ if(!empty($mms)) ?> - supplier_name;?> + supplier_name;?> material_name;?> + + +
+ +
+ +
+
+

Report - Cumulative Today (Category-Wise)

+
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
CategorySupplier NameMaterial Name
QuantityValue  ()
category;?> + supplier_name;?> + material_name;?>tquantity); + echo round($rel->tquantity);?>ttotal,2,'.',''); + echo number_format($rel->ttotal,2,'.','');?>
Total + + + + + + + + + + + + + + +
+ +
+
+
+ +
+ +
+ + + + + + + + + + + \ No newline at end of file diff --git a/application/views/Report_cumulative_inward.php b/application/views/Report_cumulative_inward.php index 6194e3ec..8bb0b9fd 100644 --- a/application/views/Report_cumulative_inward.php +++ b/application/views/Report_cumulative_inward.php @@ -36,7 +36,7 @@ if(!empty($mms))
-

Report - Cumulative

+

Report - Cumulative -inward

@@ -90,27 +90,27 @@ if(!empty($mms)) ?> - supplier_name;?> + supplier_name;?> material_name;?> tquantity); - echo anchor('report/cum_day/'.$rel->sid . '/' . $rel->mid,round($rel->tquantity));?> + echo anchor('report/icum_day/'.$rel->sid . '/' . $rel->mid,round($rel->tquantity));?> ttotal,2,'.',''); - echo anchor('report/cum_day/'.$rel->sid . '/' . $rel->mid,number_format($rel->ttotal,2,'.',''));?> + echo anchor('report/icum_day/'.$rel->sid . '/' . $rel->mid,number_format($rel->ttotal,2,'.',''));?> mquantity); - echo anchor('report/cum_month/'.$rel->sid . '/' . $rel->mid,round($rel->mquantity));?> + echo anchor('report/icum_month/'.$rel->sid . '/' . $rel->mid,round($rel->mquantity));?> mtotal,2,'.',''); - echo anchor('report/cum_month/'.$rel->sid . '/' . $rel->mid,number_format($rel->mtotal,2,'.',''));?> + echo anchor('report/icum_month/'.$rel->sid . '/' . $rel->mid,number_format($rel->mtotal,2,'.',''));?> quantity); - echo anchor('report/cum_year/'.$rel->sid . '/' . $rel->mid,round($rel->quantity));?> + echo anchor('report/icum_year/'.$rel->sid . '/' . $rel->mid,round($rel->quantity));?> total,2,'.',''); - echo anchor('report/cum_year/'.$rel->sid . '/' . $rel->mid,number_format($rel->total,2,'.',''));?> + echo anchor('report/icum_year/'.$rel->sid . '/' . $rel->mid,number_format($rel->total,2,'.',''));?> diff --git a/application/views/Report_cumulative_month_inward.php b/application/views/Report_cumulative_month_inward.php index d9e6c92a..0a2f001f 100644 --- a/application/views/Report_cumulative_month_inward.php +++ b/application/views/Report_cumulative_month_inward.php @@ -37,7 +37,7 @@ if(!empty($mms))
-

Report - Cumulative Month

+

Report - Cumulative Month -Inward

@@ -75,7 +75,7 @@ if(!empty($mms)) ?> - supplier_name;?> + supplier_name;?> material_name;?> + + +
+ +
+ +
+
+

Report - Cumulative Month (Category-Wise)

+
+ + +
+
+ + + + + + + + + + + + + + + + + = 4) { + $yearl = date('Y').'-'.(date('Y')+1); + } else { + $yearl = (date('Y')-1).'-'.date('Y'); + } + $ab=$yearl; + $month=date('F'); + //echo $month; + foreach($cum_month as $rel) + { + ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + +
CategorySupplier NameMaterial Name
QuantityValue  ()
category;?> + supplier_name;?> + material_name;?>tquantity); + echo round($rel->tquantity);?>ttotal,2,'.',''); + echo number_format($rel->ttotal,2,'.','');?>
Total + + + + + + + + + + + + + + +
+ +
+
+
+ +
+ +
+ + + + + + + + + + + \ No newline at end of file diff --git a/application/views/Report_cumulative_raw.php b/application/views/Report_cumulative_raw.php new file mode 100644 index 00000000..454ecaf7 --- /dev/null +++ b/application/views/Report_cumulative_raw.php @@ -0,0 +1,265 @@ + + + + + +
+ +
+ +
+
+

Report - Cumulative (Category-Wise)

+
+ + +
+
+ + + + = 4) { + $yearl = date('Y').'-'.(date('Y')+1); + } else { + $yearl = (date('Y')-1).'-'.date('Y'); + } + $ab=$yearl; + ?> + + + + + + + + + + + + + + + + + = 4) { + $yearl = date('Y').'-'.(date('Y')+1); + } else { + $yearl = (date('Y')-1).'-'.date('Y'); + } + $ab=$yearl; + + + foreach($cum as $rel) + { + $cat = $rel->category; + ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Category
QuantityValue  ()QuantityValue  ()QuantityValue  ()
+ category;?> + + tquantity); + ?> + tquantity);?> + ttotal,2,'.',''); + ?> + ttotal,2,'.','');?> + mquantity); + ?> + mquantity);?> + mtotal,2,'.',''); + ?> + mtotal,2,'.','');?> + quantity); + ?> + quantity);?> + total,2,'.',''); + ?> + total,2,'.','');?> +
Total + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+ +
+ +
+ + + + + + + + + + + \ No newline at end of file diff --git a/application/views/Report_cumulative_year_inward.php b/application/views/Report_cumulative_year_inward.php index 40f60d34..11b89d7c 100644 --- a/application/views/Report_cumulative_year_inward.php +++ b/application/views/Report_cumulative_year_inward.php @@ -37,7 +37,7 @@ if(!empty($mms))
-

Report - Cumulative Year

+

Report - Cumulative Year - Inward

@@ -81,7 +81,7 @@ if(!empty($mms)) ?> - supplier_name;?> + supplier_name;?> material_name;?> + + +
+ +
+ +
+
+

Report - Cumulative Year (Category-Wise)

+
+ + +
+
+ + + + = 4) { + $yearl = date('Y').'-'.(date('Y')+1); + } else { + $yearl = (date('Y')-1).'-'.date('Y'); + } + $ab=$yearl; + ?> + + + + + + + + + + + + + + = 4) { + $yearl = date('Y').'-'.(date('Y')+1); + } else { + $yearl = (date('Y')-1).'-'.date('Y'); + } + $ab=$yearl; + foreach($cum_year as $rel) + { + ?> + + + + + + + + + + + + + + + + + + + + + + + + + + +
CategorySupplier NameMaterial Name
QuantityValue  ( )
category;?> + supplier_name;?> + material_name;?>tquantity); + echo round($rel->tquantity);?>ttotal,2,'.',''); + echo number_format($rel->ttotal,2,'.','');?>
Total + + + + + + + + + + + + + + +
+ +
+
+
+ +
+ +
+ + + + + + + + + + + \ No newline at end of file diff --git a/application/views/Report_month_wise_inward.php b/application/views/Report_month_wise_inward.php index 451aa764..11e4d2f2 100644 --- a/application/views/Report_month_wise_inward.php +++ b/application/views/Report_month_wise_inward.php @@ -65,7 +65,7 @@ if(!empty($mms)) ?> - supplier_name;?> + supplier_name;?> material_name;?> Date Time Material Name + Category Supplier Name Quantity UOM @@ -225,6 +226,7 @@ if(!empty($mms)) created_date;?> created_time;?> material_name;?> + category;?> supplier_name;?> quantity); @@ -276,6 +278,7 @@ if(!empty($mms))       +     diff --git a/application/views/Report_supplier_inward.php b/application/views/Report_supplier_inward.php index b488b924..ba87fde6 100644 --- a/application/views/Report_supplier_inward.php +++ b/application/views/Report_supplier_inward.php @@ -185,7 +185,7 @@ if(!empty($mms)) ?> - supplier_name;?> + supplier_name;?> counts); diff --git a/application/views/Report_year_wise_inward.php b/application/views/Report_year_wise_inward.php index 17075a65..97b6ce4e 100644 --- a/application/views/Report_year_wise_inward.php +++ b/application/views/Report_year_wise_inward.php @@ -103,7 +103,7 @@ if(!empty($mms)) //echo $new; ?> - + quantity; @@ -124,7 +124,7 @@ if(!empty($mms)) input->post('financialyear'); $Total="Total"; - echo anchor('report/year_wise_total/' . $ab,$Total); ?> + echo anchor('report/iyear_wise_total/' . $ab,$Total); ?> diff --git a/application/views/Report_year_wise_total_inward.php b/application/views/Report_year_wise_total_inward.php index b6a89985..cc379d92 100644 --- a/application/views/Report_year_wise_total_inward.php +++ b/application/views/Report_year_wise_total_inward.php @@ -64,7 +64,7 @@ if(!empty($mms)) ?> - supplier_name;?> + supplier_name;?> material_name;?> ; $.each(t,function(i,item){ - if(item.type == 'INCOME') + if(item.type == 'RECEPIT') { $("#accode").append( $('').val(item.code).html(item.name)); } @@ -77,12 +77,12 @@ function loadAccountType(id) if(id == 'myradio1') { - // alert('INCOME clicked'); + // alert('RECEPIT clicked'); $('#accode').find('option').remove().end().append('').val('Select Account Code'); $.each(t,function(i,item){ - if(item.type == 'INCOME') + if(item.type == 'RECEPIT') { $("#accode").append( $('').val(item.code).html(item.name)); } @@ -144,8 +144,8 @@ function loadAccountType(id)
Select Accounut type:

- Income         - Expense + RECEIPT         + PAYMENT
diff --git a/application/views/cashbookdepday.php b/application/views/cashbookdepday.php new file mode 100644 index 00000000..43b2ecc0 --- /dev/null +++ b/application/views/cashbookdepday.php @@ -0,0 +1,116 @@ +FontCode2000; + }} +?> + + + +
+
+
+
+

Department Based Report

+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
dateAccount NamePaid Type Amount Description
date?>name?>type?>total,2,'.','');?>description?>
+ +
+
+
+
+
+
+ + + + + + + + diff --git a/application/views/cashbookdepmenu.php b/application/views/cashbookdepmenu.php new file mode 100644 index 00000000..3fc17fdd --- /dev/null +++ b/application/views/cashbookdepmenu.php @@ -0,0 +1,119 @@ +FontCode2000; + }} +?> + + + +
+
+
+
+

Cashbook Department

+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Account NamePaid Type Amount
name?>type?>total,2,'.','');?>
+ +
+
+
+
+
+
+ + + + + + + + diff --git a/application/views/cashbooklisting.php b/application/views/cashbooklisting.php index e1f5cdf4..2bd40e50 100755 --- a/application/views/cashbooklisting.php +++ b/application/views/cashbooklisting.php @@ -17,8 +17,8 @@
Account Type :  *
- Income
- Expense
+ RECEPIT
+ PAYMENT

Account Code :  * diff --git a/application/views/editCapitalPo.php b/application/views/editCapitalPo.php index 25b7b329..d2b2bfb8 100644 --- a/application/views/editCapitalPo.php +++ b/application/views/editCapitalPo.php @@ -3143,6 +3143,20 @@ $("#PaymentMethod").select2();
+ +
+
+ +
+
+
+ 'ViewTotalAmountlocal','value' => set_value('ViewTotalAmountlocal'),'id'=>'ViewTotalAmountlocal', 'class' => 'form-control num' ,'placeholder' => 'Total Amount','readonly' => 'true'); + echo form_input($data); + ?> +
+
+

@@ -5884,7 +5898,7 @@ function DeleteRow(rowid) $('#ViewAfterSgst').val($('#AfterSgst'+userid).val()); $('#ViewAfterIgst').val($('#AfterIgst'+userid).val()); $('#ViewOtherAllowances').val($('#OtherAmt'+userid).val()); - + $('#ViewTotalAmountlocal').val(cellval[9].innerHTML); $('#drpFreightviewloc').val($("#Ftype"+userid).val()); $('#NOOfTripslocview').val($("#NoTrip"+userid).val()); diff --git a/application/views/includes/header.php b/application/views/includes/header.php index 3a0621e5..470a2800 100644 --- a/application/views/includes/header.php +++ b/application/views/includes/header.php @@ -20,8 +20,11 @@ + + + + - @@ -580,6 +583,13 @@ $(function() { Product Test Report + +
  • + + + Inward Material Test Report + +
  • +.edit{ + +background-color:#eeffcc ! important; + +} + +'Select IGR No'); +foreach($records as $rec) +{ + $igrnos[$rec->IGRNO] = $rec->IGRNO; +} +$igrlinenos = array(-1=>'Select IGR LineItem No'); +//print_r($emplist); +$approvedby = array(-1=>'Select Approver Name'); +foreach($emplist as $r) +{ + $approvedby[$r->FirstName.' '.$r->LastName] = $r->FirstName.' '.$r->LastName.'-'.$r->shortName; +} + +?> + + + +
    + +
    +

    +
    Inward Inspection Report Screen
    +

    +
    +
    + + +
    +
    +
    +
    + +
    + +
    + +
    +
    + +
    + + +
    + +
    +
    + + +
    + +
    + + +
    + +
    + + +
    +
    +
    + + +
    + + + + +
    + +
    + + + +
    + +
    + + + +
    + +
    + + +
    + +
    + + +
    + + + +
    +
    + + + + + + + + + + + + + + +
    SNODescriptionSpecification
    Min
    Specification
    Max
    Specification
    UOM
    ACT X1ACT X2ACT X3AverageResultsRemarks
    +

     

    +
    + +
    + +
    L.O.I Details
    + +
    +
    + + + + + + + + + + + + + +
    SNO
    Heating Time

    start
    Heating Time

    end
    Temp *c
    Crucible Weight

    w1(g)
    Before Heating

    w2(g)
    After Heating

    w3(g)
    L.O.I %Remarks
    +
    + + +
    + +
    AFS Details
    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + +
    NOSieve Size µmMesh SizeSand WeightPercentageMultiplierProduct
    1 170010 0.000.0050.0000
    2 85020 0.000.00100.0000
    3 60030 0.000.00200.0000
    4 42540 0.000.00300.0000
    5 30050 0.000.00400.0000
    6 21270 0.000.00500.0000
    7 150100 0.000.00700.0000
    8 106140 0.000.001000.0000
    9 75200 0.000.001400.0000
    10 53300 0.000.002000.0000
    11 panpan 0.000.003000.0000
      Total  0.000.00 0.0000
    +
    + +
    + +
    AFS CHART
    + +
    +
    +
    +
    + Your browser does not support the HTML5 canvas tag.
    + +
    +
    + + + + + +
     
    +
    + +
    + + + +
    + +
    + + + +
    + +
    + +
     
    +
    +
     
    +
    +
    + +
    +
    +
    + +
    +
    +
    +
    + + + + + + + + + + \ No newline at end of file diff --git a/application/views/payslipgenerateprint.php b/application/views/payslipgenerateprint.php index 68923d8f..189704ad 100755 --- a/application/views/payslipgenerateprint.php +++ b/application/views/payslipgenerateprint.php @@ -196,10 +196,11 @@ if($RecCount > 0) - diff --git a/application/views/qualitymaster.php b/application/views/qualitymaster.php index 624983c0..230cc516 100644 --- a/application/views/qualitymaster.php +++ b/application/views/qualitymaster.php @@ -11,16 +11,28 @@ th{ $products2=array(-1=>'Select Products'); -foreach($products as $product) +foreach($productsoutward as $product) { $products2[$product->product_id] =$product->product_id.'-'.$product->product_name.'-'.$product->product_description; } $customers2 = array(-1 => 'Select Customer'); -foreach($customers as $customer) +foreach($customersoutward as $customer) { $customers2[$customer->client_id] = $customer->client_name; } + +$productsinward1=array(-1=>'Select Products'); +foreach($productsinward as $product) +{ + $productsinward1[$product->MaterialCode] =$product->MaterialCode.'-'.$product->MaterialName; +} + +$customersinward1 = array(-1 => 'Select Customer'); +foreach($customersinward as $customer) +{ + $customersinward1[$customer->SupplierID] = $customer->SupplierName; +} ?> @@ -52,17 +64,38 @@ foreach($customers as $customer)
    -
    - -
    - -
    - -
    - -
    - -
    + +
    +   OutWard +
    + +
    +   InWard +
    + +
    +
    + +
    + +
    + +
    +
    + + + +
    + +

    @@ -182,21 +215,66 @@ foreach($customers as $customer) + + + + + + + + + \ No newline at end of file diff --git a/application/views/viewindinwardreportpdf.php b/application/views/viewindinwardreportpdf.php new file mode 100644 index 00000000..8eb98b12 --- /dev/null +++ b/application/views/viewindinwardreportpdf.php @@ -0,0 +1,188 @@ + +chartdata; + $reportid = $m->testreport_id; + $invoiceno = $m->DeliveryChellanOrInvoiceNo; + $invoicedate = $m->DeliveryChellanDate; + $customername = $m->SupplierName; + $product_description = $m->Materialname; + $igrno = $m->IGRNO; + $igrlineitemno = $m->IGRItemNo; + $qty = $m->QuantityAsPerInvoice; + $batchdate = $m->batchdate; + $inspector = $m->FirstName.' '.$m->LastName; + $approvedby = $m->approvedby; +} +} + +$cname = ''; +$caddress = ''; +$pic = ''; +if(!empty($reportdata['company'])){ +foreach($reportdata['company'] as $c) + { + $cname = $c->CompanyName; + $caddress = $c->Address; + $pic = $c->ProfilePic; + } +} +?> + + + + +
    +
    -


    PaySlip for the Month of
    + +
    SIDDHARTH INDUSTRIES
    Survey No: 168/1C3,Pennalur Pet Road,Goonipalyam village,
    Uthukottai Taluk,Tiruvallur Dist, Chennai,Tamilnadu,Pin code : 602026.
    PaySlip for the Month of
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    INWARD MATERIAL INSPECTION REPORT

    no image
    SUPPLIER NAMEIGRNO
    IGRItemNo
    MATERIAL NAMEINVOICE NO
    INVOICE DATE
    QTY kgsBATCH DATE
    + +
    + + + + + + + + +
    S.NODESCRIPTIONSPECIFICATIONACT Average Results Remarks
    X1 X2 X3
    MinMaxUOM
    description;?>min == 0 || $master->min == '') { echo "-"; } else { echo $master->min;} ?> max == 0 || $master->max == '') { echo '-'; } else { echo $master->max; }?> UOM;?>act1)){ echo $master->act1; }else {echo '0.00';}?>act2)){ echo $master->act2; } else {echo '0.00';}?> act3)){ echo $master->act3; } else {echo '0.00';}?> average;?> result;?> remarks;?>
    + +

    L.O.I DETAILS

    + + + + + + + + +
    S.NOHEATING TIMETEMPCRUCIBLE WEIGHTBEFORE HEATING WEIGHTAFTER HEATING WEIGHT L.O.I (%)Remarks
    START TIME - END TIME*C W1(g) W2(g) W3(g)
    start_time.'~'.$loi->end_time;?>temp;?> w1;?> w2;?> w3;?> loi_percentage;?> remarks;?>
    + +

    AFS DETAILS

    + + + + + + sandweight; + $totalproduct = $totalproduct + $afs->product; + } + ?> + + +
    S.NO Sieve Size µm Mesh Size SAND WEIGHT Percantage Multiplier Product
    sieve_size?> mesh_size?>sandweight;?>percentage?>multiplier?>product;?>
      Total   
    +
    +
    + +
    NO
    + +
    +
    +

    + + + + + + +
    INSPECTOR NAME :                                                      APPROVED BY :
     
     
    Signature 
    + + diff --git a/assets/dist/img/RI_favicon.png b/assets/dist/img/RI_favicon.png new file mode 100644 index 00000000..2ac84a5d Binary files /dev/null and b/assets/dist/img/RI_favicon.png differ