diff --git a/application/controllers/purchaseorder.php b/application/controllers/purchaseorder.php index 52606d70..bb3d6912 100755 --- a/application/controllers/purchaseorder.php +++ b/application/controllers/purchaseorder.php @@ -329,6 +329,7 @@ class purchaseorder extends BaseController $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->GetWorkStatus('C019'); $this->global['pageTitle'] = 'Siddharth : Edit Service Purchase order form'; $this->loadViews("EditservicePurchaseorder", $this->global, $data, NULL); diff --git a/application/controllers/servicepurchaseorder.php b/application/controllers/servicepurchaseorder.php index 31f7e5b7..46213621 100755 --- a/application/controllers/servicepurchaseorder.php +++ b/application/controllers/servicepurchaseorder.php @@ -71,19 +71,20 @@ class servicepurchaseorder extends BaseController $DeliveryAddr = $this->input->post('DeliveryAddr'); $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 = ''; - } + $DeliveryOption = $this->input->post('DateRange'); + if($DeliveryOption==1) + { + $Deliverydt = ''; + $DeliverySchedule = $this->input->post('Scheduleby'); + } + else{ + $Deliverydt = $this->getDateformat($dt); + $DeliverySchedule = ''; + } - $PaymentDate=$this->input->post('Payment'); + $PaymentDate=$this->input->post('Payment'); if($PaymentDate==1) { $PaymentDays='After'; @@ -110,9 +111,12 @@ class servicepurchaseorder extends BaseController $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $createddt = $dt->format('Y-m-d H:i:s'); + + $WorkStatus=$this->input->post('workstatus'); // 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,'PayableAT'=>$Payableat,'PaymentDays'=>$PaymentDays ); - + $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,'PayableAT'=>$Payableat,'PaymentDays'=>$PaymentDays,'ServiceWorkStatus'=>$WorkStatus ); + //print_r($POList); + //die(); $POMaster = $this->purchaseorder_model->addPOMaster($POList); $PONO = ''; @@ -137,6 +141,7 @@ class servicepurchaseorder extends BaseController $KrishiTax = $this->input->post('KrishiTax'.$i); $SwachhTax = $this->input->post('SwachhTax'.$i); $CostCenter = $this->input->post('costCode'.$i); + $ServiceFrequency=$this->input->post('Frequency'.$i); $TotalOrderValue = $this->input->post('TotalOrderValue'.$i); @@ -158,7 +163,9 @@ class servicepurchaseorder extends BaseController if($SkipInsert == "False") { - $POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'CostCenterCode'=>$CostCenter); + $POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'CostCenterCode'=>$CostCenter,'ServiceFrequency'=>$ServiceFrequency); + print_r($POLineItemList); + die(); $POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList); @@ -231,10 +238,11 @@ class servicepurchaseorder extends BaseController $comma_separated = explode(':', $DeletedRow); $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $updateddt = $dt->format('Y-m-d H:i:s'); + $WorkStatus=$this->input->post('workstatus'); // PO Master - $POList = array('SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrderValueSummary,'PODate'=>$PODate,'Status'=>$POStatus,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'ServiceDescription'=>$SpcialInstruction,'UpdateBY'=>$updatedBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'UpdatedOn'=>$updateddt,'PaymentTerms'=>$PaymentTerms,'PayableAT'=>$Payableat,'PaymentDays'=>$PaymentDays ); + $POList = array('SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrderValueSummary,'PODate'=>$PODate,'Status'=>$POStatus,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'ServiceDescription'=>$SpcialInstruction,'UpdateBY'=>$updatedBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'UpdatedOn'=>$updateddt,'PaymentTerms'=>$PaymentTerms,'PayableAT'=>$Payableat,'PaymentDays'=>$PaymentDays,'ServiceWorkStatus'=>$WorkStatus ); $POMaster = $this->purchaseorder_model->updatePOMaster($PONO,$POList); @@ -253,7 +261,8 @@ class servicepurchaseorder extends BaseController $SwachhTax = $this->input->post('SwachhTax'.$i); $CostCenter = $this->input->post('costCode'.$i); $POLineItemNo = $this->input->post('LineItemNo'.$i); - $TotalOrderValue = $this->input->post('TotalOrderValue'.$i); + $TotalOrderValue = $this->input->post('TotalOrderValue'.$i); + $ServiceFrequency=$this->input->post('Frequency'.$i); $POLineItem = array(); $LineItemNo = ''; @@ -276,7 +285,7 @@ class servicepurchaseorder extends BaseController { if(strlen($POLineItemNo) == 0) { - $POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'CreatedBy'=>$updatedBy,'CreatedDate'=>$updateddt,'CostCenterCode'=>$CostCenter); + $POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'CreatedBy'=>$updatedBy,'CreatedDate'=>$updateddt,'CostCenterCode'=>$CostCenter,'ServiceFrequency'=>$ServiceFrequency); $POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList); if(count($POLineItem)>0) { diff --git a/application/models/purchaseorder_model.php b/application/models/purchaseorder_model.php index b7906003..157042cd 100755 --- a/application/models/purchaseorder_model.php +++ b/application/models/purchaseorder_model.php @@ -446,7 +446,7 @@ function purchaseorderListing($forwhat='') function GetServicePurchaseOrder($PONO = '') { $this->db->distinct(); - $this->db->select('ReqNo,POMast.PONO,ServiceDescription,supp.SupplierID,supp.SupplierName,supp.Address,PODate,Stat.StatusName,DeliveryOption,DeliverySchedule,DeliveryDate,DeliveryAddress,POMast.PaymentTerms,POMast.PaymentDays,POMast.PayableAT,POMast.ExchangeRate,POMast.UpdatedOn,Stat.StatusCode'); + $this->db->select('ReqNo,POMast.PONO,ServiceDescription,supp.SupplierID,supp.SupplierName,supp.Address,PODate,Stat.StatusName,DeliveryOption,DeliverySchedule,DeliveryDate,DeliveryAddress,POMast.PaymentTerms,POMast.PaymentDays,POMast.PayableAT,POMast.ExchangeRate,POMast.UpdatedOn,Stat.StatusCode,POMast.ServiceWorkStatus'); $this->db->from('T_PurchaseOrder_Master POMast'); $this->db->join('T_SupplierDetailsN supp', 'supp.SupplierID = POMast.SupplierID'); $this->db->join('T_Status Stat', 'Stat.StatusCode = POMast.Status'); @@ -465,7 +465,7 @@ function purchaseorderListing($forwhat='') { $subQuery ='SELECT distinct LineItem.LineItemNo,ReqNo,Mat.MaterialCode,Mat.MaterialName,Mat.UOM,Quantity,Rate,Status,ROUND((Quantity *Rate),2 ) as BasicValue ,ROUND((ServiceTax + EducessTax + SecHigherEducessTax + KrishiKalyantax + SwachhBharattax),2)as Taxamount - ,TotalValue,ServiceTax,EducessTax,SecHigherEducessTax,KrishiKalyantax,SwachhBharattax,CostCenterCode + ,TotalValue,ServiceTax,EducessTax,SecHigherEducessTax,KrishiKalyantax,SwachhBharattax,CostCenterCode,LineItem.ServiceFrequency FROM T_PurchaseOrder_LineItem LineItem join T_MaterialMaster Mat on Mat.MaterialCode = LineItem.MaterialCode join T_Service_Tax Tax on Tax.LineItemNo = LineItem.LineItemNo diff --git a/application/views/EditservicePurchaseorder.php b/application/views/EditservicePurchaseorder.php index 586029ef..9132be4c 100755 --- a/application/views/EditservicePurchaseorder.php +++ b/application/views/EditservicePurchaseorder.php @@ -53,9 +53,12 @@ if(!empty($POMaster)) //$PaymentTerms=$Req->PaymentTerms; $PayableAT=$Req->PayableAT; $PaymentDays=$Req->PaymentDays; + $WrkStatus=$Req->ServiceWorkStatus; } } +//echo "$WrkStatus"; + if(!empty($AvlBudAmt)) { @@ -724,8 +727,20 @@ $(document).ready(function () {
'Select Status'); - echo form_dropdown('workstatus', $options,set_value('workstatus'),'id="workstatus"' ,'required="true"' ,'class="form-control select2'); + + $options = array("0"=>$WrkStatus); + //print_r( $options); + + if(!empty($WorkStatus)) + { + foreach ($WorkStatus as $SID): + + $options[$SID->ConfigValue] = $SID->ConfigValue; + + endforeach; + } + + echo form_dropdown('workstatus', $options,set_value('workstatus'),'id="workstatus"' ,'required="true"' ,'class="form-control select2'); ?>
@@ -1136,7 +1151,7 @@ $(document).ready(function () {
'Frequency','value' => set_value('Frequency'),'id'=>'Frequency', 'class' => 'form-control' ); + $data = array('name' => 'EditFrequency','value' => set_value('EditFrequency'),'id'=>'EditFrequency', 'class' => 'form-control' ); echo form_input($data); ?>
@@ -1348,6 +1363,7 @@ $(document).ready(function () { + ; if (paymentday=="After") { @@ -1558,6 +1575,8 @@ $("#EDITSERVICE").on("shown.bs.modal", function(e) { $('#EditAfterSecHighTax').val($('#SecHighTax'+userid).val()); $('#EditAfterKrishiTax').val($('#KrishiTax'+userid).val()); $('#EditAfterSwachhTax').val($('#SwachhTax'+userid).val()); + $('#EditFrequency').val($('#ServiceFrequency'+userid).val()); + $('#EditTotalOrderValue').val(cellval[8].innerHTML); RequistQuantity = $('#quantity'+userid).val(); diff --git a/application/views/servicePurchaseorder.php b/application/views/servicePurchaseorder.php index 553ee281..d5a25312 100755 --- a/application/views/servicePurchaseorder.php +++ b/application/views/servicePurchaseorder.php @@ -679,10 +679,22 @@ $(document).ready(function () { 'Select Status'); + $options = array("0"=>'Select Status'); + //print_r( $options); + if(!empty($WorkStatus)) + { + foreach ($WorkStatus as $SID): + + + $options[$SID->ConfigValue] = $SID->ConfigValue; + + endforeach; + } + echo form_dropdown('workstatus', $options,set_value('workstatus'),'id="workstatus"' ,'required="true"' ,'class="form-control select2'); + ?>
@@ -1100,13 +1112,12 @@ $(document).ready(function () {
-
- 'Select Frequency'); - echo form_dropdown('Frequency', $options,set_value('Frequency'),'id="Frequency"' ,'class="form-control"'); - - ?> -
+
+ 'EditFrequency','value' => set_value('EditFrequency'),'id'=>'EditFrequency', 'class' => 'form-control' ); + echo form_input($data); + ?> +
@@ -1421,6 +1432,9 @@ $("#EDITSERVICE").on("shown.bs.modal", function(e) { $('#EditAfterSecHighTax').val($('#SecHighTax'+userid).val()); $('#EditAfterKrishiTax').val($('#KrishiTax'+userid).val()); $('#EditAfterSwachhTax').val($('#SwachhTax'+userid).val()); + + $('#EditFrequency').val($('#Frequency'+userid).val()); + $('#EditTotalOrderValue').val(cellval[8].innerHTML); @@ -1504,6 +1518,8 @@ $('.AddService').click(function(){ var AfterSwachhTax = $("#AfterSwachhTax").val(); + + var Frequency=$("#Frequency").val(); var TotalOrderValue = $("#TotalOrderValue ").val(); @@ -1553,8 +1569,10 @@ $('.AddService').click(function(){ addHidden(theForm,"SecHighTax"+temp,AfterSecHighTax); addHidden(theForm,"KrishiTax"+temp,AfterKrishiTax); addHidden(theForm,"SwachhTax"+temp,AfterSwachhTax); - - addHidden(theForm,"TotalOrderValue"+temp,TotalOrderValue); + addHidden(theForm,"Frequency"+temp,Frequency); + addHidden(theForm,"TotalOrderValue"+temp,TotalOrderValue); + //alert(JSON.stringify($('#Frequency').val())); + //alert(ServiceTax); $('#txtRowCount').val(temp); clearServiceModalFields(); @@ -1760,6 +1778,7 @@ function clearServiceModalFields() $("#AfterKrishiTax").val(''); $("#AfterSwachhTax").val(''); $("#TotalOrderValue ").val(''); + $("#Frequency").val(''); } function DeleteRow(rowid)