diff --git a/application/controllers/amendmentpurchaseorder.php b/application/controllers/amendmentpurchaseorder.php index 3f2a5ee6..fc8af092 100755 --- a/application/controllers/amendmentpurchaseorder.php +++ b/application/controllers/amendmentpurchaseorder.php @@ -62,7 +62,7 @@ class amendmentpurchaseorder extends BaseController endforeach; $data['MaterialList'] = $result;//$this->purchaseorder_model->getRawMaterialList($ReqType,$ReqArray); $data['Suplist'] = $this->purchaseorder_model->getSupplierName(); - $data['Payment']=$this->purchaseorder_model->getSupplierPayment(); + $data['Payment']=$this->purchaseorder_model->getConfigValue('C009'); //print_r($data['Payment']); /* Cost code from Requisition - Client Review Fix Start here */ @@ -105,7 +105,7 @@ class amendmentpurchaseorder extends BaseController $data['POSTATUS']=$this->purchaseorder_model->GetPOStatus($PONO); $data['POItem'] = $this->purchaseorder_model->GetRevenuePurchaseOrderDetails($PONO); $data['PaymentTerms']=$this->purchaseorder_model->GetPaymentTerms($PONO); - echo "FROM CON"; + //echo "FROM CON"; //print_r($data['Payment']); $this->global['pageTitle'] = 'Siddharth : Edit Revenue Purchase order form'; $this->loadViews("editRevenueAmendPO", $this->global, $data, NULL); @@ -124,38 +124,99 @@ class amendmentpurchaseorder extends BaseController } // print_r($data); $data['POItem'] = $this->purchaseorder_model->GetImportPurchaseOrderDetails($PONO); - //print_r($data); - //$data['ExchangeRate']=$data['POItem']->ExchangeRate; + $data['Currency']=$this->purchaseorder_model->GetCurrencytype(); - //print_r($data['POItem']); + + 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); + //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'] = 'Siddharth : Edit Import Purchase order form'; + $this->loadViews("editImportAmendPO", $this->global, $data, NULL); + } + else if($ReqType == CAPITAL) + { + + + $AvlBudget = $this->purchaseorder_model->GetAvailableBudgetAmount($CostCode,$Year,$ReqType); + + + if(count($AvlBudget)>0) + { + $data['AvlBudAmt'] = $AvlBudget[0]['BudgetAmount'] - $AvlBudget[0]['Totalvalue']; + } + + $data['POItem'] = $this->purchaseorder_model->getCapitalPurchaseOrderDetails($PONO); + $data['requestedBy'] = $this->purchaseorder_model->GetRequesedByDetails($PONO); + + + + $CapitalRange=''; foreach($data['POItem'] as $Rate) { - - // print_r($Rate->ExchangeRate); + + $exRate=$Rate->ExchangeRate; + $CapitalRange=$Rate->CapitalRange; - // $data[$Rate->ExchangeRate]=$Rate->ExchangeRate; + } - + foreach($data['POItem'] as $CUR) { - //print_r($CUR->CurrencyType); + $Currency=$CUR->CurrencyType; - // $data[$Rate->ExchangeRate]=$Rate->ExchangeRate; + } - //echo "$Currency"; + + if($CapitalRange=='0'){ + $data['CurrencyDetail']=$this->purchaseorder_model->GetCurrencyDetail($Currency); - //print_r($data); + + $data['ExchangeRate']=$exRate; $data['Currency']=$this->purchaseorder_model->GetCurrencytype(); - //print_r($data); - $this->global['pageTitle'] = 'Siddharth : Edit Import Purchase order form'; - $this->loadViews("editImportAmendPO", $this->global, $data, NULL); + + } + else if($CapitalRange=='1'){ + $data['CurrencyDetail']=''; + + $data['ExchangeRate']=$exRate; + + $data['Currency']=$this->purchaseorder_model->GetCurrencytype(); + + } + + + $this->global['pageTitle'] = 'Siddharth : Edit Capital Purchase order form'; + $this->loadViews("editCapitalAmendPO", $this->global, $data, NULL); } } @@ -165,11 +226,12 @@ class amendmentpurchaseorder extends BaseController { $NewPO='0'; $PONO =$this->input->post('txtPONO'); - // echo "OLD PO IS" . $PONO; + //echo "OLD PO IS" . $PONO; $POdt =$this->input->post('PODate'); $PODate = $this->getDateformat($POdt); $SupplierID = $this->input->post('drpSupplier'); + $POType = $this->input->post('POType'); $DeliveryAddr = $this->input->post('txtDeliveryAddress'); $dt = $this->input->post('Deliverydt'); //$Deliverydt = $this->getDateformat($dt); @@ -208,6 +270,7 @@ class amendmentpurchaseorder extends BaseController $updatedBy = $this->session->userdata ( 'userId' ); $RowCount = $this->input->post('txtRowCount'); + //echo $RowCount; //$DeletedRow = $this->input->post('txtDeletedRow'); @@ -217,8 +280,9 @@ class amendmentpurchaseorder extends BaseController $updateddt = $dt->format('Y-m-d H:i:s'); // PO Master // PO Master - $POMaster = array('ParentPO'=>$PONO,'SupplierID'=>$SupplierID,'PaymentTerms'=> $PaymentTerms,'PayableAT'=>$PayableAT,'PaymentDays'=>$PaymentDays,'TotalOrderValue'=>$TotalOrderValueSummary,'PODate'=>$PODate,'Status'=>'ST015','DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'ServiceDescription'=>$SpcialInstruction,'CreatedBy'=>$updatedBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'UpdatedOn'=>$updateddt ); - + $POMaster = array('ParentPO'=>$PONO,'SupplierID'=>$SupplierID,'POType'=>$POType,'PaymentTerms'=> $PaymentTerms,'PayableAT'=>$PayableAT,'PaymentDays'=>$PaymentDays,'TotalOrderValue'=>$TotalOrderValueSummary,'PODate'=>$PODate,'Status'=>'ST015','DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'ServiceDescription'=>$SpcialInstruction,'CreatedBy'=>$updatedBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'UpdatedOn'=>$updateddt ); + //print_r($POMaster); + //$POMaster = $this->purchaseorder_model->updatePOMaster($PONO,$POList); $LastPO = $this->purchaseorder_model->addPOMaster($POMaster); foreach($LastPO as $PO): @@ -228,7 +292,7 @@ class amendmentpurchaseorder extends BaseController //echo ""; //change old po status as Amendment $PODetail=array('Status'=>"ST030");//TO SET PARENT PO AS AMENDMENT STATUS - print_r($PODetail); + //print_r($PODetail); $APO=$this->purchaseorder_model->updateAmendPOMaster($PONO,$PODetail); echo $APO."Affected"; //die(); @@ -240,11 +304,11 @@ class amendmentpurchaseorder extends BaseController //echo 'before for loop'; - echo $RowCount; + //echo $RowCount; for ($i = 1; $i <= $RowCount; $i++) { - echo "inside loop"; + //echo "inside loop"; $MaterialCode = $this->input->post('materialCode'.$i); $Quantity = $this->input->post('quantity'.$i); $Reqnumber = $this->input->post('Reqnumber'.$i); @@ -300,16 +364,19 @@ class amendmentpurchaseorder extends BaseController // if(strlen($POLineItemNo) == 0) // { $POLineItemList = array('PONO'=>$NewPO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'CreatedBy'=>$updatedBy,'CreatedDate'=>$updateddt,'CostCenterCode'=>$CostCenter); - print_r($POLineItemList); + //print_r($POLineItemList); //die(); $POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList); + //print_r($POLineItem); // if(count($POLineItem)>0) // { foreach($POLineItem as $line): - $LineItemNo = $line->LineItemNo; + $LineItemNo = $line['LineItemNo']; endforeach; + //echo "Lineitem no is" . $LineItemNo; + //print_r($LineItemNo); // } @@ -329,7 +396,7 @@ class amendmentpurchaseorder extends BaseController $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'=>$updatedBy,'CreatedDate'=>$updateddt); $RevenueList = $this->purchaseorder_model->addRevenueTax($RevenueTaxList); - echo "DONE ALL"; + //echo "DONE ALL"; // } // else @@ -468,7 +535,7 @@ function UpdateAmendServicePurchaseOrder() // if(count($POLineItem)>0) // { foreach($POLineItem as $line): - $LineItemNo = $line->LineItemNo; + $LineItemNo = $line['LineItemNo']; endforeach; // echo " Last Lineitem no is" . $LineItemNo; @@ -518,7 +585,433 @@ function UpdateAmendServicePurchaseOrder() } + function EditAmendCapitalPurchaseOrder() + { + + // echo "WELCOME-"; + $PONO =$this->input->post('txtPONO'); + //echo $PONO; + + + $POdt =$this->input->post('PODate'); + $PODate = $this->getDateformat($POdt); + $SupplierID = $this->input->post('drpSupplier'); + $DeliveryAddr = $this->input->post('DeliveryAddr'); + $dt = $this->input->post('Deliverydt'); + + $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 = ''; + } + + $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'); + $ExchangeRate=$this->input->post('ExchangeRt'); + } + $PaymentMethod = $this->input->post('PaymentMethod'); + $PayableAT = $this->input->post('PayableAT'); + + + $PaymentDate=$this->input->post('PaymentDate'); + $SpcialInstruction = $this->input->post('txtSpcialInstruction'); + $TotalOrder = $this->input->post('CapitalToatlOrder'); + $POStatus = $this->input->post('txtStatus'); + + + $CreateBy = $this->session->userdata ( 'userId' ); + $RowCount = $this->input->post('txtRowCount'); + //echo $RowCount; + + //$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'); + $updateddt = $dt->format('Y-m-d H:i:s'); + + $POMaster = array('ParentPO'=>$PONO,'SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrder,'POType'=>$POType,'PODate'=>$PODate,'Status'=>$POStatus,'PORange'=>$PoRange,'ExchangeRate'=>$ExchangeRate,'ExchangeRateCalculatedon'=>$ExchangeRateOn,'PaymentTerms'=>$PaymentMethod,'PaymentDays'=>$PaymentDate,'PayableAt'=>$PayableAT,'ServiceDescription'=>$SpcialInstruction,'CreatedBy'=>$CreateBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'CreatedDate'=>$createddt,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'CurrencyType'=>$currencytypeID); + //print_r($POMaster); + + $LastPO = $this->purchaseorder_model->addPOMaster($POMaster); + foreach($LastPO as $PO): + $NewPO=$PO['PONO']; + endforeach; + //echo "NEW PO IS " . $NewPO."
"; + //echo ""; + + $PODetail=array('Status'=>"ST030");//TO SET PARENT PO AS AMENDMENT STATUS + //print_r($PODetail); + $APO=$this->purchaseorder_model->updateAmendPOMaster($PONO,$PODetail); + // echo $APO."Affected
"; + + $LineItemStatus = REQITEM_NEW; + + + + //echo "Before Loopp"; + + for ($i = 1; $i <= $RowCount; $i++) + { + //echo "Inside Loopp"; + $MaterialCode = $this->input->post('materialCode'.$i); + $Quantity = $this->input->post('quantity'.$i); + $Reqnumber = $this->input->post('Reqnumber'.$i); + $itemRate = $this->input->post('itemRate'.$i); + + $Exchangerate = $this->input->post('echangeRate'.$i); + $BasicPriceinmton = $this->input->post('rateInUs'.$i); + $Productprice = $this->input->post('basicvalInINR'.$i); + $LandingCharge = $this->input->post('beforeLanding'.$i); + $AfterLandingCharge = $this->input->post('landingCharge'.$i); + $HighSeas = $this->input->post('beforeHighSeasSalesCharge'.$i); + $AfterHighSeas = $this->input->post('HighSeasSalesCharge'.$i); + + $CustomDuty = $this->input->post('beforeCustomDuty'.$i); + $AfterCustomDuty = $this->input->post('CustomDuty'.$i); + + $ExciseDuty = $this->input->post('beforeExciseDuty'.$i); + $AfterExciseDuty = $this->input->post('ExciseDuty'.$i); + $ExciseDutyEd = $this->input->post('beforeExciseDutyEDCess'.$i); + $AfterExciseDutyEd = $this->input->post('ExciseDutyEDCess'.$i); + + $ExciseDutySH = $this->input->post('beforeExciseDutySHCess'.$i); + $AfterExciseDutySH = $this->input->post('ExciseDutySHCess'.$i); + + $CustomEd= $this->input->post('beforeCustomEDCess'.$i); + $AfterCustomEd= $this->input->post('CustomEDCess'.$i); + + $CustomSH = $this->input->post('beforeCustomSHCess'.$i); + $AfterCustomSH = $this->input->post('CustomSHCess'.$i); + + $AddAdtional = $this->input->post('beforeAdditionalExciseDuty'.$i); + $AfterAddAdtional = $this->input->post('AdditionalExciseDuty'.$i); + + $Grossdutypayable = $this->input->post('GrossDutyPayable'.$i); + $AvailableModvat = $this->input->post('AvailableModvat'.$i); + $Grossexpensesduetocustomduty = $this->input->post('GrossExpensesDuetoCustom'.$i); + $purchaseratePerKG = $this->input->post('purchaseRate'.$i); + $CustomDutyExpensesPerKG = $this->input->post('CustomDutyExpenses'.$i); + $RMCIncludingCustomersPerKG = $this->input->post('RMCIncludingCustomers'.$i); + $QuantityKG = $this->input->post('PurQuantity'.$i); + + + $Totalvalueitem=$this->input->post('PerKgExpense'.$i); + + //echo $BasicPriceinmton; + $CostCenter = $this->input->post('CPCostCode'.$i); + $ServiceTax = $this->input->post('AfterServiceTax'.$i); + $EduCess = $this->input->post('AfterEduCess'.$i); + $SecHighTax = $this->input->post('AfterSecHighTax'.$i); + $KrishiTax = $this->input->post('AfterKrishiTax'.$i); + $SwachhTax = $this->input->post('AfterSwachhTax'.$i); + + + $TotalOrderValue = $this->input->post('TotalOrderValue'.$i); + $POLineItemNo = $this->input->post('LineItemNo'.$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") + // { + // if(strlen($POLineItemNo) == 0) + // { + $POLineItemList = array('PONO'=>$NewPO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'CostCenterCode'=>$CostCenter); + + $POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList); + + $LineItemNo = ''; + // if(count($POLineItem)>0) + // { + foreach($POLineItem as $line): + $LineItemNo = $line['LineItemNo']; + endforeach; + //echo $LineItemNo; + //} + //echo $LineItemNo; + + if(trim($POType) == CAPITAL ) + { + $ServiceTaxList = array('LineItemNo'=>$LineItemNo, 'ServiceTax'=>$ServiceTax,'EducessTax'=>$EduCess,'SecHigherEducessTax'=>$SecHighTax,'KrishiKalyantax'=>$KrishiTax,'SwachhBharattax'=>$SwachhTax,'TotalValue'=>$TotalOrderValue, 'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt); + + $ServiceTax = $this->purchaseorder_model->addServiceTax($ServiceTaxList); + //echo "Service"; + //print_r($ServiceTax); + $ImportTaxList = array('LineItemNo'=>$LineItemNo, 'BasicPriceInMTon'=>$BasicPriceinmton,'ProductPrice'=>$Productprice,'LandingCharge'=>$LandingCharge,'AfterLandingCharge'=>$AfterLandingCharge,'AfterHighSeasSalesCharge'=>$AfterHighSeas,'HighSeasSalesCharge'=>$HighSeas,'CustomDuty'=>$CustomDuty,'AfterCustomDuty'=>$AfterCustomDuty,'ExciseDuty'=>$ExciseDuty,'AfterExciseDuty'=>$AfterExciseDuty,'ExciseDutyEdCess'=>$ExciseDutyEd,'AfterExciseDutyEdCess'=>$AfterExciseDutyEd,'ExciseDutySHCess'=>$ExciseDutySH,'CustomEdCess'=>$CustomEd,'CustomSHCess'=>$CustomSH,'AddlExciseDuty'=>$AddAdtional,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'AfterExciseDutySHCess'=>$AfterExciseDutySH,'AfterAddlExciseDuty'=>$AfterAddAdtional,'Grossdutypayable'=>$Grossdutypayable,'AvailableModvat'=>$AvailableModvat,'Grossexpensesduetocustomduty'=>$Grossexpensesduetocustomduty,'purchaseratePerKG'=>$purchaseratePerKG,'CustomDutyExpensesPerKG'=>$CustomDutyExpensesPerKG,'RMCIncludingCustomersPerKG'=>$RMCIncludingCustomersPerKG,'QuantityKG'=>$QuantityKG,'AfterCustomSHCess'=>$AfterCustomSH,'AfterCustomEdCess'=>$AfterCustomEd,'TotalValue'=>$Totalvalueitem); + + //die(); + + + $ImportList = $this->purchaseorder_model->addImportTax($ImportTaxList); + //echo "Import"; + + //print_r($ImportList); + + } + + // } + // else + // { + // $LineItemNo = $POLineItemNo; + + + + // $POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'CostCenterCode'=>$CostCenter); + // $POLineItem = $this->purchaseorder_model->updatePOLineItem($PONO,$LineItemNo,$POLineItemList); + + // $ServiceTaxList = array('ServiceTax'=>$ServiceTax,'EducessTax'=>$EduCess,'SecHigherEducessTax'=>$SecHighTax,'KrishiKalyantax'=>$KrishiTax,'SwachhBharattax'=>$SwachhTax,'TotalValue'=>$TotalOrderValue, 'UpdateBY'=>$updatedBy,'UpdatedOn'=>$updateddt); + + // $ServiceTax = $this->purchaseorder_model->updateServiceTax($LineItemNo,$ServiceTaxList); + // $ImportTaxList = array('LineItemNo'=>$LineItemNo,'BasicPriceInMTon'=>$BasicPriceinmton,'ProductPrice'=>$Productprice,'LandingCharge'=>$LandingCharge,'AfterLandingCharge'=>$AfterLandingCharge,'AfterHighSeasSalesCharge'=>$AfterHighSeas,'HighSeasSalesCharge'=>$HighSeas,'CustomDuty'=>$CustomDuty,'AfterCustomDuty'=>$AfterCustomDuty,'ExciseDuty'=>$ExciseDuty,'AfterExciseDuty'=>$AfterExciseDuty,'ExciseDutyEdCess'=>$ExciseDutyEd,'AfterExciseDutyEdCess'=>$AfterExciseDutyEd,'ExciseDutySHCess'=>$ExciseDutySH,'CustomEdCess'=>$CustomEd,'CustomSHCess'=>$CustomSH,'AddlExciseDuty'=>$AddAdtional,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'AfterExciseDutySHCess'=>$AfterExciseDutySH,'AfterAddlExciseDuty'=>$AfterAddAdtional,'Grossdutypayable'=>$Grossdutypayable,'AvailableModvat'=>$AvailableModvat,'Grossexpensesduetocustomduty'=>$Grossexpensesduetocustomduty,'purchaseratePerKG'=>$purchaseratePerKG,'CustomDutyExpensesPerKG'=>$CustomDutyExpensesPerKG,'RMCIncludingCustomersPerKG'=>$RMCIncludingCustomersPerKG,'QuantityKG'=>$QuantityKG,'AfterCustomSHCess'=>$AfterCustomSH,'AfterCustomEdCess'=>$AfterCustomEd,'TotalValue'=>$Totalvalueitem); + // $ImportList= $this->purchaseorder_model->updateImportTax($LineItemNo,$ImportTaxList); + + // } + + // } + + } + + echo 'Purchase Order'.$PONO.'Amended Successfully! New PO Number Is: '.$NewPO ; + } + function EditAmendImportPO() + { + + $PONO =$this->input->post('txtPONO'); + //echo $PONO; + + $POdt = ''; + $createddt=''; + + $PODate = $this->getDateformat($POdt); + $SupplierID = $this->input->post('drpSupplier'); + $DeliveryAddr = $this->input->post('DeliveryAddr'); + $dt = $this->input->post('Deliverydt'); + $Deliverydt = $this->getDateformat($dt); + $POType = $this->input->post('POType'); + $PoRange = $this->input->post('txtPoRange'); + $DeliveryOption = $this->input->post('DateRange'); + + $Exchangerate=$this->input->post('ExchangeRate'); + $ExchangeRateCalculatedon=$this->input->post('Exchangerateon'); + $CurrencyType=$this->input->post('currencytype'); + + + if($DeliveryOption==1){ + $Deliverydt = ''; + $DeliverySchedule = $this->input->post('Scheduleby'); + } + else{ + $Deliverydt = $this->getDateformat($dt); + $DeliverySchedule = ''; + } + $PaymentDate=$this->input->post('Payment'); + if($PaymentDate==1) + { + $PaymentDays='After'; + } + else + { + $PaymentDays='Before'; + } + + $SpcialInstruction = $this->input->post('txtSpcialInstruction'); + $TotalOrder = $this->input->post('txtTotalorderValue'); + //echo "Total Order:".$TotalOrder; + $POStatus = $this->input->post('txtStatus'); + + $CreateBy = $this->session->userdata ( 'userId' ); + $RowCount = $this->input->post('txtRowCount'); + $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 "Row Count is:"; + //echo $RowCount; + + //$DeletedRow = $this->input->post('txtDeletedRow'); + + //$comma_separated = explode(':', $DeletedRow); + $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); + $updateddt = $dt->format('Y-m-d H:i:s'); + + $PaymentTerms=$this->input->post('PaymentTerms'); + $Payableat=$this->input->post('PayableAT'); + // 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,'DeliveryDate'=>$Deliverydt,'CreatedDate'=>$createddt,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'ExchangeRate'=>$Exchangerate,'ExchangeRateCalculatedon'=>$ExchangeRateCalculatedon,'CurrencyType'=>$CurrencyType,'PaymentTerms'=>$PaymentTerms,'PayableAT'=>$Payableat,'PaymentDays'=>$PaymentDays); + //echo $PONO; + //echo $TotalOrder; + //print_r($POMaster); + + + $LastPO = $this->purchaseorder_model->addPOMaster($POMaster); + foreach($LastPO as $PO): + $NewPO=$PO['PONO']; + endforeach; + // echo "NEW PO IS " . $NewPO."
"; + //echo ""; + + $PODetail=array('Status'=>"ST030");//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; + + + + //echo "Before Loop"; + for ($i = 1; $i <= $RowCount; $i++) + { + //echo "Inside Loop"; + $MaterialCode = $this->input->post('materialCode'.$i); + $Quantity = $this->input->post('quantity'.$i); + $Reqnumber = $this->input->post('Reqnumber'.$i); + $itemRate = $this->input->post('itemRate'.$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); + $AfterLandingCharge = $this->input->post('AfterLandingCharge'.$i); + $HighSeas = $this->input->post('HighSeasSalesCharge'.$i); + $AfterHighSeas = $this->input->post('AfterHighSeasSalesCharge'.$i); + + $CustomDuty = $this->input->post('CustomDuty'.$i); + $AfterCustomDuty = $this->input->post('AfterCustomDuty'.$i); + + $ExciseDuty = $this->input->post('ExciseDuty'.$i); + $AfterExciseDuty = $this->input->post('AfterExciseDuty'.$i); + $ExciseDutyEd = $this->input->post('ExciseDutyEdCess'.$i); + $AfterExciseDutyEd = $this->input->post('AfterExciseDutyEdCess'.$i); + + $ExciseDutySH = $this->input->post('ExciseDutySHCess'.$i); + $AfterExciseDutySH = $this->input->post('AfterExciseDutySHCess'.$i); + + $CustomEd= $this->input->post('CustomEdCess'.$i); + $AfterCustomEd= $this->input->post('AfterCustomEdCess'.$i); + + $CustomSH = $this->input->post('CustomSHCess'.$i); + $AfterCustomSH = $this->input->post('AfterCustomSHCess'.$i); + + $AddAdtional = $this->input->post('AddlExciseDuty'.$i); + $AfterAddAdtional = $this->input->post('AfterAddlExciseDuty'.$i); + + $Grossdutypayable = $this->input->post('Grossdutypayable'.$i); + $AvailableModvat = $this->input->post('AvailableModvat'.$i); + $Grossexpensesduetocustomduty = $this->input->post('Grossexpensesduetocustomduty'.$i); + $purchaseratePerKG = $this->input->post('purchaseratePerKG'.$i); + $CustomDutyExpensesPerKG = $this->input->post('CustomDutyExpensesPerKG'.$i); + $RMCIncludingCustomersPerKG = $this->input->post('RMCIncludingCustomersPerKG'.$i); + + $QuantityKG = $this->input->post('QuantityKG'.$i); + + + + //$POLineItemNo = $this->input->post('LineItemNo'.$i); + $CostCenter = $this->input->post('costCode'.$i); + + $Totalvalueitem=$this->input->post('txtTotalorderValue'); + $LineItemNo = ''; + + //$currencytypeID = $this->input->post('currencytype'); + // $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'=>$NewPO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'CostCenterCode'=>$CostCenter); + //print_r($POLineItemList); + + $POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList); + // // if(count($POLineItem)>0) + // // { + foreach($POLineItem as $line): + $LineItemNo = $line['LineItemNo']; + endforeach; + // //} + // echo "New Line Item is:".$LineItemNo; + + // } + // else + // { + // $LineItemNo = $POLineItemNo; + + // $POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'UpdateBY'=>$updatedBy,'UpdatedOn'=>$updateddt,'CostCenterCode'=>$CostCenter); + // $POLineItem = $this->purchaseorder_model->updatePOLineItem($PONO,$POLineItemNo,$POLineItemList); + + // } + // $isExists = $this->purchaseorder_model->LineItemExistsinImportTax($LineItemNo); + // if(count($isExists) == 0) + // { + + $ImportTaxList = array('LineItemNo'=>$LineItemNo,'BasicPriceInMTon'=>$BasicPriceinmton,'ProductPrice'=>$Productprice,'LandingCharge'=>$LandingCharge,'AfterLandingCharge'=>$AfterLandingCharge,'AfterHighSeasSalesCharge'=>$AfterHighSeas,'HighSeasSalesCharge'=>$HighSeas,'CustomDuty'=>$CustomDuty,'AfterCustomDuty'=>$AfterCustomDuty,'ExciseDuty'=>$ExciseDuty,'AfterExciseDuty'=>$AfterExciseDuty,'ExciseDutyEdCess'=>$ExciseDutyEd,'AfterExciseDutyEdCess'=>$AfterExciseDutyEd,'ExciseDutySHCess'=>$ExciseDutySH,'CustomEdCess'=>$CustomEd,'CustomSHCess'=>$CustomSH,'AddlExciseDuty'=>$AddAdtional,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'AfterExciseDutySHCess'=>$AfterExciseDutySH,'AfterAddlExciseDuty'=>$AfterAddAdtional,'Grossdutypayable'=>$Grossdutypayable,'AvailableModvat'=>$AvailableModvat,'Grossexpensesduetocustomduty'=>$Grossexpensesduetocustomduty,'purchaseratePerKG'=>$purchaseratePerKG,'CustomDutyExpensesPerKG'=>$CustomDutyExpensesPerKG,'RMCIncludingCustomersPerKG'=>$RMCIncludingCustomersPerKG,'QuantityKG'=>$QuantityKG,'AfterCustomSHCess'=>$AfterCustomSH,'AfterCustomEdCess'=>$AfterCustomEd,'TotalValue'=>$Totalvalueitem); + //print_r($ImportTaxList); + //die(); + $ImportList = $this->purchaseorder_model->addImportTax($ImportTaxList); + //echo "DONE ALL"; + //} + // else + // { + // $ImportTaxList = array('LineItemNo'=>$LineItemNo, 'ExchangeRate'=>$Exchangerate,'BasicPriceInMTon'=>$BasicPriceinmton,'ProductPrice'=>$Productprice,'LandingCharge'=>$LandingCharge,'AfterLandingCharge'=>$AfterLandingCharge,'AfterHighSeasSalesCharge'=>$AfterHighSeas,'HighSeasSalesCharge'=>$HighSeas,'CustomDuty'=>$CustomDuty,'AfterCustomDuty'=>$AfterCustomDuty,'ExciseDuty'=>$ExciseDuty,'AfterExciseDuty'=>$AfterExciseDuty,'ExciseDutyEdCess'=>$ExciseDutyEd,'AfterExciseDutyEdCess'=>$AfterExciseDutyEd,'ExciseDutySHCess'=>$ExciseDutySH,'CustomEdCess'=>$CustomEd,'CustomSHCess'=>$CustomSH,'AddlExciseDuty'=>$AddAdtional,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'AfterExciseDutySHCess'=>$AfterExciseDutySH,'AfterAddlExciseDuty'=>$AfterAddAdtional,'Grossdutypayable'=>$Grossdutypayable,'AvailableModvat'=>$AvailableModvat,'Grossexpensesduetocustomduty'=>$Grossexpensesduetocustomduty,'purchaseratePerKG'=>$purchaseratePerKG,'CustomDutyExpensesPerKG'=>$CustomDutyExpensesPerKG,'RMCIncludingCustomersPerKG'=>$RMCIncludingCustomersPerKG,'QuantityKG'=>$QuantityKG,'AfterCustomSHCess'=>$AfterCustomSH,'AfterCustomEdCess'=>$AfterCustomEd,'CurrencyType'=>$currencytypeID,'TotalValue'=>$Totalvalueitem); + + // //print_r($ImportTaxList); + // //die(); + // $this->purchaseorder_model->updateImportTax($LineItemNo,$ImportTaxList); + + // } + // } + + } + + echo 'Purchase Order'.$PONO.'Amended Successfully! New PO Number Is: '.$NewPO ; + } function getDateformat($Val) diff --git a/application/views/editCapitalPo.php b/application/views/editCapitalPo.php index d91007ff..8350c643 100755 --- a/application/views/editCapitalPo.php +++ b/application/views/editCapitalPo.php @@ -103,6 +103,7 @@ if(!empty($AvlBudAmt)) $AvlAmount = $AvlBudAmt; } + ?>
+ +
+
'form-label-left ImportPO ','name' => 'ImportPO','id' => 'ImportPO'); echo form_open($this->config->base_url().'/purchaseorder/addPO/',$attributes); ?> -
+
-

Siddharth Industries - Edit Import Purchase Order for Amendment

+

Siddharth Industries - Edit Import Purchase Order- - For Amendment

- - + + +
@@ -258,19 +329,9 @@ if(!empty($POMaster)) ?>
-
- Exchange Rate : -
- 'ExchangeRate','value' => set_value('ExchangeRate',$ExchangeRate),'id'=>'ExchangeRate', 'class' => 'form-control' ,'onkeypress'=>'return isNumberKey(event);','onchange'=>'USRate()'); - - echo form_input($data); - ?> -
- -
+
@@ -289,10 +350,11 @@ if(!empty($POMaster)) 'DeliveryAddr','value' => set_value('DeliveryAddr',$DeliveryAddress),'id'=>'DeliveryAddr', 'class' => 'form-control' ,'required' => 'true', 'rows' => '3', 'cols' => '40'); echo Form_textarea($data); - - ?> + ?>
+ +
-
+
+ + Select Delivery By
+ + + "DateRange", "id"=>"Date", "value"=>"0", 'checked'=>'checked')); ?>     + + "DateRange", "id"=>"Schedule", "value"=>"1")); ?> + + + +
+ + +

+ + + 'Deliverydt','value' => set_value('Deliverydt',$CurrentDate),'id'=>'Deliverydt', 'class' => 'form-control' ,'required' => 'true'); + echo form_input($data); + ?> + +
+ + +
+ +
+
+
+ +
+ +
+ 'Exchangerateon','value' => set_value('Exchangerateon',$CurrentDate),'id'=>'Exchangerateon', 'class' => 'form-control' ,'required' => 'true', 'onkeypress'=>'return false;'); + echo form_input($data); + ?> +
+
+
+ + +

+
+ 'ExchangeRate','value' => set_value('ExchangeRate',$ExchangeRate),'id'=>'ExchangeRate', 'class' => 'form-control' ,'onkeypress'=>'return isNumberKey(event);','onchange'=>'USRate()'); + echo form_input($data); + ?> +
+
+
'PODate','value' => set_value('PODate',$PODate),'id'=>'PODate', 'class' => 'form-control' ,'required' => 'true', 'onkeypress'=>'return false;'); + $data = array('name' => 'PODate','value' => set_value('PODate',$CurrentDate),'id'=>'PODate', 'class' => 'form-control' ,'required' => 'true', 'onkeypress'=>'return false;'); echo form_input($data); ?>
+
+
+
+
+ + Payment Details + +
+ + Payable Terms + +
-
- -
- 'Deliverydt','value' => set_value('Deliverydt',$Deliverydt),'id'=>'Deliverydt', 'class' => 'form-control' ,'required' => 'true', 'onkeypress'=>'return false;'); + + +
+ Payable AT + + 'PayableAT','value' => set_value('PayableAT',$PayableAT),'id'=>'PayableAT', 'class' => 'form-control' ,'required' => 'true'); echo form_input($data); ?> - - +
-
-
- + +
+ Payment Date
+ + + "Payment", "id"=>"Before", "value"=>"0", 'checked'=>set_radio('Payment', '0', TRUE))); ?>     + + "Payment", "id"=>"After", "value"=>"1", 'checked'=>set_radio('Payment', '1', FALSE))); ?> + + + +
+
@@ -335,7 +487,7 @@ if(!empty($POMaster))
-Add Line Item + @@ -473,7 +625,10 @@ if(!empty($POMaster))
- + + +

'Rate','value' => set_value('Rate'),'id'=>'Rate', 'class' => 'form-control' ,'onkeypress'=>'return isNumberKey(event);' ,'onchange'=>'Ratechange()' ); @@ -482,7 +637,11 @@ if(!empty($POMaster))
- + + + +

'imTotalAmount','value' => set_value('imTotalAmount'),'id'=>'imTotalAmount', 'class' => 'form-control' ,'readonly' => 'true'); @@ -497,7 +656,8 @@ if(!empty($POMaster))
- Basic Price in US $ per Ton : + +

@@ -510,7 +670,9 @@ if(!empty($POMaster))
- Exchange Rate : + + +

@@ -524,8 +686,8 @@ if(!empty($POMaster))
- Basic value in INR : - + +

@@ -1002,23 +1164,26 @@ if(!empty($POMaster))
'EditQuantity','value' => set_value('EditQuantity'),'id'=>'EditQuantity', 'class' => 'form-control' ,'onkeypress'=>'return isNumberKey(event);','onchange'=>'Ratechange(),ExceedEditQuantityCheck()'); + $data = array('name' => 'EditQuantity','value' => set_value('EditQuantity'),'id'=>'EditQuantity', 'class' => 'form-control' ,'onkeypress'=>'return isNumberKey(event);','onchange'=>'EditRatechange(),ExceedEditQuantityCheck()'); echo form_input($data); ?>
- + + +

'EditRate','value' => set_value('EditRate'),'id'=>'EditRate', 'class' => 'form-control' ,'onkeypress'=>'return isNumberKey(event);' ,'onchange'=>'Ratechange()' ); + $data = array('name' => 'EditRate','value' => set_value('EditRate'),'id'=>'EditRate', 'class' => 'form-control' ,'onkeypress'=>'return isNumberKey(event);' ,'onchange'=>'EditRatechange()' ); echo form_input($data); ?>
- + +

'imTotalAmount','value' => set_value('imTotalAmount'),'id'=>'imTotalAmount', 'class' => 'form-control' ,'readonly' => 'true'); @@ -1033,7 +1198,9 @@ if(!empty($POMaster))
- Basic Price in US $ per Ton : + + +

@@ -1060,9 +1227,9 @@ if(!empty($POMaster))
- Basic value in INR : - + +

'EditTotalExp','value' => set_value('TotalExp'),'id'=>'TotalExp', 'class' => 'form-control' ,'onkeypress'=>'return isNumberKey(event);','readonly'=>'true'); + $data = array('name' => 'EditTotalExp','value' => set_value('EditTotalExp'),'id'=>'EditTotalExp', 'class' => 'form-control' ,'onkeypress'=>'return isNumberKey(event);','readonly'=>'true'); echo form_input($data); ?>
@@ -1440,8 +1607,8 @@ if(!empty($POMaster))
- - + @@ -1465,14 +1632,15 @@ if(!empty($POMaster)) - - + - -" /> + + + @@ -1552,14 +1720,14 @@ if(!empty($POMaster)) - + // } else {?> + AvailableModvat; $totgrossexpense=$totgrossexpense+$record->Grossexpensesduetocustomduty; $ExchangeRate=$record->ExchangeRate; - $totorder=$totorder+$record->TotalOrderValue; - + $totorder=$totorder+$record->BasicPriceInMTon; + //alert($totorder); } @@ -1712,9 +1880,9 @@ if(!empty($POMaster))
- Total Order Value : --> 'txtToatlOrder','value' => set_value('txtToatlOrder',$totorder),'id'=>'txtToatlOrder', 'class' => 'form-control' ,'required' => 'true','readonly' => 'true'); - echo form_input($data); + // echo form_input($data); ?>
@@ -1723,8 +1891,8 @@ if(!empty($POMaster))
- 'txtSpcialInstruction','value' => set_value('txtSpcialInstruction'),'id'=>'txtSpcialInstruction', 'class' => 'form-control','rows' => '3', 'cols' => '40' ); + 'txtSpcialInstruction','value' => set_value('txtSpcialInstruction'),'id'=>'txtSpcialInstruction', 'class' => 'form-control','rows' => '10', 'cols' => '40' ); echo form_textarea($data); ?>
@@ -1735,23 +1903,47 @@ if(!empty($POMaster)) - - + + - - -   Save + +   Submit - - + +

- +
+
+ Request On + 'Requeston','value' => set_value('Requeston',$Reqon),'id'=>'Requeston', 'class' => 'form-control num' ,'required' => 'true', 'onkeypress'=>'return false;'); + echo form_input($data); + ?> +
+
+ Request By + 'RequestBy','value' => set_value('RequestBy',$RequesterName),'id'=>'RequestBy', 'class' => 'form-control' ,'required' => 'true'); + echo form_input($data); + ?> +
+
+ Status + $PONOStatus); + // echo form_dropdown('Status', $options,set_value('Status',$POStatus),'id="Status"' ,'required="true"' ,'class="form-control select2') + + $data = array('name' => 'Status','value' => set_value('Status',$StatusName),'id'=>'Status', 'class' => 'form-control' ,'readonly' => 'true'); + echo form_input($data); + ?> +

+
@@ -1767,11 +1959,11 @@ if(!empty($POMaster))
- - + @@ -1795,23 +1987,65 @@ var NilType = ''; Mat: [] }; -$('#ExchangeRate').val(); + +var paymentday=; +if (paymentday=="After") +{ + + document.getElementById("After").checked = true; +} +else +{ + document.getElementById("Before").checked = true; +} + + $('#EditAvlBudAmt').val(); + var txtexchangerate=parseFloat($('#ExchangeRate').val()); $('#EditExchangeRt').val(txtexchangerate); var txtbasics=parseFloat($('#BasicPriceInMTon').val()); -//alert(txtexchangerate); -//alert(txtbasics); + var basicpriceinus=parseFloat($('#BasicPriceinUS').val()); var txtbasic=txtexchangerate*basicpriceinus; -//alert(txtbasic); + $('#EditINRBasicvalue').val(txtbasic); +$('#currencytype').change(function() +{ + + var id = $('#currencytype').val(); + + var symbol=; + + $.each(symbol,function(idx,obj) + { + + if(obj.Currency_Code==id) + { + var sign=obj.FontCode2000; + var code=obj.Currency_Code; + + document.getElementById("label1").innerHTML ='Exchange Rate in '+code+'('+sign+')'; + document.getElementById("label2").innerHTML ='Basic Value in '+code+'('+sign+')'; + document.getElementById("label3").innerHTML ='Basic Value in '+code+'('+sign+')'; + document.getElementById("labelRate").innerHTML ='Rate in '+code+'('+sign+')'; + document.getElementById("labelBasicpriceus").innerHTML ='Basic Price In '+code+'('+sign+')'+' per Ton'; + document.getElementById("labelBasicINR").innerHTML ='Basic Price in INR:'+code+'('+sign+')'; + document.getElementById("labelEditRate").innerHTML ='Rate in '+sign; + document.getElementById("labelEditBasicPriceUs").innerHTML ='Basic Price In '+code+'('+sign+')'+' per Ton'; + document.getElementById("labelEditBasicINR").innerHTML ='Basic Price in INR:'+code+'('+sign+')'; + } + + }); + +}); + $('#drpSupplier').change(function() { @@ -1828,6 +2062,18 @@ $('#drpSupplier').change(function() { if(obj.SupplierID === id) { $("#SupAddress").val(obj.Address); + $("#PayableAT").val(obj.PayableAT); + var a=obj.PaymentDays; + console.log(a); + if (a=="After") + { + //alert(); + document.getElementById("After").checked = true; + + } + else + document.getElementById("Before").checked = true; + } @@ -1972,8 +2218,7 @@ $("#txtBasicValue").val(''); function USRate() { - //if($('#imBasicPrice').val() != '' && $('#ExchangeRate').val() != '') - //{ + var txtbasics=parseFloat($('#imBasicPrice').val()); var txtexchangerate=parseFloat($('#ExchangeRate').val()); $('#ExchangeRt').val(txtexchangerate); @@ -1981,9 +2226,8 @@ function USRate() $('#INRBasicvalues').val(txtINRvalue) $('#INRBasicvalue').val(txtINRvalue); $('#BasicPriceTax').val(txtINRvalue); - //txtINR = Math.ceil(txtINR*10)/10; + txtINR = Math.round(txtINRvalue); - //alert(txtINR);BasicPriceTax $('#AfterBasicPriceTax').val(txtINR); $('#imBasicPrice').val(txtbasics); @@ -1994,7 +2238,22 @@ function USRate() $('#EditINRBasicvalue').val(txtINRvalue); - //} + +} + +function EditRatechange() +{ + var txteditQuantity=parseFloat($('#EditQuantity').val()); + var txteditUnitPrice=parseFloat($('#EditRate').val()); + var editTot=txteditQuantity*txteditUnitPrice + $('#EdittxtBasicValue').val(editTot); + $(EditimBasicPrice).val(editTot); + var exchangerate=parseFloat($('#EditExchangeRt').val()); + var txtINR=editTot*exchangerate; + $('#EditINRBasicvalue').val(txtINR); + $('#EditBasicPriceTax').val(txtINR); + $('#EditAfterBasicPriceTax').val(txtINR); + EditCalculateloadingcharge(); } @@ -2554,7 +2813,7 @@ function CalculateaddlExciseDuty() customsh=parseFloat($('#AfterCustomSHcess').val()); totaddtnlexcise=basic+landingcha+highsesssalless+customcha+excisecha+exciseedcha+exciseshcha+customed+customsh; addtnpercentage=parseFloat($('#AdditionalExciseduty').val()); - // var txtaddtnexciseduty=(totaddtnlexcise*addtnpercentage)/100; + txtaddtnexciseduty=; if(isNaN(txtaddtnexciseduty)) { @@ -2796,14 +3055,9 @@ function CalculateCtable() $('#RMCIncludingCustomers').val(Math.round(txtrmc)); } total=; - if(isNaN(total)) - { - $('#TotalExp').val(''); - } - else - { - $('#TotalExp').val(Math.round(total)); - } + + $('#TotalExp').val(Math.round(basicamt)); + } @@ -2821,6 +3075,10 @@ function EditCalculateCtable() var total=0; var basicamt=0; basicamt=parseFloat($('#EdittxtBasicValue').val()); + $('#EditTotalExp').val(basicamt); + var a=parseFloat($('#EditTotalExp').val()); + //console.log(a); + //alert(basicamt); txtCtablequantity=parseFloat($('#EditPurQuantity').val()); txtbasicinrprice=parseFloat($('#EditAfterBasicPriceTax').val()); //txtpurchaserate=txtbasicinrprice/txtCtablequantity; @@ -2836,155 +3094,11 @@ function EditCalculateCtable() txtrmc=; $('#EditRMCIncludingCustomers').val(txtrmc); total=; - $('#EditTotalExp').val(total); + $('#EditTotalExp').val(basicamt); + //var a=parseFloat($('#EditTotalExp').val()); + //console.log(basicamt); +} -} - - - -$('.AddImport').click(function() -{ - - //alert('out'); - if(validateImport()) - { - //alert('in'); - - var temp = index; - //alert('in'); - var Reqnumber = $('#ReqNo').val(); - //alert(JSON.strigify(Reqnumber)); - var departmentName =$('#deptName').val(); - var AvilBudget = $('#AvlBudAmt').val(); - var costCode = $('#CostCenter').val(); - var materialCode =$('#MaterialCode').val(); - var materialName = $("#ItemName").val(); - var uom = $("#UOM").val(); - var quantity = $("#Quantity").val(); - var itemRate = $("#Rate").val(); - var BasicAmt=parseFloat($("#txtBasicValue").val()); - var taxamt=parseFloat($("#RMCIncludingCustomers").val()); - var totalexp=parseFloat($("#TotalExp").val()); - var Exchangerate=parseFloat($("#ExchangeRt").val()); - var Basicpriceinus=parseFloat($("#imBasicPrice").val()); - - var BasicPrice=$("#BasicPriceTax").val(); - var AfterBasicPrice=parseFloat($("#AfterBasicPriceTax").val()); - var LandingChargee=$("#LandingCharge").val(); - var AfterLandingChargee=$("#AfterLandingCharge").val(); - var Highseass=$("#Highseas").val(); - var AfterHighseass=$("#AfterHighseas").val(); - //var AfterHighseass=($"#AfterHighseas").val(); - var CustomDutyy=$("#Customduty").val(); - var AfterCustomDutyy=$("#AfterCustomduty").val(); - - var ExciseDutyy=$("#ExcisedutyTax").val(); - var AfterExciseDutyy=$("#AfterExcisedutyTax").val(); - var ExciseDutyEd=$("#ExcisedutyEDcess").val(); - var AfterExciseDutyEd=$("#AfterExcisedutyEDcess").val(); - var ExciseDutySH=$("#ExcisedutySHcess").val(); - var AfterExciseDutySH=$("#AfterExcisedutySHcess").val(); - var CustomED=$("#CustomEDcess").val(); - var AfterCustomED=$("#AfterCustomEDcess").val(); - var CustomSH=$("#CustomSHcess").val(); - var AfterCustomSH=$("#AfterCustomSHcess").val(); - var AdditnlExcise=$("#AdditionalExciseduty").val(); - var AfterAdditnlExcise=$("#AfterAdditionalExciseduty").val(); - var GrossDuty=$("#Grossdutypayable").val(); - var Avlmodvat=$("#AvailableModvat").val(); - var Grossexpenseduetocustom=$("#Grossexpenses").val(); - var PurchaseQuantity=$("#PurQuantity").val(); - var purate=$("#purchaserate").val(); - var CustomDutyExpense=$("#CustomDutyExpenses").val(); - var RMCIncluderate=$("#RMCIncludingCustomers").val(); - $('#MaterialCode option[value='+materialCode+']').remove(); - - - $('#MaterialCode option[value='+materialCode+']').remove(); - SelectedMaterialCode[CollIndex] = materialCode; - CollIndex = CollIndex + 1; - - SelectedMaterialList.Mat.push({ - "materialCode" : materialCode, - "ReqNo" : Reqnumber, - - }); - - - - populateValueMainFormForImportTax(); - - index = parseInt(index)+1; - //alert('in'); - var template = jQuery("#ImportList").html(); - $('#ImportAppend').append(_.template(template,{index:temp,ReqNo:Reqnumber,ItemName:materialName,Quantity:quantity,UOM:uom,Rate:itemRate,BasicAmount:BasicAmt,Taxvalue:taxamt,TotalValue:totalexp})); - //alert(JSON.strigify(BasicAmt)); - - - //$('#ImportAppend').append(_.template(template,{index:temp,ReqNo:Reqnumber,ItemName:materialName,Quantity:quantity,UOM:uom,Rate:itemRate,BasicAmount:BasicAmt,Taxvalue:taxamt,TotalValue:totalexp})); - //clearTaxField(); - - //from above defined variables - - var theForm = $(".ImportPO"); - - addHidden(theForm,"Reqnumber"+temp,Reqnumber ); - addHidden(theForm,"departmentName"+temp,departmentName ); - addHidden(theForm,"AvilBudget"+temp,AvilBudget ); - addHidden(theForm,"costCode"+temp,costCode ); - addHidden(theForm,"materialCode"+temp,materialCode ); - addHidden(theForm,"materialName"+temp,materialName ); - addHidden(theForm,"uom"+temp,uom); - addHidden(theForm,"quantity"+temp,quantity); - addHidden(theForm,"itemRate"+temp,itemRate); - addHidden(theForm,"BasicAmt"+temp,BasicAmt); - addHidden(theForm,"taxamt"+temp,taxamt); - addHidden(theForm,"Exchangerate"+temp,Exchangerate); - addHidden(theForm,"BasicPriceTax"+temp,BasicPriceTax); - addHidden(theForm,"BasicPriceinUS"+temp,Basicpriceinus); - addHidden(theForm,"AfterBasicPriceTax"+temp,AfterBasicPrice); - addHidden(theForm,"LandingChargee"+temp,LandingChargee); - addHidden(theForm,"AfterLandingChargee"+temp,AfterLandingChargee); - addHidden(theForm,"Highseass"+temp,Highseass); - addHidden(theForm,"AfterHighseass"+temp,AfterHighseass); - addHidden(theForm,"Customduty"+temp,CustomDutyy); - addHidden(theForm,"AfterCustomduty"+temp,AfterCustomDutyy); - addHidden(theForm,"ExcisedutyTax"+temp,ExciseDutyy); - addHidden(theForm,"AfterExcisedutyTax"+temp,AfterExciseDutyy); - addHidden(theForm,"ExcisedutyED"+temp,ExciseDutyEd); - addHidden(theForm,"AfterExcisedutyED"+temp,AfterExciseDutyEd); - addHidden(theForm,"ExcisedutySH"+temp,ExciseDutySH); - addHidden(theForm,"AfterExcisedutySH"+temp,AfterExciseDutySH); - addHidden(theForm,"CustomEDcess"+temp,CustomED); - addHidden(theForm,"AfterCustomEDcess"+temp,AfterCustomED); - addHidden(theForm,"CustomSHcess"+temp,CustomSH); - addHidden(theForm,"AfterCustomSHcess"+temp,AfterCustomSH); - addHidden(theForm,"AdditionalExciseduty"+temp,AdditnlExcise); - addHidden(theForm,"AfterAdditionalExciseduty"+temp,AfterAdditnlExcise); - addHidden(theForm,"Grossdutypayable"+temp,GrossDuty); - addHidden(theForm,"Grossexpenses"+temp,Grossexpenseduetocustom); - addHidden(theForm,"PurQuantity"+temp,PurchaseQuantity); - addHidden(theForm,"purchaserate"+temp,purate); - addHidden(theForm,"CustomDutyExpenses"+temp,CustomDutyExpense); - addHidden(theForm,"RMCIncludingCustomers"+temp,RMCIncluderate); - addHidden(theForm,"AvilableModvat"+temp,Avlmodvat); - addHidden(theForm,"TotalExp"+temp,totalexp); - addHidden(theForm,"TotalitemExp"+temp,TotalValue); - // alert(JSON.stringify(totalexp)); - - - - - // addHidden(theForm,"AfterBasicPriceTax"+temp,AfterBasicPriceTax); - //addHidden(theForm,"AfterBasicPriceTax"+temp,AfterBasicPriceTax); - $('#txtRowCount').val(temp); - clearTaxField(); - - - } - - -}); function validateImport() @@ -3035,15 +3149,6 @@ function validateImport() } -function addHidden(theForm, key, value) { - // Create a hidden input element, and append it to the form: - var input = document.createElement('input'); - input.type = 'hidden'; - input.name = key;'name-as-seen-at-the-server'; - input.id = key;'name-as-seen-at-the-server'; - input.value = value; - theForm.append(input); -} @@ -3078,6 +3183,8 @@ var TotalGrossDuty=$('#txttotalgrossduty').val()==''?'0.00':$('#txttotalgrossdut var TotalAvlmodvat=$('#txttotalavlmodvat').val()==''?'0.00':$('#txttotalavlmodvat').val(); var TotalGrossExpense=$('#txttotalgrossexpense').val()==''?'0.00':$('#txttotalgrossexpense').val(); var TotalOrder=$('#txtToatlOrder').val()==''?'0.00':$('#txtToatlOrder').val(); + + $('#txttotallanding').val((parseFloat(AfterLandingCharge) + parseFloat(TotalLanding)).toFixed(2) ); $('#txttotalhighseas').val((parseFloat(TotalHighseas) + parseFloat(AfterHighseas)).toFixed(2) ); $('#txttotalcustom').val((parseFloat(TotalCustom) + parseFloat(AfterCustomduty)).toFixed(2) ); @@ -3091,63 +3198,32 @@ $('#txttotalgrossduty').val((parseFloat(TotalGrossDuty) + parseFloat(Grossdutypa $('#txttotalavlmodvat').val((parseFloat(TotalAvlmodvat) + parseFloat(AvailableModvat)).toFixed(2) ); $('#txttotalgrossexpense').val((parseFloat(TotalGrossExpense) + parseFloat(Grossexpenses)).toFixed(2) ); $('#txtToatlOrder').val((parseFloat(TotalOrder) + parseFloat(totalexp)).toFixed(2) ); -//alert(JSON.stringify(totalexp)); -alert(TotalOrder); + } -function clearTaxField() -{ - //$('#AfterBasicPriceTax').val(''); - $('#AfterLandingCharge').val(''); - $('#LandingCharge').val(''); - $('#AfterHighseas').val(''); - $('#Highseas').val(''); - $('#AfterCustomduty').val(''); - $('#Customduty').val(''); - $('#AfterExcisedutyTax').val(''); - $('#ExcisedutyTax').val(''); - $('#AfterExcisedutyEDcess').val(''); - $('#ExcisedutyEDcess').val(''); - $('#AfterExcisedutySHcess').val(''); - $('#ExcisedutySHcess').val(''); - $('#AfterCustomEDcess').val(''); - $('#CustomEDcess').val(''); - $('#AfterCustomSHcess').val('') - $('#CustomSHcess').val(''); - $('#AfterCustomSHcess').val(''); - $('#AfterAdditionalExciseduty').val(''); - $('#AdditionalExciseduty').val(''); - $('#Grossdutypayable').val(''); - $('#AvailableModvat').val(''); - $('#Grossexpenses').val(''); - $('#PurQuantity').val(''); - $('#purchaserate').val(''); - $('#CustomDutyExpenses').val(''); - $('#RMCIncludingCustomers').val(''); -} $("#editimportpomodel").on("shown.bs.modal", function(e) { + userid = $(e.relatedTarget).data('userid'); - //alert(userid); - //alert('inadd'); + - var tr= document.getElementById(userid); - //alert(tr); + var tr = document.getElementById(userid); + var cellval = tr.cells; - //alert(cellval); + var id= $('#Reqnumber'+userid).val(); - //alert(id); + $('#EditReqNo').val($('#Reqnumber'+userid).val()); -//alert($('#Reqnumber'+userid).val()); - $('#EditdeptName').val($('#departmentName'+userid).val()); + + $('#EditdeptName').val($('#departmentName'+userid).val()); $("#EditCostCenter").val($('#costCode'+userid).val()); - // $('#EditAvlBudAmt').val($('#AvilBudget'+userid).val()); + $('#EditAvlBudAmt').val($('#AvilBudget'+userid).val()); $('#EditItemName').val($('#materialName'+userid).val()); $('#EditUOM').val($('#uom'+userid).val()); @@ -3187,7 +3263,7 @@ $("#editimportpomodel").on("shown.bs.modal", function(e) { $('#EditTotalExp').val($("#TotalValue"+userid).val()); $('#EditINRBasicvalue').val($("#BasicINRValue"+userid).val()); - $('#EditTotalOrderValue').val(cellval[8].innerHTML); + $('#EditTotalOrderValue').val(cellval[6].innerHTML); $("#EditMaterialCode").empty(); var Material = ; $("#EditMaterialCode").append( $('').val($('#materialCode'+userid).val()).html($('#materialCode'+userid).val() + "-" + $('#materialName'+userid).val() ) ); @@ -3243,7 +3319,7 @@ $('.EditImport').click(function(){ var editQuantity = $('#EditQuantity').val(); var itemRate = $("#EditRate").val(); var BasicValue=$("#EdittxtBasicValue").val(); - //var BasicValue=$("#EdittxtBasicValue").val(); + var BasicPrice=$("#EditBasicPriceTax").val(); var AfterBasicPrice=$("#EditAfterBasicPriceTax").val(); var Landingcharge=$("#EditLandingCharge").val(); @@ -3262,7 +3338,7 @@ $('.EditImport').click(function(){ var AfterCustomED=$("#EditAfterCustomEDcess").val(); var CustomSH=$("#EditCustomSHcess").val(); var AfterCustomSH=$("#EditAfterCustomSHcess").val(); - var AdditionalExciseduty=$("#EditAdditionalExciseduty ").val(); + var AdditionalExciseduty=$("#EditAdditionalExciseduty").val(); var AfterAdditionalExciseduty=$("#EditAfterAdditionalExciseduty").val(); var GrossDuty=$("#EditGrossdutypayable").val(); var AvailaleModvat=$("#EditAvailableModvat").val(); @@ -3272,8 +3348,7 @@ $('.EditImport').click(function(){ var CustomDutyExpense=$("#EditCustomDutyExpenses").val(); var RMC=$("#EditRMCIncludingCustomers").val(); var TotalExp=$('#EditTotalExp').val(); - - + var tr= document.getElementById(userid); var cellval = tr.cells; @@ -3284,15 +3359,16 @@ $('.EditImport').click(function(){ cellval[6].innerHTML =BasicValue; $('#materialCode'+userid).val(editMaterialCode); + $('#AvilBudget'+userid).val(AvilBudget); $('#materialName'+userid).val(edititemname); $('#uom'+userid).val(editUOM); - $('#Quantity'+userid).val(EditQuantity); - $('#itemRate'+userid).val(EditRate); - $('#BasicAmt'+userid).val(BasicValue); + $('#quantity'+userid).val(editQuantity); + $('#itemRate'+userid).val(itemRate); + $('#ProductPrice'+userid).val(BasicValue); $('#BasicPriceTax'+userid).val(BasicPrice); $('#AfterBasicPriceTax'+userid).val(AfterBasicPrice); - $('#LandingChargee'+userid).val(Landingcharge); - $('#AfterLandingChargee'+userid).val(AfterLanding); + $('#LandingCharge'+userid).val(Landingcharge); + $('#AfterLandingCharge'+userid).val(AfterLanding); $('#Highseass'+userid).val(Highseass); $('#AfterHighseass'+userid).val(AfterHighseas); $('#Customduty'+userid).val(CustomDuty); @@ -3307,8 +3383,8 @@ $('.EditImport').click(function(){ $('#AfterCustomEDcess'+userid).val(AfterCustomED); $('#CustomSHcess'+userid).val(CustomSH); $('#AfterCustomSHcess'+userid).val(AfterCustomSH); - $('#AdditionalExciseduty'+userid).val(AdditionalExciseduty); - $('#AfterAdditionalExciseduty'+userid).val(AfterAdditionalExciseduty); + $('#AddlExciseDuty'+userid).val(AdditionalExciseduty); + $('#AfterAddlExciseDuty'+userid).val(AfterAdditionalExciseduty); $('#Grossdutypayable'+userid).val(GrossDuty); $('#Grossexpenses'+userid).val(GrossExpense); $('#purchaserate'+userid).val(PurchaseRate); @@ -3337,6 +3413,7 @@ function populateValueMainFormForEditImportTax() var TotalGrossDuty=0; var TotalAvlmodvat=0; var TotalGrossExpense=0; + var totvalue = 0; var i = 0; var TotalRMC=0; do{ @@ -3346,21 +3423,25 @@ function populateValueMainFormForEditImportTax() { cells = tr.getElementsByTagName('td'); var rowid = cells[0].innerHTML; + var qty = $('#quantity'+userid).val(); + var rate = $('#itemRate'+userid).val(); + var total = parseFloat(qty) * parseFloat(rate); + +var AfterLandingCharge= $('#AfterLandingCharge'+rowid).val() == '' ? '0.00' : $('#AfterLandingCharge'+rowid).val(); +var AfterHighseas=$('#AfterHighSeasSalesCharge'+rowid).val()==''?'0.00':$('#AfterHighSeasSalesCharge'+rowid).val(); +var AfterCustomduty=$('#AfterCustomDuty'+rowid).val()==''?'0.00':$('#AfterCustomDuty'+rowid).val(); +var AfterExcisedutyTax=$('#AfterExciseDuty'+rowid).val()==''?'0.00':$('#AfterExciseDuty'+rowid).val(); +var AfterExcisedutyEDcess=$('#AfterExciseDutyEdCess'+rowid).val()==''?'0.00':$('#AfterExciseDutyEdCess'+rowid).val(); +var AfterExciseDutySH=$('#AfterExciseDutySHCess'+rowid).val()==''?'0.00':$('#AfterExciseDutySHCess'+rowid).val(); +var AfterAdditionalExciseduty=$('#AfterAddlExciseDuty'+rowid).val()==''?'0.00':$('#AfterAddlExciseDuty'+rowid).val(); +var AfterCustomEDcess=$('#AfterCustomEdCess'+rowid).val()==''?'0.00':$('#AfterCustomEdCess'+rowid).val(); +var AfterCustomSHcess=$('#AfterCustomSHCess'+rowid).val()==''?'0.00':$('#AfterCustomSHCess'+rowid).val(); +var AdditionalExciseduty=$('#AfterAddlExciseDuty'+rowid).val()==''?'0.00':$('#AfterAddlExciseDuty'+rowid).val(); +var Grossdutypayable=$('#Grossdutypayable'+rowid).val()==''?'0.00':$('#Grossdutypayable'+rowid).val(); +var AvailableModvat=$('#AvailableModvat'+rowid).val()==''?'0.00':$('#AvailableModvat'+rowid).val(); +var Grossexpenses=$('#Grossexpensesduetocustomduty'+rowid).val()==''?'0.00':$('#Grossexpensesduetocustomduty'+rowid).val(); +var RMC=$('#RMCIncludingCustomersPerKG'+rowid).val()==''?'0.00':$('#RMCIncludingCustomersPerKG'+rowid).val(); -var AfterLandingCharge= $('#AfterLandingCharge').val() == '' ? '0.00' : $('#AfterLandingCharge').val(); -var AfterHighseas=$('#AfterHighseas').val()==''?'0.00':$('#AfterHighseas').val(); -var AfterCustomduty=$('#AfterCustomduty').val()==''?'0.00':$('#AfterCustomduty').val(); -var AfterExcisedutyTax=$('#AfterExcisedutyTax').val()==''?'0.00':$('#AfterExcisedutyTax').val(); -var AfterExcisedutyEDcess=$('#AfterExcisedutyEDcess').val()==''?'0.00':$('#AfterExcisedutyEDcess').val(); -var AfterExciseDutySH=$("#AfterExcisedutySHcess").val()==''?'0.00':$('#AfterExcisedutySHcess').val(); -var AfterAdditionalExciseduty=$('#AfterAdditionalExciseduty').val()==''?'0.00':$('#AfterAdditionalExciseduty').val(); -var AfterCustomEDcess=$('#AfterCustomEDcess').val()==''?'0.00':$('#AfterCustomEDcess').val(); -var AfterCustomSHcess=$('#AfterCustomSHcess').val()==''?'0.00':$('#AfterCustomSHcess').val(); -var AdditionalExciseduty=$('#AdditionalExciseduty').val()==''?'0.00':$('#AdditionalExciseduty').val(); -var Grossdutypayable=$('#Grossdutypayable').val()==''?'0.00':$('#Grossdutypayable').val(); -var AvailableModvat=$('#AvailableModvat').val()==''?'0.00':$('#AvailableModvat').val(); -var Grossexpenses=$('#Grossexpenses').val()==''?'0.00':$('#Grossexpenses').val(); -var RMC=$('#RMCIncludingCustomers').val()==''?'0.00':$('#RMCIncludingCustomers').val(); TotalLanding = parseFloat(TotalLanding) + parseFloat(AfterLandingCharge); TotalHighseas = parseFloat(TotalHighseas) + parseFloat(AfterHighseas); TotalCustom = parseFloat(TotalCustom) + parseFloat(AfterCustomduty); @@ -3374,36 +3455,9 @@ TotalGrossDuty = parseFloat(TotalGrossDuty) + parseFloat(Grossdutypayable); TotalAvlmodvat = parseFloat(TotalAvlmodvat ) + parseFloat(AvailableModvat); TotalGrossExpense = parseFloat(TotalGrossExpense ) + parseFloat(Grossexpenses); //TotalRMC=parseFloat(TotalRMC)+parseFloat(RMC); - - - - var AfterLandingCharge= $('#AfterLandingCharge').val() == '' ? '0.00' : $('#AfterLandingCharge').val(); -var AfterHighseas=$('#AfterHighseas').val()==''?'0.00':$('#AfterHighseas').val(); -var AfterCustomduty=$('#AfterCustomduty').val()==''?'0.00':$('#AfterCustomduty').val(); -var AfterExcisedutyTax=$('#AfterExcisedutyTax').val()==''?'0.00':$('#AfterExcisedutyTax').val(); -var AfterExcisedutyEDcess=$('#AfterExcisedutyEDcess').val()==''?'0.00':$('#AfterExcisedutyEDcess').val(); -var AfterExciseDutySH=$("#AfterExcisedutySHcess").val()==''?'0.00':$('#AfterExcisedutySHcess').val(); -var AfterCustomEDcess=$('#AfterCustomEDcess').val()==''?'0.00':$('#AfterCustomEDcess').val(); -var AfterCustomSHcess=$('#AfterCustomSHcess').val()==''?'0.00':$('#AfterCustomSHcess').val(); -var AfterAdditionalExciseduty=$('#AfterAdditionalExciseduty').val()==''?'0.00':$('#AfterAdditionalExciseduty').val(); -var Grossdutypayable=$('#Grossdutypayable').val()==''?'0.00':$('#Grossdutypayable').val(); -var AvailableModvat=$('#AvailableModvat').val()==''?'0.00':$('#AvailableModvat').val(); -var Grossexpenses=$('#Grossexpenses').val()==''?'0.00':$('#Grossexpenses').val(); -var totalexp=$('#TotalExp').val()==''?'0.00':$('#TotalExp').val(); -var TotalLanding=$('#txttotallanding').val()==''?'0.00':$('#txttotallanding').val(); -var TotalHighseas=$('#txttotalhighseas').val()==''?'0.00':$('#txttotalhighseas').val(); -var TotalCustom=$('#txttotalcustom').val()==''?'0.00':$('#txttotalcustom').val(); -var TotalExcise=$('#txttotalexcise').val()==''?'0.00':$('#txttotalexcise').val(); -var TotalExciseED=$('#txttotalexciseED').val()==''?'0.00':$('#txttotalexciseED').val(); -var TotalExciseSH=$('#txttotalexciseSH').val()==''?'0.00':$('#txttotalexciseSH').val(); -var TotalCustomED=$('#txttotalcustomED').val()==''?'0.00':$('#txttotalcustomED').val(); -var TotalCustomSH=$('#txttotalcustomSH').val()==''?'0.00':$('#txttotalcustomSH').val(); -var TotalAdditionalExcise=$('#txttotalAdditionalExciseduty').val()==''?'0.00':$('#txttotalAdditionalExciseduty').val(); -var TotalGrossDuty=$('#txttotalgrossduty').val()==''?'0.00':$('#txttotalgrossduty').val(); -var TotalAvlmodvat=$('#txttotalavlmodvat').val()==''?'0.00':$('#txttotalavlmodvat').val(); -var TotalGrossExpense=$('#txttotalgrossexpense').val()==''?'0.00':$('#txttotalgrossexpense').val(); -var TotalOrder=$('#txtToatlOrder').val()==''?'0.00':$('txtToatlOrder').val(); + totvalue = parseFloat(totvalue) + parseFloat(total); + } @@ -3421,120 +3475,23 @@ var TotalOrder=$('#txtToatlOrder').val()==''?'0.00':$('txtToatlOrder').val(); $('#txttotalgrossduty').val(parseFloat(TotalGrossDuty).toFixed(2)); $('#txttotalavlmodvat').val(parseFloat(TotalAvlmodvat).toFixed(2)); $('#txttotalgrossexpense').val(parseFloat(TotalGrossExpense).toFixed(2)); - $('#txtToatlOrder').val(parseFloat(TotalOrder).toFixed(2)); - - - - //$('#txttotallanding').val(parseFloat(TotalLanding).toFixed(2)); -} - - - -function DeleteRow(rowid) -{ //alert('Delete'); - var DelRows = $('#txtDeletedRow').val(); - var answer = confirm(" Do you want to delete the Item from the List?") - if (answer) - { - //alert('Confirm'); - var td = document.getElementById(rowid); - td.parentNode.removeChild(td); - - var removeItem = $('#materialCode'+rowid).val(); - - - - SelectedMaterialCode.splice( SelectedMaterialCode.indexOf('removeItem'), 1 ); - $.each(SelectedMaterialList.Mat, function(i, el){ - - if (this.materialCode == removeItem){//Type = ''; - SelectedMaterialList.Mat.splice(i, 1); - } - }); - // alert(SelectedMaterialCode); - if(DelRows != '') - { - DelRows = DelRows + ":" + rowid; - } - else - { - DelRows= "0" + ":" + rowid; - } - $('#txtDeletedRow').val(DelRows); - populateValueMainFormForDeleteItem(rowid); - } - - } - - - - -function populateValueMainFormForDeleteItem(rowid) -{ - var TotalLanding=0; - var TotalHighseas=0; - var TotalCustom=0; - var TotalExcise=0; - var TotalExciseED=0; - var TotalExciseSH=0; - var TotalCustomED=0; - var TotalCustomSH=0; - var TotalAdditionalExcise=0; - var TotalGrossDuty=0; - var TotalAvlmodvat=0; - var TotalGrossExpense=0; -var AfterLandingCharge= $('#AfterLandingCharge').val() == '' ? '0.00' : $('#AfterLandingCharge').val(); -var AfterHighseas=$('#AfterHighseas').val()==''?'0.00':$('#AfterHighseas').val(); -var AfterCustomduty=$('#AfterCustomduty').val()==''?'0.00':$('#AfterCustomduty').val(); -var AfterExcisedutyTax=$('#AfterExcisedutyTax').val()==''?'0.00':$('#AfterExcisedutyTax').val(); -var AfterExcisedutyEDcess=$('#AfterExcisedutyEDcess').val()==''?'0.00':$('#AfterExcisedutyEDcess').val(); -var AfterExciseDutySH=$("#AfterExcisedutySHcess").val()==''?'0.00':$('#AfterExcisedutySHcess').val(); -var AfterAdditionalExciseduty=$('#AfterAdditionalExciseduty').val()==''?'0.00':$('#AfterAdditionalExciseduty').val(); -var AfterCustomEDcess=$('#AfterCustomEDcess').val()==''?'0.00':$('#AfterCustomEDcess').val(); -var AfterCustomSHcess=$('#AfterCustomSHcess').val()==''?'0.00':$('#AfterCustomSHcess').val(); -var AdditionalExciseduty=$('#AdditionalExciseduty').val()==''?'0.00':$('#AdditionalExciseduty').val(); -var Grossdutypayable=$('#Grossdutypayable').val()==''?'0.00':$('#Grossdutypayable').val(); -var AvailableModvat=$('#AvailableModvat').val()==''?'0.00':$('#AvailableModvat').val(); -var Grossexpenses=$('#Grossexpenses').val()==''?'0.00':$('#Grossexpenses').val(); -var totalExp=$('#TotalExp').val()==''?'0.00':$('#TotalExp').val(); -TotalLanding = parseFloat(TotalLanding) - parseFloat(AfterLandingCharge); -TotalHighseas = parseFloat(TotalHighseas) - parseFloat(AfterHighseas); -TotalCustom = parseFloat(TotalCustom) - parseFloat(AfterCustomduty); -TotalExcise = parseFloat(TotalExcise) - parseFloat(AfterExcisedutyTax); -TotalExciseED = parseFloat(TotalExciseED ) - parseFloat(AfterExcisedutyEDcess); -TotalExciseSH = parseFloat(TotalExciseSH) - parseFloat(AfterExciseDutySH); -TotalCustomED = parseFloat(TotalCustomED) - parseFloat(AfterCustomEDcess); -TotalCustomSH = parseFloat(TotalCustomSH ) - parseFloat(AfterCustomSHcess); -TotalAdditionalExcise = parseFloat(TotalAdditionalExcise ) - parseFloat(AdditionalExciseduty); -TotalGrossDuty = parseFloat(TotalGrossDuty) - parseFloat(Grossdutypayable); -TotalAvlmodvat = parseFloat(TotalAvlmodvat ) - parseFloat(AvailableModvat); -TotalGrossExpense = parseFloat(TotalGrossExpense ) - parseFloat(Grossexpenses); -TotalOrderValue=parseFloat(TotalOrderValue)-parseFloat() - - $('#txttotallanding').val(parseFloat(TotalLanding).toFixed(2)); - $('#txttotalhighseas').val(parseFloat(TotalHighseas).toFixed(2)); - $('#txttotalcustom').val(parseFloat(TotalCustom).toFixed(2)); - $('#txttotalexcise').val(parseFloat(TotalExcise).toFixed(2)); - $('#txttotalexciseED').val(parseFloat(TotalExciseED).toFixed(2)); - $('#txttotalexciseSH').val(parseFloat(TotalExciseSH).toFixed(2)); - $('#txttotalcustomED').val(parseFloat(TotalCustomED).toFixed(2)); - $('#txttotalcustomSH').val(parseFloat(TotalCustomSH).toFixed(2)); - $('#txttotalAdditionalExciseduty').val(parseFloat(TotalAdditionalExcise).toFixed(2)); - $('#txttotalgrossduty').val(parseFloat(TotalGrossDuty).toFixed(2)); - $('#txttotalavlmodvat').val(parseFloat(TotalAvlmodvat).toFixed(2)); - $('#txttotalgrossexpense').val(parseFloat(TotalGrossExpense).toFixed(2)); - $('#txtToatlOrder').val(parseFloat(TotalOrderValue).toFixed(2)); - + $('#txtTotalorderValue').val(parseFloat(totvalue).toFixed(2)); - + } + + + + + + function Save(status) { -//alert(); +//alert('Inside Save'); if(status == '0') { stat = ''; @@ -3548,14 +3505,11 @@ $('#txtStatus').val(stat); var txtRowCount = $('#txtRowCount').val(); var txtDeletedRow = $('#txtDeletedRow').val(); -//alert(stat); -//alert(JSON.stringify(txtStatus)); -//exit(); -//var TotalOrder=$('#txtToatlOrder').val(); -//alert(TotalOrder); -//exit(); + + if(validate()) { + if(document.getElementById('ImportTax').rows.length <= 0) { @@ -3572,7 +3526,7 @@ if(validate()) //data:$('.CreatealterPO').serialize()+"&TextRowCount="+TextRowCount+"&TextDeQletedRowCount="+TextDeletedRowCount+"&TextTotalOrderValueSummaryService="+TextTotalOrderValueSummaryService+"&TextSpcialInstruction="+TextSpcialInstruction+"&TextExchangerate"+ExcLandingCharge="+hangerate+"Status="+TextStatus, type:"POST", - url:"purchaseorder/EditImportPurchaseOrder", + url:"amendmentpurchaseorder/EditAmendImportPO", success:function(data) { if(data) { @@ -3582,8 +3536,8 @@ if(validate()) $('#txtDeletedRow').val(''); //$('#SpcialInstruction').val(''); //$('#txtDeliveryAddress').val(''); - window.location = "purchaseorderListing"; - + + window.location = "amendmentpurchaseorder"; } else { @@ -3613,8 +3567,17 @@ if(validate()) }); }); +var Detail = ; +//console.log(Detail); + + $.each(Detail, function (index, value) + { + $("#PaymentTerms").append( $('').val(value.ConfigValue).html(value.ConfigValue) ); + + } ); + diff --git a/application/views/editRevenueAmendPO.php b/application/views/editRevenueAmendPO.php index e7efc175..5550f37b 100755 --- a/application/views/editRevenueAmendPO.php +++ b/application/views/editRevenueAmendPO.php @@ -58,6 +58,10 @@ foreach ($PaymentTerms as $TER) if(!empty($POMaster)) { + // print_r($POMaster); + // print_r($Payment); + // echo "****"; + // print_r($PaymentTerms); foreach ($POMaster as $Req) { $SupId = $Req->SupplierID; @@ -1899,7 +1903,7 @@ body { foreach ($payment as $rl) { ?> - + function validateBudgetExceedLimit() { - alert('inside validateBudgetExceedLimit function'); + //alert('inside validateBudgetExceedLimit function'); var rows = document.getElementById('revenueTax').rows.length; var ReqType = ''; - alert(rows); + //alert(rows); for (i = 1; i < rows; i++) { var costcode = $('#costCode'+i).val(); var basicAmountRate = parseFloat($('#basicval'+i).val()); var totalAmount = parseFloat($('#TotalOrderValue'+i).val()); var avalbudAmt = ''; - alert('before Ajax'); + //alert('before Ajax'); $.ajax({ data:{id:costcode}, type:"POST", @@ -3715,7 +3719,7 @@ function validateBudgetExceedLimit() success:function(data) { if(data) { - alert(data); + //alert(data); avalbudAmt = parseFloat(data); if(basicAmountRate > avalbudAmt || totalAmount > avalbudAmt) { @@ -3726,7 +3730,7 @@ function validateBudgetExceedLimit() } else { - alert('Not exceeding in else part'); + //alert('Not exceeding in else part'); return true; } @@ -3913,14 +3917,14 @@ function populateValueMainFormForDeleteItem(rowid) function Save(status) { -alert('Inside Save'); +//alert('Inside Save'); if(status == '0') { stat = ''; } else { - alert('Inside else'); + //alert('Inside else'); stat = ''; } var splinstr = $('#txtSpcialInstruction').val(); @@ -3931,12 +3935,12 @@ $('#txtStatus').val(stat); $('#SpcialInstruction').val(splinstr); $('#txtDeliveryAddress').val(deladd); -alert('Before Validate IF condition'); +//alert('Before Validate IF condition'); if(validate()) { - alert('insdie Validate IF condition'); + //alert('insdie Validate IF condition'); var realrows=document.getElementById('txtRowCount').value; - alert(realrows); + //alert(realrows); if(document.getElementById('revenueTax').rows.length < 2) { alert('Please Select Line item to Create PO'); @@ -3950,7 +3954,7 @@ alert('Before Validate IF condition'); } else { - alert('final else for store data'); + //alert('final else for store data'); $('.content').loader('show'); $.ajax({ data:$('.CreatePO').serialize(), @@ -4014,7 +4018,7 @@ $('#Scheduleby').change(function(){ $.each(Detail, function (index, value) { - $("#PaymentTerms").append( $('').val(value.PaymentTerms).html(value.PaymentTerms) ); + $("#PaymentTerms").append( $('').val(value.ConfigValue).html(value.ConfigValue) ); diff --git a/application/views/editServiceAmendPO.php b/application/views/editServiceAmendPO.php index 16ccee85..0ca3775e 100755 --- a/application/views/editServiceAmendPO.php +++ b/application/views/editServiceAmendPO.php @@ -34,6 +34,10 @@ if(!empty($MaxPODate)) } if(!empty($POMaster)) { + // print_r($POMaster); + // print_r($Payment); + // echo "****"; + // print_r($PaymentTerms); foreach ($POMaster as $Req) { @@ -2208,12 +2212,12 @@ var stat=''; if(status == '0') { stat = ''; - alert(stat); + //alert(stat); } else { stat = ''; - alert(stat); + //alert(stat); } var splinstr = $('#txtSpcialInstruction').val(); var deladd = $('#DeliveryAddr').val(); @@ -2250,7 +2254,7 @@ $('#txtDeliveryAddress').val(deladd); $('#txtStatus').val(''); $('#SpcialInstruction').val(''); $('#txtDeliveryAddress').val('') - //window.location = "purchaseorderListing"; + window.location = "amendmentpurchaseorder"; } else @@ -2289,7 +2293,7 @@ var Detail = ; $.each(Detail, function (index, value) { - $("#PaymentTerms").append( $('').val(value.PaymentTerms).html(value.PaymentTerms) ); + $("#PaymentTerms").append( $('').val(value.ConfigValue).html(value.ConfigValue) );
UOM Rate Basic AmountTax AmountTotal Order AmountAction
UOM ?> Rate ?> BasicValue ?>Taxamount?>TotalOrderValue?>     + // if($PONOStatus == PO_DRAFT) + // {?> +     -     + // }?>
<%=UOM%> <%=Rate%> <%=BasicAmount%><%=Taxvalue%><%=TotalValue%> -     +