ria-edit po changes

This commit is contained in:
venbatechnologies@gmail.com 2018-06-12 18:21:05 +05:30
parent 0daef48532
commit 175ec7e1b8
6 changed files with 9117 additions and 7873 deletions

View File

@ -32,7 +32,6 @@ class purchaseorder extends BaseController
*/
public function index()
{
//$this->global['pageTitle'] = 'Resico : AddPO';
$this->global['pageTitle'] = $this->CompanyName.' : AddPO';
$this->loadViews("addPO", $this->global, NULL , NULL);
}
@ -42,10 +41,8 @@ class purchaseorder extends BaseController
*/
function viewfullpurchaseorder()
{
//$this->global['pageTitle'] = 'Resico : View Purchase Order';
$this->global['pageTitle'] = $this->CompanyName.' : View Purchase Order';
$this->loadViews("viewfullpurchaseorder", $this->global,Null);
}
/**
@ -174,7 +171,6 @@ class purchaseorder extends BaseController
{
$FYStart =$Fy->StartYear;
$FYEnd =$Fy->EndYear;
}
}
@ -402,6 +398,7 @@ class purchaseorder extends BaseController
}
$data['getdata'] = $this->purchaseorder_model->getfunction($PONO);
//$data['billfile'] = $this->purchaseorder_model->getbillfiesr($PONO);
$data['MaxPODate'] = $this->purchaseorder_model->getLastReleasedPODate();
$data['TaxType'] = $this->purchaseorder_model->getConfigValue('C006');
$data['FreightType'] = $this->purchaseorder_model->getConfigValue('C018');
@ -412,7 +409,7 @@ class purchaseorder extends BaseController
$data['PaymentTerms']=$this->purchaseorder_model->GetPaymentTerms($PONO);
$data['getdata'] = $this->purchaseorder_model->getfunction($PONO);
$data['getlogpodtl']=$this->purchaseorder_model->getlogpodtl($PONO);
$data['WorkStatus']=$this->purchaseorder_model->getStatus(7);
//$this->global['pageTitle'] = 'Resico : Edit Service Purchase order form';
$this->global['pageTitle'] = $this->CompanyName.' : Edit Service Purchase order form';
@ -424,6 +421,7 @@ class purchaseorder extends BaseController
$data['POItem'] = $this->purchaseorder_model->GetRevenuePurchaseOrderDetails($PONO);
$data['PaymentTerms']=$this->purchaseorder_model->GetPaymentTerms($PONO);
$data['WorkStatus']=$this->purchaseorder_model->getStatus(7);
$data['getlogpodtl']=$this->purchaseorder_model->getlogpodtl($PONO);
//$this->global['pageTitle'] = 'Resico : Edit Revenue Purchase order form';
$this->global['pageTitle'] = $this->CompanyName.' : Edit Revenue Purchase order form';
$this->loadViews("editRevenuepurchaseorder", $this->global, $data, NULL);
@ -450,7 +448,7 @@ class purchaseorder extends BaseController
$data['CurrencyDetail']=$this->purchaseorder_model->GetCurrencyDetail($Currency);
$data['PaymentTerms']=$this->purchaseorder_model->GetPaymentTerms($PONO);
$data['getlogpodtl']=$this->purchaseorder_model->getlogpodtl($PONO);
$unicode ='';
foreach ($data['CurrencyDetail'] as $Detail)
@ -489,6 +487,7 @@ class purchaseorder extends BaseController
$data['POItem'] = $this->purchaseorder_model->getDomesticCapitalPurchaseOrderDetails($PONO);
}
$data['requestedBy'] = $this->purchaseorder_model->GetRequesedByDetails($PONO);
$data['getlogpodtl']=$this->purchaseorder_model->getlogpodtl($PONO);
@ -1080,6 +1079,10 @@ class purchaseorder extends BaseController
$POdt =$this->input->post('PODate');
$PODate = $this->getDateformat($POdt);
$SupplierID = $this->input->post('drpSupplier');
$newsup=$this->input->post('newsup');
$newSupId = split("[ - ]+", $newsup);
$DeliveryAddr = $this->input->post('txtDeliveryAddress');
$dt = $this->input->post('Deliverydt');
@ -1093,7 +1096,9 @@ class purchaseorder extends BaseController
$DeliverySchedule = '';
}
$b4supplier=$this->input->post('b4supplier');
$b4date=$this->input->post('b4podate');
$b4podate = $this->getDateformat($b4date);
$Modeofshipment=$this->input->post('editmodeofshipment');
$supplierreference=$this->input->post('editsupplierreference');
@ -1134,14 +1139,36 @@ class purchaseorder extends BaseController
$POMaster = $this->purchaseorder_model->updatePOMaster($PONO,$POList);
$LineItemStatus = REQITEM_NEW;
if($PODate != $b4podate )
{
$logpo =array('PONO'=>$PONO,'LineItemNo'=>'-','UpdateBy'=>$updatedBy,'OldValue'=>$b4podate,'NewValue'=>$PODate,'Entity'=>'PO DateChanged');
$this->purchaseorder_model->insertlogpo($logpo);
}
if(!empty($newSupId[0] ))
{
if($newSupId[0] != $b4supplier)
{
//echo $b4supplier.'-'.$newSupId[0];die;
$logpo =array('PONO'=>$PONO,'LineItemNo'=>'-','UpdateBy'=>$updatedBy,'OldValue'=>$b4supplier,'NewValue'=>$newsup,'Entity'=>'Supplier Changed');
$this->purchaseorder_model->insertlogpo($logpo);
}
}
for ($i = 1; $i <= $RowCount; $i++)
{
$MaterialCode = $this->input->post('materialCode'.$i);
$Quantity = $this->input->post('quantity'.$i);
$Reqnumber = $this->input->post('Reqnumber'.$i);
$b4qty=$this->input->post('b4qty'.$i);
$b4rate=$this->input->post('b4rate'.$i);
$itemRate = $this->input->post('itemRate'.$i);
$per=$this->input->post('per'.$i);
$DiscountType = $this->input->post('DisType'.$i);
@ -1161,12 +1188,29 @@ class purchaseorder extends BaseController
$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 = '';
if($Quantity != $b4qty)
{
$logpo =array('PONO'=>$PONO,'LineItemNo'=>$POLineItemNo,'UpdateBy'=>$updatedBy,'OldValue'=>$b4qty,'NewValue'=>$Quantity,'Entity'=>'Quantity Changed');
$this->purchaseorder_model->insertlogpo($logpo);
}
if($itemRate != $b4rate)
{
$logpo =array('PONO'=>$PONO,'LineItemNo'=>$POLineItemNo,'UpdateBy'=>$updatedBy,'OldValue'=>$b4rate,'NewValue'=>$itemRate,'Entity'=>'Rate Changed');
$this->purchaseorder_model->insertlogpo($logpo);
}
$SkipInsert = "False";
if( count($comma_separated) > 0)
@ -1184,46 +1228,76 @@ class purchaseorder extends BaseController
}
}
$ReqDetails = array('Quantity'=>$Quantity,'UpdatedBy'=>$updatedBy,'UpdatedOn'=>$updateddt);
$this->purchaseorder_model->updateReqDetails($Reqnumber,$MaterialCode,$ReqDetails);
$recqty=0;
if($POStatus == SPECIAL_PO)
{
$recqty= $Quantity;
$IGRD= $this->purchaseorder_model->getIGRDetails($PONO);
$j = $i-1;
$IGRDs = array('QuantityAsPerInvoice'=>$Quantity,'UpdateBY'=>$updatedBy,'UpdatedOn'=>$updateddt);
$this->purchaseorder_model->updateIGR($IGRD[$j]['IGRItemNo'],$IGRDs);
//$MaterialstockHistoryupdate= array('SupplierID'=>$SupplierID,'Quantity'=>$Quantity,'ItemValue'=>$itemRate,'UpdateBY'=>$updatedBy,'UpdatedOn'=>$updateddt);
//$itemNo = $IGRD[$j]['IGRItemNo'];
//$this->purchaseorder_model->updateMatStock($itemNo,$MaterialstockHistoryupdate);
}
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);
//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'];
}
// $POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList);
// if(count($POLineItem)>0)
// {
// $LineItemNo = $POLineItem[0]['LineItemNo'];
// }
}
else
{
//}
//else
//{
$LineItemNo = $POLineItemNo;
$POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'UpdateBY'=>$updatedBy,'UpdatedOn'=>$updateddt,'CostCenterCode'=>$CostCenter);
$POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'ReceivedQuantity'=>$recqty,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'UpdateBY'=>$updatedBy,'UpdatedOn'=>$updateddt,'CostCenterCode'=>$CostCenter);
$POLineItem = $this->purchaseorder_model->updatePOLineItem($PONO,$POLineItemNo,$POLineItemList);
}
//}
$isExists = $this->purchaseorder_model->LineItemExistsinRevenueTax($LineItemNo);
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);
//if(count($isExists) == 0)
// {
// $RevenueTaxList = array('LineItemNo'=>$LineItemNo, 'DiscountType'=>$DiscountType,'DiscountValue'=>$DiscountValue,'AfterDiscount'=>$AfterDiscount,'PackagingType'=>$PackagingType,'PackagingValue'=>$PackagingValue,'PackagingCalulatedOn'=>$PackagingOption,'AfterPackagingValue'=>$AfterPackagingValue,'FreightType'=>$FreightType, 'FreightValue'=>$FreightValue,'AfterFreightValue'=>$AfterFreightValue,'Insurance'=>$InsuranceValue,'TotalValue'=>$TotalOrderValue, 'CreatedBy'=>$updatedBy,'CreatedDate'=>$updateddt,'CGST'=>$Cgst,'AfterCGST'=>$AfterCgst,'SGST'=>$Sgst,'AfterSGST'=>$AfterSgst,'IGST'=>$Igst,'AfterIGST'=>$AfterIgst,'NoOfTrip'=>$NOOfTrip);
$RevenueList = $this->purchaseorder_model->addRevenueTax($RevenueTaxList);
// $RevenueList = $this->purchaseorder_model->addRevenueTax($RevenueTaxList);
}
else
{
// }
// else
// {
$RevenueTaxList = array('DiscountType'=>$DiscountType,'DiscountValue'=>$DiscountValue,'AfterDiscount'=>$AfterDiscount,'PackagingType'=>$PackagingType,'PackagingValue'=>$PackagingValue,'PackagingCalulatedOn'=>$PackagingOption,'AfterPackagingValue'=>$AfterPackagingValue,'FreightType'=>$FreightType, 'FreightValue'=>$FreightValue,'AfterFreightValue'=>$AfterFreightValue,'Insurance'=>$InsuranceValue,'TotalValue'=>$TotalOrderValue, 'UpdateBY'=>$updatedBy,'UpdatedOn'=>$updateddt,'CGST'=>$Cgst,'AfterCGST'=>$AfterCgst,'SGST'=>$Sgst,'AfterSGST'=>$AfterSgst,'IGST'=>$Igst,'AfterIGST'=>$AfterIgst,'CreatedBy'=>$updatedBy,'NoOfTrip'=>$NOOfTrip);
$this->purchaseorder_model->updateRevenueTax($LineItemNo,$RevenueTaxList);
}
// }
}
}
@ -1555,11 +1629,6 @@ public function importpoprint($PONO)
/**
* This function used to load the Delete the Requistion Items
*/
/**
* Its handles delete PO Line-item details operation.
*/
@ -1802,13 +1871,22 @@ function addNewImportPurchaseOrder()
*/
function EditImportPurchaseOrder()
{
$PONO =$this->input->post('txtPONO');
$POdt = '';
$createddt='';
$PODate = $this->getDateformat($POdt);
$SupplierID = $this->input->post('drpSupplier');
$newsup=$this->input->post('newsup');
$newSupId = split("[ - ]+", $newsup);
$b4supplier=$this->input->post('b4supplier');
$b4date=$this->input->post('b4podate');
$b4podate = $this->getDateformat($b4date);
$DeliveryAddr = $this->input->post('DeliveryAddr');
$dt = $this->input->post('Deliverydt');
$Deliverydt = $this->getDateformat($dt);
@ -1842,10 +1920,9 @@ function addNewImportPurchaseOrder()
$SpcialInstruction = $this->input->post('txtSpcialInstruction');
$TotalOrder = $this->input->post('txttot');
$POStatus = $this->input->post('txtStatus');
$BudgetType = $this->input->post('Budget');
$BudgetType = $this->input->post('Budget');
$CreateBy = $this->session->userdata ( 'userId' );
$RowCount = $this->input->post('txtRowCount');
@ -1868,11 +1945,9 @@ function addNewImportPurchaseOrder()
$importoption=$this->input->post('Importoption');
$Insurance=$this->input->post('Insurance');
if($Insurance=='YES')
{
@ -1884,6 +1959,7 @@ function addNewImportPurchaseOrder()
$Insurancenumber='';
$insurestatus='0';
}
// $POList = array('SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrder,'PODate'=>$PODate,'Status'=>$POStatus,'ServiceDescription'=>$SpcialInstruction,'CreatedBy'=>$CreateBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'CreatedDate'=>$updateddt,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'ExchangeRate'=>$Exchangerate,'ExchangeRateCalculatedon'=>$ExchangeRateCalculatedon,'CurrencyType'=>$CurrencyType,'PaymentTerms'=>$PaymentTerms);
$Qualitycheck=1;
$POList = array('SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrder,'PODate'=>$PODate,'Status'=>$POStatus,'ServiceDescription'=>$SpcialInstruction,'CreatedBy'=>$CreateBy,'DeliveryAddress'=>$DeliveryAddr,'Import_DispatchDetails'=>$Dispatch,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'ExchangeRate'=>$Exchangerate,'ExchangeRateCalculatedon'=>$ExchangeRateCalculatedon,'CurrencyType'=>$CurrencyType,'PaymentTerms'=>$PaymentTerms,'POType'=>$POType,'Import_PlaceofOrgin'=>$Palaceoforigin,'PaymentOtherDescription'=>$OtherPayment,'Mode_Of_Shipment'=>$Shipmentmode,'Supplier_Reference'=>$SupplierRef,'Supplier_Offer_No'=>$SupplierOffer,'Other_Reference'=>$otherRef,'Fincap'=>$finCap,'InsuranceStatus'=>$insurestatus,'InsuranceNumber'=>$Insurancenumber,'POSubType'=>$importoption,'IsQualityChkReqired'=>$Qualitycheck,'BudgetType'=>$BudgetType);
@ -1891,6 +1967,28 @@ function addNewImportPurchaseOrder()
$POMaster = $this->purchaseorder_model->updatePOMaster($PONO,$POList);
$LineItemStatus = REQITEM_NEW;
if($PODate == $b4podate )
{
$logpo =array('PONO'=>$PONO,'LineItemNo'=>'-','UpdateBy'=>$CreateBy,'OldValue'=>$b4podate,'NewValue'=>$PODate,'Entity'=>'PO DateChanged');
$this->purchaseorder_model->insertlogpo($logpo);
}
if(!empty($newSupId[0] ))
{
if($newSupId[0] != $b4supplier)
{
$logpo =array('PONO'=>$PONO,'LineItemNo'=>'-','UpdateBy'=>$CreateBy,'OldValue'=>$b4supplier,'NewValue'=>$newsup,'Entity'=>'Supplier Changed');
$this->purchaseorder_model->insertlogpo($logpo);
}
}
for ($i = 1; $i <= $RowCount; $i++)
{
@ -1901,8 +1999,8 @@ function addNewImportPurchaseOrder()
$Reqnumber = $this->input->post('Reqnumber'.$i);
$itemRate = $this->input->post('itemRate'.$i);
$b4qty=$this->input->post('b4qty'.$i);
$b4rate=$this->input->post('b4rate'.$i);
$BasicPriceinmton = $this->input->post('BasicPriceInMTon'.$i);
$Productprice = $this->input->post('TotalValue'.$i);
@ -1961,9 +2059,6 @@ function addNewImportPurchaseOrder()
$FreightAmount=$this->input->post('AfterFreightValue'.$i);
$AssessableValue=$this->input->post('AssessableValue'.$i);
$Subtotal=$this->input->post('SubTotal'.$i);
@ -1973,15 +2068,27 @@ function addNewImportPurchaseOrder()
$Clearingcharge=$this->input->post('ClearingCharge'.$i);
$Nettvalue=$this->input->post('NetValue'.$i);
$specialinstruction=$this->input->post('Addinstruction'.$i);
$per=$this->input->post('Per'.$i);
$LineItemNo = '';
if($Quantity != $b4qty)
{
$logpo =array('PONO'=>$PONO,'LineItemNo'=>$POLineItemNo,'UpdateBy'=>$CreateBy,'OldValue'=>$b4qty,'NewValue'=>$Quantity,'Entity'=>'Quantity Changed');
$this->purchaseorder_model->insertlogpo($logpo);
}
if($itemRate != $b4rate)
{
$logpo =array('PONO'=>$PONO,'LineItemNo'=>$POLineItemNo,'UpdateBy'=>$CreateBy,'OldValue'=>$b4rate,'NewValue'=>$itemRate,'Entity'=>'Rate Changed');
$this->purchaseorder_model->insertlogpo($logpo);
}
$currencytypeID = $this->input->post('currencytype');
$SkipInsert = "False";
@ -1999,6 +2106,12 @@ function addNewImportPurchaseOrder()
}
}
$ReqDetails = array('Quantity'=>$Quantity,'UpdatedBy'=>$CreateBy,'UpdatedOn'=>$updateddt);
$this->purchaseorder_model->updateReqDetails($Reqnumber,$MaterialCode,$ReqDetails);
if($SkipInsert == "False")
{
if(strlen($POLineItemNo) == 0)
@ -2018,17 +2131,16 @@ function addNewImportPurchaseOrder()
$LineItemNo = $POLineItemNo;
$POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'UpdatedOn'=>$updateddt,'CostCenterCode'=>$CostCenter,'Per'=>$per,'ServiceMaterialDescription'=>$specialinstruction);
$POLineItem = $this->purchaseorder_model->updatePOLineItem($PONO,$POLineItemNo,$POLineItemList);
}
$isExists = $this->purchaseorder_model->LineItemExistsinImportTax($LineItemNo);
if(count($isExists) == 0)
{
$ImportTaxList = array('LineItemNo'=>$LineItemNo,'BasicPriceInMTon'=>$BasicPriceinmton,'ProductPrice'=>$Productprice,'LandingCharge'=>$LandingCharge,'AfterLandingCharge'=>$AfterLandingCharge,'CustomDuty'=>$CustomDuty,'AfterCustomDuty'=>$AfterCustomDuty,'CustomEdCess'=>$CustomEd,'CustomSHCess'=>$CustomSH,'CreatedBy'=>$CreateBy,'UpdatedOn'=>$updateddt,'Grossdutypayable'=>$Grossdutypayable,'CustomDutyExpensesPerKG'=>$CustomDutyExpensesPerKG,'QuantityKG'=>$QuantityKG,'AfterCustomSHCess'=>$AfterCustomSH,'AfterCustomEdCess'=>$AfterCustomEd,'TotalValue'=>$Totalvalueitem,'FreightType'=>$FreightType,'NoOfTrip'=>$Nosoftrip,'FreightValue'=>$FreightRate,'AfterFreightValue'=>$FreightAmount,'AssessableValue'=>$AssessableValue,'SubTotal'=>$Subtotal,'IGST'=>$Igst,'AfterIGST'=>$AfterIgst,'DutyImpact'=>$Dutyimpact,'ClearingCharge'=>$Clearingcharge,'NetValue'=>$Nettvalue);
$ImportList = $this->purchaseorder_model->addImportTax($ImportTaxList);
@ -2036,7 +2148,6 @@ function addNewImportPurchaseOrder()
}
else
{
$ImportTaxList = array('LineItemNo'=>$LineItemNo,'BasicPriceInMTon'=>$BasicPriceinmton,'ProductPrice'=>$Productprice,'LandingCharge'=>$LandingCharge,'AfterLandingCharge'=>$AfterLandingCharge,'CustomDuty'=>$CustomDuty,'AfterCustomDuty'=>$AfterCustomDuty,'CustomEdCess'=>$CustomEd,'CustomSHCess'=>$CustomSH,'CreatedBy'=>$CreateBy,'UpdatedOn'=>$updateddt,'Grossdutypayable'=>$Grossdutypayable,'CustomDutyExpensesPerKG'=>$CustomDutyExpensesPerKG,'QuantityKG'=>$QuantityKG,'AfterCustomSHCess'=>$AfterCustomSH,'AfterCustomEdCess'=>$AfterCustomEd,'TotalValue'=>$Totalvalueitem,'FreightType'=>$FreightType,'NoOfTrip'=>$Nosoftrip,'FreightValue'=>$FreightRate,'AfterFreightValue'=>$FreightAmount,'AssessableValue'=>$AssessableValue,'SubTotal'=>$Subtotal,'IGST'=>$Igst,'AfterIGST'=>$AfterIgst,'DutyImpact'=>$Dutyimpact,'ClearingCharge'=>$Clearingcharge,'NetValue'=>$Nettvalue);
$this->purchaseorder_model->updateImportTax($LineItemNo,$ImportTaxList);
@ -2052,8 +2163,6 @@ function addNewImportPurchaseOrder()
}
/* All Function following This command for FINANCE TEAM PO APPROVAL SCREEN*/
/**
* For po approval. functionalities handles by Finances dept.
@ -2434,6 +2543,12 @@ function addNewImportPurchaseOrder()
$POdt =$this->input->post('PODate');
$PODate = $this->getDateformat($POdt);
$SupplierID = $this->input->post('drpSupplier');
$newsup=$this->input->post('newsup');
$newSupId = split("[ - ]+", $newsup);
$DeliveryAddr = $this->input->post('DeliveryAddr');
$dt = $this->input->post('Deliverydate');
@ -2441,6 +2556,11 @@ function addNewImportPurchaseOrder()
$PoRange = $this->input->post('txtPoRange');
$b4supplier=$this->input->post('b4supplier');
$b4date=$this->input->post('b4podate');
$b4podate = $this->getDateformat($b4date);
$DeliveryOption = $this->input->post('DateRange');
$DeliverySchedule='';
@ -2501,6 +2621,8 @@ function addNewImportPurchaseOrder()
$InsuranceNo=$this->input->post('insuranceNo');
$ServiceTypeOptions=$this->input->post('PoTypeOptions');
$BudgetType = $this->input->post('Budget');
$CreateBy = $this->session->userdata ( 'userId' );
$RowCount = $this->input->post('txtRowCount');
@ -2522,8 +2644,26 @@ function addNewImportPurchaseOrder()
$LineItemStatus = REQITEM_NEW;
if($PODate != $b4podate )
{
$logpo =array('PONO'=>$PONO,'LineItemNo'=>'-','UpdateBy'=>$CreateBy,'OldValue'=>$b4podate,'NewValue'=>$PODate,'Entity'=>'PO DateChanged');
$this->purchaseorder_model->insertlogpo($logpo);
}
if(!empty($newSupId[0] ))
{
if($newSupId[0] != $b4supplier)
{
$logpo =array('PONO'=>$PONO,'LineItemNo'=>'-','UpdateBy'=>$CreateBy,'OldValue'=>$b4supplier,'NewValue'=>$newsup,'Entity'=>'Supplier Changed');
$this->purchaseorder_model->insertlogpo($logpo);
}
}
for ($i = 1; $i <= $RowCount; $i++)
{
@ -2532,6 +2672,9 @@ function addNewImportPurchaseOrder()
$Reqnumber = $this->input->post('Reqnumber'.$i);
$itemRate = $this->input->post('itemRate'.$i);
$b4qty=$this->input->post('b4qty'.$i);
$b4rate=$this->input->post('b4rate'.$i);
$Exchangerate = $this->input->post('echangeRate'.$i);
$BasicPriceinmton = $this->input->post('rateInUs'.$i);
$Productprice = $this->input->post('basicvalInINR'.$i);
@ -2608,8 +2751,22 @@ function addNewImportPurchaseOrder()
$FreightAmountloc=$this->input->post('Afvalue'.$i);
if($Quantity != $b4qty)
{
$logpo =array('PONO'=>$PONO,'LineItemNo'=>$POLineItemNo,'UpdateBy'=>$CreateBy,'OldValue'=>$b4qty,'NewValue'=>$Quantity,'Entity'=>'Quantity Changed');
$this->purchaseorder_model->insertlogpo($logpo);
}
if($itemRate != $b4rate)
{
$logpo =array('PONO'=>$PONO,'LineItemNo'=>$POLineItemNo,'UpdateBy'=>$CreateBy,'OldValue'=>$b4rate,'NewValue'=>$itemRate,'Entity'=>'Rate Changed');
$this->purchaseorder_model->insertlogpo($logpo);
}
$SkipInsert = "False";
@ -2627,6 +2784,12 @@ function addNewImportPurchaseOrder()
}
}
$ReqDetails = array('Quantity'=>$Quantity,'UpdatedBy'=>$CreateBy,'UpdatedOn'=>$updateddt);
$this->purchaseorder_model->updateReqDetails($Reqnumber,$MaterialCode,$ReqDetails);
if($SkipInsert == "False")
{
if(strlen($POLineItemNo) == 0)
@ -2694,7 +2857,6 @@ function addNewImportPurchaseOrder()
echo 'Purchase Order Updated Successfully! PO Number Is: '.$PONO ;
}
/**
* To load capital po datas for pdf
*/

View File

@ -17,18 +17,51 @@ class purchaseorder_model extends CI_Model
$this->db->from('T_PurchaseOrder_Master PO');
$this->db->join('T_PurchaseOrder_LineItem Line','PO.PONO = Line.PONO');
$this->db->join('T_Requestion_Master Req','Req.ReqNo = Line.ReqNo');
$this->db->where('PO.POType',SERVICE);
$this->db->where('PO.status',PO_RELEASED);
$this->db->where('Req.RequestedDept',$this->session->userdata('DEPCode'));
$query = $this->db->get();
return $query->result();
}
function updateReqDetails($Reqnumber,$MaterialCode,$ReqDetail){
$this->db->where('ReqNo',$Reqnumber);
$this->db->where('MaterialCode',$MaterialCode);
// $this->db->where('Quantity',$Quantity);
$this->db->update('T_Requestion_Details',$ReqDetail);
$r = $this->db->affected_rows();
return $r;
}
function getIGRDetails($PONO)
{
$subQuery ='select IGRM.PONO,IGRD.IGRItemNo,IGRD.IGRNO from
T_IGR_Master IGRM
join T_IGR_Details IGRD on IGRD.IGRNO = IGRM.IGRNO
Where IGRM.PONO = ? ';
$query = $this->db->query($subQuery,array($PONO));
return $query->result_array();
}
function updateIGR($IGRItemNo,$IGRDs) //,$MaterialCode,
{
$this->db->where('IGRItemNo',$IGRItemNo); //,'IGRNO',$IGRNO,'MaterialCode',$MaterialCode);
//$this->db->where('IGRNO',$IGRNO);
// $this->db->where('MaterialCode',$MaterialCode);
$this->db->update('T_IGR_Details',$IGRDs);
$r = $this->db->affected_rows();
return $r;
}
function fileupload($myfile)
@ -43,7 +76,7 @@ class purchaseorder_model extends CI_Model
function getfunction($pono)
{
$this->db->distinct();
$this->db->select('bill.PONO,mstr.IGRNO,bill.BillNo,,bill.FilePath,mstr.DeliveryChellanOrInvoiceNo,mstr.DeliveryChellanDate,mstr.VehicleNo,mstr.CourierNo,dtl.QuantityAsPerInvoice,pom.POType');
$this->db->select('bill.PONO,mstr.IGRNO,bill.BillNo,mstr.MaterialRcvdDate,bill.FilePath,mstr.DeliveryChellanOrInvoiceNo,mstr.DeliveryChellanDate,mstr.VehicleNo,mstr.CourierNo,dtl.QuantityAsPerInvoice,pom.POType');
$this->db->from('T_PurchaseOrder_BillUpload bill');
$this->db->join('T_IGR_Master mstr','bill.PONO = mstr.PONO','left');
$this->db->join('T_IGR_Details dtl','mstr.IGRNO = dtl.IGRNO','left');
@ -53,12 +86,92 @@ class purchaseorder_model extends CI_Model
//$this->db->or_where('pom.status',SPECIAL_PO);
$this->db->group_by('bill.BillNo');
// $this->db->select('mstr.PONO,mstr.IGRNO,mstr.DeliveryChellanOrInvoiceNo,
// mstr.DeliveryChellanDate,mstr.VehicleNo,mstr.MaterialRcvdDate,
// mstr.CourierNo,bill.BillNo,bill.FilePath,pom.Status,pom.POType');
// $this->db->from('T_IGR_Master mstr');
// $this->db->join('T_PurchaseOrder_BillUpload bill','bill.PONO = mstr.PONO','left');
// $this->db->join('T_IGR_Details dtl','mstr.IGRNO = dtl.IGRNO','left');
// // $this->db->join('T_MaterialMaster mm','mm.MaterialCode = bill.MaterialCode');
// $this->db->join('T_PurchaseOrder_Master pom','pom.PONO = mstr.PONO');
// $this->db->where('mstr.PONO',$pono);
$query = $this->db->get();
return $query->result();
}
function getfunctionr($pono)
{
$this->db->distinct();
// $this->db->select('bill.PONO,mstr.IGRNO,bill.BillNo,mstr.MaterialRcvdDate,bill.FilePath,mstr.DeliveryChellanOrInvoiceNo,mstr.DeliveryChellanDate,mstr.VehicleNo,mstr.CourierNo,dtl.QuantityAsPerInvoice,pom.POType');
// $this->db->from('T_PurchaseOrder_BillUpload bill');
// $this->db->join('T_IGR_Master mstr','bill.PONO = mstr.PONO','left');
// $this->db->join('T_IGR_Details dtl','mstr.IGRNO = dtl.IGRNO','left');
// // $this->db->join('T_MaterialMaster mm','mm.MaterialCode = bill.MaterialCode');
// $this->db->join('T_PurchaseOrder_Master pom','pom.PONO = bill.PONO');
// $this->db->where('bill.PONO',$pono);
// //$this->db->or_where('pom.status',SPECIAL_PO);
// $this->db->group_by('bill.BillNo');
$this->db->select('mstr.PONO,mstr.IGRNO,mstr.DeliveryChellanOrInvoiceNo,
mstr.DeliveryChellanDate,mstr.VehicleNo,mstr.MaterialRcvdDate,
mstr.CourierNo,pom.Status,pom.POType'); //,bill.BillNo,bill.FilePath,
$this->db->from('T_IGR_Master mstr');
//$this->db->join('T_PurchaseOrder_BillUpload bill','bill.PONO = mstr.PONO','left');
$this->db->join('T_IGR_Details dtl','mstr.IGRNO = dtl.IGRNO','left');
// $this->db->join('T_MaterialMaster mm','mm.MaterialCode = bill.MaterialCode');
$this->db->join('T_PurchaseOrder_Master pom','pom.PONO = mstr.PONO');
$this->db->where('mstr.PONO',$pono);
$query = $this->db->get();
return $query->result();
}
function getbillfiesr($pono)
{
$this->db->distinct();
// $this->db->select('bill.PONO,mstr.IGRNO,bill.BillNo,mstr.MaterialRcvdDate,bill.FilePath,mstr.DeliveryChellanOrInvoiceNo,mstr.DeliveryChellanDate,mstr.VehicleNo,mstr.CourierNo,dtl.QuantityAsPerInvoice,pom.POType');
// $this->db->from('T_PurchaseOrder_BillUpload bill');
// $this->db->join('T_IGR_Master mstr','bill.PONO = mstr.PONO','left');
// $this->db->join('T_IGR_Details dtl','mstr.IGRNO = dtl.IGRNO','left');
// // $this->db->join('T_MaterialMaster mm','mm.MaterialCode = bill.MaterialCode');
// $this->db->join('T_PurchaseOrder_Master pom','pom.PONO = bill.PONO');
// $this->db->where('bill.PONO',$pono);
// //$this->db->or_where('pom.status',SPECIAL_PO);
// $this->db->group_by('bill.BillNo');
$this->db->select('mstr.PONO,mstr.IGRNO,mstr.DeliveryChellanOrInvoiceNo,
mstr.DeliveryChellanDate,mstr.VehicleNo,mstr.MaterialRcvdDate,
mstr.CourierNo,bill.BillNo,bill.FilePath,pom.Status,pom.POType');
$this->db->from('T_IGR_Master mstr');
$this->db->join('T_PurchaseOrder_BillUpload bill','bill.PONO = mstr.PONO','left');
$this->db->join('T_IGR_Details dtl','mstr.IGRNO = dtl.IGRNO','left');
// $this->db->join('T_MaterialMaster mm','mm.MaterialCode = bill.MaterialCode');
$this->db->join('T_PurchaseOrder_Master pom','pom.PONO = mstr.PONO');
$this->db->where('mstr.PONO',$pono);
$query = $this->db->get();
return $query->result();
}
function GetPODetailforBillingServicePO($PONO)
@ -170,12 +283,11 @@ function purchaseorderListing($forwhat='')
$this->db->select('SupplierID, SupplierName,Address,PaymentID');
$this->db->from('T_SupplierDetailsN');
$this->db->where('IsActive', 1);
//$this->db->where('IsActive = 1');
if($supID != '')
{
$this->db->where('SupplierID',$supID);
}
//$this->db->where('roleId !=', 1);
$query = $this->db->get();
return $query->result();
@ -195,7 +307,6 @@ function purchaseorderListing($forwhat='')
}
function getqtycheck($PONO)
{
$this->db->select('IsQualityChkReqired');
@ -217,11 +328,9 @@ function purchaseorderListing($forwhat='')
$result ->next_result();
//print_r($this->db->last_query());
if ($result->num_rows > 0)
{
//echo 'PO Line item Inserted successfully';
if($IsArray != '')
{
return $result->result_array();
@ -235,7 +344,7 @@ function purchaseorderListing($forwhat='')
}
/**
This Function to get the List of Requistion which require to create PO
*This Function to get the List of Requistion which require to create PO
*/
function getAllRequistionListToCreatePO()
{
@ -575,7 +684,7 @@ function GetPOType($ReqNo)
// print_r($this->db->last_query());
if($insert_id>0)
{
$subQuery = 'select max(PONO) as PONO from T_PurchaseOrder_Master where POType=? and POSubType=?';
$subQuery = 'select PONO from T_PurchaseOrder_Master where POType=? and POSubType=? and isnull(ParentPO) order by CreatedDate desc limit 1 ';
$query = $this->db->query($subQuery,array($POType,$POSubtype));
@ -583,18 +692,17 @@ function GetPOType($ReqNo)
}
}
function addAmendPOMaster($POMaster,$CreatedBy,$ParentPO)
{
// print_r($POMaster);
$this->db->trans_start();
$this->db->insert('T_PurchaseOrder_Master', $POMaster);
$insert_id = $this->db->affected_rows();
$this->db->trans_complete();
// print_r($this->db->last_query());
if($insert_id>0)
{
$subQuery = 'select max(PONO) as PONO from T_PurchaseOrder_Master where CreatedBy=? and ParentPO=?';
$subQuery = 'select PONO from T_PurchaseOrder_Master where CreatedBy=? and ParentPO=? order by CreatedDate desc limit 1';
$query = $this->db->query($subQuery,array($CreatedBy,$ParentPO));
@ -611,7 +719,7 @@ function GetPOType($ReqNo)
$this->db->insert('T_PurchaseOrder_LineItem', $POLineItem);
$insert_id = $this->db->affected_rows();
$this->db->trans_complete();
// print_r($this->db->last_query());
if($insert_id>0)
{
$subQuery = 'select max(LineItemNo) as LineItemNo from T_PurchaseOrder_LineItem';
@ -717,7 +825,7 @@ function GetPOType($ReqNo)
function GetServicePurchaseOrder($PONO = '')
{
$this->db->distinct();
$this->db->select('ReqNo,POMast.PONO,POMast.PaymentTerms,POMast.PaymentOtherDescription,ServiceDescription,supp.SupplierID,supp.SupplierName,supp.Address,PODate,Stat.StatusName,DeliveryOption,DeliverySchedule,DeliveryDate,DeliveryAddress,POMast.PaymentTerms,POMast.ExchangeRate,POMast.UpdatedOn,Stat.StatusCode,POMast.ServiceWorkStatus,POMast.*,POMast.TotalOrderValue');
$this->db->select('ReqNo,POMast.PONO,POMast.PaymentTerms,POMast.PaymentOtherDescription,ServiceDescription,supp.SupplierID,supp.SupplierName,supp.Address,PODate,Stat.StatusName,DeliveryOption,DeliverySchedule,DeliveryDate,DeliveryAddress,POMast.PaymentTerms,POMast.ExchangeRate,POMast.UpdatedOn,Stat.StatusCode,POMast.ServiceWorkStatus,POMast.*,POMast.TotalOrderValue,POMast.BudgetType');
$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');
@ -853,17 +961,6 @@ function GetPOType($ReqNo)
function GetImportPurchaseOrderDetailsForPDF($PONO = '')
{
// $subQuery ='SELECT distinct LineItem.LineItemNo,LineItem.ReqNo,Mat.MaterialCode,Mat.MaterialName,
// Mat.UOM,Quantity,ReqMas.Requestedby,Rate,ROUND((RMCIncludingCustomersPerKG*Quantity),2)as Taxamount,
// ProductPrice,Tax.*,LineItem.CostCenterCode , POMaster.*,sup.SupplierName,sup.Address
// FROM T_PurchaseOrder_LineItem LineItem
// join T_Requestion_Master ReqMas on ReqMas.ReqNo=LineItem.ReqNo
// join T_MaterialMaster Mat on Mat.MaterialCode = LineItem.MaterialCode
// join T_Import_Tax Tax on Tax.LineItemNo = LineItem.LineItemNo
// join T_PurchaseOrder_Master POMaster on POMaster.PONO = LineItem.PONO
// join T_SupplierDetailsN sup on sup.SupplierID = POMaster.SupplierID
// where LineItem.PONO =?';
$subQuery='SELECT distinct LineItem.LineItemNo,LineItem.ReqNo,Mat.MaterialCode,Mat.MaterialName,Import_DispatchDetails,LineItem.Per,LineItem.ServiceMaterialDescription,
Mat.UOM,Quantity,ReqMas.Requestedby,Rate,ROUND((RMCIncludingCustomersPerKG*Quantity),2)as Taxamount ,
ProductPrice,Tax.*,LineItem.CostCenterCode ,Date(ReqMast.ReqDate) as ReqDate,POMaster.*,sup.SupplierName,sup.Address,LineItem.AmendedDetails as LineAmend,AdvanceAmount, Pay.PaymentTerms as Pay,ROUND((Quantity *Rate),2 ) as BasicValue,HSNCODE,sup.EmailAddress,sup.SupplierID,sup.PAN,sup.ContactNumber,sup.GSTNO
@ -879,7 +976,6 @@ join T_PaymentTerms Pay on POMaster.PaymentTerms=Pay.PaymentID
where LineItem.PONO =?';
$query = $this->db->query($subQuery,array($PONO));
//print_r($this->db->last_query());
return $query->result();
@ -892,7 +988,6 @@ where LineItem.PONO =?';
$subQuery='SELECT * from T_Currency_Details where Currency_Code=?';
$query=$this->db->query($subQuery,array($Currency));
//print_r($query);
return $query->result();
}
@ -921,7 +1016,6 @@ where LineItem.PONO =?';
{
$subQuery='SELECT * from T_Currency_Details where Currency_Code=?';
$query=$this->db->query($subQuery,array($Currencycode));
//print_r($this->db->last_query());
return $query->result();
}
@ -940,31 +1034,18 @@ where LineItem.PONO =?';
{
$subQuery='SELECT PaymentTerms from T_PurchaseOrder_Master where PONO=?';
$query=$this->db->query($subQuery,array($PONO));
//print_r($query);
return $query->result();
}
// function getSupplierPayment($Currency='')
// {
// $subQuery='select distinct PaymentTerms from T_SupplierDetailsN';
// $query=$this->db->query($subQuery,array($Currency));
// //print_r($this->db->last_query());
// return $query->result();
// }
function getSupplierPayment($Config_ID='')
{
// $subQuery='select distinct PaymentTerms from T_SupplierDetailsN';
$subQuery='select ConfigValue from T_ConfigDetails where Config_ID=?';
$query=$this->db->query($subQuery,array($Config_ID));
//print_r($this->db->last_query());
return $query->result();
}
@ -973,7 +1054,7 @@ where LineItem.PONO =?';
{
$subQuery = 'select ConfigValue from T_ConfigDetails where Config_ID=?';
$query=$this->db->query($subQuery,array($Config_ID));
//print_r($query);
return $query->result();
}
@ -984,7 +1065,7 @@ where LineItem.PONO =?';
function GetImportPurchaseOrderDetails($PONO = '')
{
$subQuery ='SELECT distinct LineItem.LineItemNo,Req.ReqNo,Mat.MaterialCode,Mat.MaterialName,LineItem.ServiceMaterialDescription,
$subQuery ='SELECT distinct LineItem.LineItemNo,Req.ReqNo,Mat.MaterialCode,Mat.MaterialName,
Mat.UOM,Quantity,Rate,Req.Status,ROUND((Quantity *Rate),2 ) as BasicValue,ReceivedQuantity,
QuantityRejected,ROUND(Quantity-ReceivedQuantity)as PendingQty,Per,
ROUND((RMCIncludingCustomersPerKG*Quantity),2)as Taxamount,LandingCharge,HighSeasSalesCharge,CustomDuty,ExciseDuty,ExciseDutyEdCess,CustomEdCess,POMast.ExchangeRate,AfterLandingCharge,AfterHighSeasSalesCharge,AfterCustomDuty,AfterExciseDuty,AfterExciseDutyEdCess,AddlExciseDuty,AfterAddlExciseDuty,Grossdutypayable,AvailableModvat,Grossexpensesduetocustomduty,purchaseratePerKG,CustomDutyExpensesPerKG,RMCIncludingCustomersPerKG,QuantityKG,BasicPriceInMTon,ProductPrice,CustomSHCess,AfterCustomSHCess,AfterExciseDutySHCess,ExciseDutySHCess,
@ -1365,7 +1446,7 @@ function GetCurrencytype()
$this->db->join('T_PurchaseOrder_LineItem req', 'req.PONO= mast.PONO');
$this->db->join('T_Requestion_Master rmast','rmast.ReqNo=req.ReqNo');
//$this->db->join('T_CostCenter_Budget bud','bud.CostCenterCode = req.CostCenterCode and bud.BudgetType = rmast.ReqType');
$this->db->join('T_CostCenter_Master ccm','ccm.CostCenterCode = req.CostCenterCode');
$this->db->join('T_CostCenter_Master ccm','ccm.CostCenterCode = req.CostCenterCode','left');
$this->db->join('tbl_users tbl', 'rmast.createdby=tbl.userid');
$this->db->join('T_Employee_Details as emp', 'emp.empid=tbl.empid');
$this->db->join('T_DepartmentDetails as Dep','Dep.DEPCode=emp.Departmentcode');
@ -1447,7 +1528,7 @@ left join T_Employee_Details emp on Req.Requestedby = emp.EmpID
function GetCapitalPurchaseOrderDetailsForPDF($PONO = '')
{
$subQuery ='SELECT distinct LineItem.LineItemNo,LineItem.Per,LineItem.AmendedDetails as lineamd,ReqNo,Mat.MaterialCode,Mat.MaterialName,
$subQuery ='SELECT distinct LineItem.LineItemNo,LineItem.Per,LineItem.AmendedDetails as lineamd,ReqNo,Mat.MaterialCode,Mat.MaterialName,LineItem.ServiceMaterialDescription,
Mat.UOM,Mat.HSNCODE,Quantity,Rate,ROUND((Quantity *Rate),2 ) as BasicValue ,
LineItem.CostCenterCode , POMaster.*,sup.SupplierName,sup.SupplierID,sup.Address,sup.ContactNumber,sup.EmailAddress,sup.PAN,sup.GSTNO,Payment.PaymentID,Payment.PaymentTerms,AdvanceAmount,HSNCODE
FROM T_PurchaseOrder_LineItem LineItem
@ -1765,7 +1846,6 @@ function GetRequistionMasterUsingReqNo($Req){
}
function amendpdf($PONO='')
{
$Amend ='select p.PONO,p.ParentPO,p.Status,p.TotalOrderValue,
@ -1775,11 +1855,85 @@ function amendpdf($PONO='')
join T_PurchaseOrder_Master as m
on m.PONO = p.ParentPO
where p.PONO = ?';
$amendment = $this->db->query($Amend,array($PONO));
return $amendment->result();
}
function updatefile($bill,$Picture,$oldfile)
{
// if($oldfile != ''){
// //unlink("uploads/BillFiles/".$oldfile);//this deletes the file on particular folder too
// }
$this->db->set('FilePath', $Picture); //value that used to update column
$this->db->where('BillNo', $bill); //which row want to upgrade
$this->db->update('T_PurchaseOrder_BillUpload');
$afftectedRows = $this->db->affected_rows();
return $afftectedRows;
}
function insertlogpo($logpo){
$this->db->trans_start();
$this->db->insert('T_POlog_Details',$logpo);
$insert_id = $this->db->affected_rows();
$this->db->trans_complete();
return $insert_id;
}
function getlogpodtl($PONO){
$SQL = "select log.*,sup.SupplierName,emp.FirstName from
T_POlog_Details log
join tbl_users user on user.userId = log.UpdateBy
left join T_Employee_Details emp on emp.EmpID= user.EmpID
left join T_SupplierDetailsN sup on sup.SupplierID = log.OldValue
where PONO ='".$PONO."'";
$logpodtl = $this->db->query($SQL);
return $logpodtl->result();
}
function insertfile($filelist)
{
$this->db->insert('T_PurchaseOrder_BillUpload',$filelist);
$myfile=$this->db->affected_rows();
return $myfile;
}
function updateigrM($PONO,$IGRNo,$igrMaster){
$this->db->where('PONO',$PONO);
$this->db->where('IGRNO',$IGRNo);
$this->db->update('T_IGR_Master',$igrMaster);
$r = $this->db->affected_rows();
return $r;
}
function getigrno($bill){
$subQuery ='select bill.BillNo,IGR.IGRNO, IGR.PONO FROM T_IGR_Master IGR
join T_PurchaseOrder_BillUpload bill on bill.IGRNO = IGR.IGRNO
where bill.BillNO = ? ';
$query = $this->db->query($subQuery,array($bill));
return $query->result_array();
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
<?php
<?php
$insuranceStatus = array(
array("name"=>"NO","value"=>"0"),array("name"=>"YES","value"=>"1")
);
@ -26,6 +26,7 @@
$TotalFreightvalue=0.0;
$totassesable=0;
$totSubtotal=0;
$totigst=0;
@ -200,8 +201,17 @@ else {
$AvlAmount = number_format($AvlCapitalBudAmt+$ExitTotalOrderValue, 2, '.', '');
}
//print_r($getlogpodtl);die;
if(!empty($getlogpodtl))
{
foreach ($getlogpodtl as $values )
{
$update=$values->FirstName;
}
}
@ -326,6 +336,22 @@ $('#otheroptiondiv').hide();
}
});
/*****************************/
var update = '<?php echo json_encode($update)?>';
if(update !='null')
{
$('#editpodiv').show();
}
else
{
$('#editpodiv').hide();
}
/*****************************/
var capitalType='';
window.onload = function()
@ -379,7 +405,6 @@ document.getElementById('currencyTypeDiv').style.display = 'block';
<script>
$(document).ready(function(){
if($("#EditCgst").val() != '' ){$("#EditIgst").prop("readonly", true);}
$("#PaymentMethod").select2();
//Initialize Select2 Elements
$("#drpSupplier").select2();
@ -390,9 +415,9 @@ $("#PaymentMethod").select2();
$("#PODate").datepicker({
//minDate : d,
maxDate : 'now',
dateFormat: 'dd-mm-yy',changeMonth: true, changeYear: true,yearRange: '-100:+0'
});
// maxDate : 'now',
dateFormat: 'dd-mm-yy',changeMonth: true, changeYear: true
});//,yearRange: '-100:+0'
$("#Deliverydt").datepicker({
minDate : 'now',
dateFormat: 'dd-mm-yy',changeMonth: true, changeYear: true,yearRange: '0:+10'
@ -529,7 +554,8 @@ $("#PaymentMethod").select2();
echo form_dropdown('drpSupplier', $options2,set_value('drpSupplier',$SupId),'id="drpSupplier"' ,'required="true"' ,'class="form-control select2');
?>
?> <input type="hidden" name="b4supplier" id="b4supplier" value="<?php echo $SupId;?>">
<input type="hidden" name="newsup" id="changeSup">
</div>
<div class="col-md-12"><br/>
@ -561,7 +587,7 @@ $("#PaymentMethod").select2();
<?php
$data = array('name' => 'PODate','value' => set_value('PODate',$PODate),'id'=>'PODate', 'class' => 'form-control num' ,'required' => 'true', 'onkeypress'=>'return false;');
echo form_input($data);
?>
?> <input type="hidden" name="b4podate" id="b4podate" value="<?php echo $PODate;?>">
</div>
</div>
</div>
@ -888,6 +914,8 @@ $("#PaymentMethod").select2();
</div>
</div>
<div class="col-md-2" style="padding-right: 0px;">
<label for="BudgetType">Budget Type</label>
<select id='BudgetType' name='BudgetType'>
@ -911,6 +939,9 @@ $("#PaymentMethod").select2();
</div>
</div><!--End new fields 1 sep-->
</div>
@ -1114,12 +1145,16 @@ $("#PaymentMethod").select2();
<input type="hidden" name="<?php echo 'per'.$index ?>" id="<?php echo 'per'.$index ?>" value="<?php echo $record->Per ; ?>" />
<input type="hidden" name="<?php echo 'CapitalItemDescrition'.$index ?>" id="<?php echo 'CapitalItemDescrition'.$index ?>" value="<?php echo $record->ServiceMaterialDescription ; ?>" />
<input type="hidden" name="<?php echo 'quantity'.$index ?>" id="<?php echo 'quantity'.$index ?>" value="<?php echo $record->Quantity ; ?>" />
<input align="right" type="hidden" name="<?php echo 'b4qty'.$index ?>" id="<?php echo 'b4qty'.$index ?>" value="<?php echo $record->Quantity ; ?>" />
<input type="hidden" name="<?php echo 'itemRate'.$index ?>" id="<?php echo 'itemRate'.$index ?>" value="<?php echo $record->Rate ; ?>" />
<input align="right" type="hidden" name="<?php echo 'b4rate'.$index ?>" id="<?php echo 'b4rate'.$index ?>" value="<?php echo $record->Rate ; ?>" />
<?php if($CapitalRange=='1'){ ?>
<input type="hidden" name="<?php echo 'rateInUs'.$index ?>" id="<?php echo 'rateInUs'.$index ?>" value="<?php echo $record->Rate ; ?>" />
<input type="hidden" name="<?php echo 'Cgst'.$index ?>" id="<?php echo 'Cgst'.$index ?>" value="<?php echo $record->CGST ; ?>" />
<input type="hidden" name="<?php echo 'AfterCgst'.$index ?>" id="<?php echo 'AfterCgst'.$index ?>" value="<?php echo $record->After_CGST ; ?>" />
@ -3766,6 +3801,79 @@ $("#PaymentMethod").select2();
</div>
</div>
<!--################################################################## -->
<?php if(!empty($update)){?>
<div class="col-md-12" id="editpodiv">
<div class="col-md-12"><label>Editable POScreen</label>
<table id="edittable" class="table table-hover table-bordered" style="background-color:#fff;font-size:12px;" >
<thead style="background-color:#ddf">
<tr>
<th>Sno</th>
<th>PONO</th>
<!-- <th>Material</th> -->
<!-- <th>Date</th> -->
<th>LineItemNo</th>
<th>Entity</th>
<th>OldValue</th>
<th>NewValue</th>
<th>UpdatedBy</th>
<th>UpdateOn</th>
</tr>
</thead>
<tbody>
<?php
if(!empty($getlogpodtl))
{
//print_r($getlogpodtl); die;
$inde = 0;
foreach($getlogpodtl as $oldpo)
{
$inde = $inde+1;
?>
<tr id="<?php echo $inde ; ?>">
<td><?php echo $inde; ?></td>
<td><?php echo $oldpo->PONO ?></td>
<td><?php echo $oldpo->LineItemNo;?></td>
<td><?php echo $oldpo->Entity?></td>
<?php if($oldpo->entity =='PO DateChanged'){
$oldValue = date('d-m-Y',strtotime($oldpo->OldValue));
}else{
$oldValue = $oldpo->OldValue;
}?>
<td><?php if(!empty($oldpo->SupplierName)){echo $oldValue.'-'.$oldpo->SupplierName;}else{echo $oldValue;} ?></td>
<?php if($oldpo->entity =='PO DateChanged'){
$newValue = date('d-m-Y',strtotime($oldpo->NewValue));
}else{
$newValue = $oldpo->NewValue;
}?>
<td><?php echo $newValue ?></td>
<td><?php echo $oldpo->FirstName?></td>
<td><?php $date = new DateTime($oldpo->UpdatedOn);
echo $date->format('d-m-Y'); ?></td>
</tr>
<?php
}
}
?>
</tbody>
<?php } else {}?>
</table>
</div>
</div>
<div class="col-md-12">
<label>Special Instructions </label> <?php
$data = array('name' => 'txtSpcialInstruction','value' => set_value('txtSpcialInstruction',$ServiceDescription),'id'=>'txtSpcialInstruction', 'class' => 'form-control','rows' => '10', 'cols' => '40' );
@ -3920,7 +4028,7 @@ var myArray = <?php echo json_encode($res_arr_values); ?>;
});
var capital=<?php echo json_encode($CapitalRange, JSON_PRETTY_PRINT) ?>;
//alert(capital);
//swal(capital);
if(capital==0)
{
$('#CAPdiv').hide();
@ -3940,6 +4048,11 @@ var myArray = <?php echo json_encode($res_arr_values); ?>;
}
$('#drpSupplier').change(function() {
var cd = $("#drpSupplier option:selected").text();
//swal(cd);
$("#changeSup").val(cd);
var PaymentOtherData = '<?php echo $otherPayment; ?>';
var id = $('#drpSupplier').val();
var supPaymentTerms='';
@ -4005,7 +4118,7 @@ var PaymentOtherData = '<?php echo $otherPayment; ?>';
}
else
{
alert('Please select the SupplierID');
swal('Please select the SupplierID');
return false;
}
@ -4091,7 +4204,7 @@ var PaymentOtherData = '<?php echo $otherPayment; ?>';
}
else
{
alert('Please select the Requisition Number');
swal('Please select the Requisition Number');
return false;
}
id = '';
@ -4134,7 +4247,7 @@ var PaymentOtherData = '<?php echo $otherPayment; ?>';
}
else
{
alert('Please select the MaterialCode');
swal('Please select the MaterialCode');
return false;
}
@ -4176,7 +4289,7 @@ var PaymentOtherData = '<?php echo $otherPayment; ?>';
}
else
{
alert('Please select the MaterialCode');
swal('Please select the MaterialCode');
return false;
}
@ -4226,12 +4339,10 @@ var PaymentOtherData = '<?php echo $otherPayment; ?>';
}
function ChangeSgst(){
$('#Sgst').val($('#Cgst').val());
$("#Igst").prop("readonly", true);
Ratechange();
}
function ChangeEditSgst(){
$('#EditSgst').val($('#EditCgst').val());
$("#EditIgst").prop("readonly", true);
EditRatechange();
}
/*
@ -4244,19 +4355,19 @@ EditRatechange();
if($('#Reqnumber').val() == "0")
{
alert('Please select the Requisition Number');
swal('Please select the Requisition Number');
$('#Reqnumber').focus();
return false;
}
else if($('#MaterialCode').val() == "0")
{
alert('Please select the Material Code');
swal('Please select the Material Code');
$('#MaterialCode').focus();
return false;
}
else if($('#CostCenter').val() == "0")
{
alert('Please select the CostCenterCode');
swal('Please select the CostCenterCode');
$('#CostCenter').focus();
return false;
}
@ -4380,20 +4491,20 @@ Calculateloadingcharge();
// }
// }
// else{
// //alert('Please Enter Excise duty S & H cess');
// //swal('Please Enter Excise duty S & H cess');
// }
// }
// else{
// //alert('Please Enter Excise Duty ED_cess');
// //swal('Please Enter Excise Duty ED_cess');
// }
// }
// else{
// //alert('Please Enter Excise Duty');
// //swal('Please Enter Excise Duty');
// }
// }
// else{
// //alert('Please Enter Custom Duty');
// //swal('Please Enter Custom Duty');
// }
// }
@ -4401,7 +4512,7 @@ Calculateloadingcharge();
// }
// else{
// //alert('Please Enter Landing Charge ')
// //swal('Please Enter Landing Charge ')
// }
@ -4438,18 +4549,19 @@ Calculateloadingcharge();
{
var EnterQuantity = $("#CPQuantity").val()== '' ? "0.00" : parseFloat($("#CPQuantity").val());
var ReqQuantity = parseFloat(RequistQuantity);
//alert(ReqQuantity);
if(EnterQuantity > ReqQuantity)
{
alert('Your exceeding the Quantity from the Requisition Quantity:'+ RequistQuantity +'.Please adjust the Quantity to proceed further.');
//swal(ReqQuantity);
//if(EnterQuantity > ReqQuantity)
// {
// swal('Your exceeding the Quantity from the Requisition Quantity:'+ RequistQuantity +'.Please adjust the Quantity to proceed further.');
$('#CPQuantity').focus();
return false;
}
else {
// $('#CPQuantity').focus();
// return false;
// }
// else
//{
return true;
}
//}
}
/*
This function is used to calculate tax
@ -4791,7 +4903,7 @@ if(isNaN(CustomDutyExpenses))
// if(ReqAmount > BudAmount )
// {
// alert('Your exceeding the Avaiable Budget :'+ BudAmount +'.Please adjust the Product to proceed further.');
// swal('Your exceeding the Avaiable Budget :'+ BudAmount +'.Please adjust the Product to proceed further.');
// return false;
// }
@ -5038,7 +5150,7 @@ if(isNaN(CustomDutyExpenses))
}
// if(basicAmountRate > avalbudAmt)
// {
// alert('Basic amount is exceeding the Budget Limit.Please adjust the product value.');
// swal('Basic amount is exceeding the Budget Limit.Please adjust the product value.');
// $('#CPRate').focus();
// return false;
// }
@ -5052,49 +5164,49 @@ if(isNaN(CustomDutyExpenses))
{
if($('#Reqnumber').val() == "0")
{
alert('Please select the Requisition Number');
swal('Please select the Requisition Number');
$('#Reqnumber').focus();
return false;
}
else if($('#CostCenter').val() == "0")
{
alert('Please select the Cost center');
swal('Please select the Cost center');
$('#CostCenter').focus();
return false;
}
else if($('#MaterialCode').val() == "0")
{
alert('Please select the Material Code');
swal('Please select the Material Code');
$('#MaterialCode').focus();
return false;
}
else if($('#CPQuantity').val() == '')
{
alert('Please Enter the Quantity value');
swal('Please Enter the Quantity value');
$('#CPQuantity').focus();
return false;
}
else if($('#CPQuantity').val() == "0")
{
alert('Please Enter the Valid Quantity value');
swal('Please Enter the Valid Quantity value');
$('#CPQuantity').focus();
return false;
}
else if($('#CPRate').val() == '')
{
alert('Please Enter the Rate of the Item');
swal('Please Enter the Rate of the Item');
$('#CPRate').focus();
return false;
}
else if($('#CPRate').val() == "0")
{
alert('Please Enter the Valid Rate of the Item');
swal('Please Enter the Valid Rate of the Item');
$('#CPRate').focus();
return false;
}
/* else if($('#ItemDescription').val() == '')
{
alert('Please Enter the Capital Description');
swal('Please Enter the Capital Description');
$('#ItemDescription').focus();
return false;
} */
@ -5474,7 +5586,7 @@ function DeleteRow(rowid)
});
// alert(result);
// swal(result);
if(result == '0')
{
var DelRows = $('#txtDeletedRow').val();
@ -5514,11 +5626,11 @@ function DeleteRow(rowid)
if(data)
{
$('#content').loader('hide');
alert(data);
swal(data);
}
else
{
alert("Error");
swal("Error");
}
}});
@ -5759,7 +5871,7 @@ function DeleteRow(rowid)
$('#isEdit').val(1);
//alert(userid);
//swal(userid);
var tr= document.getElementById(userid);
var cellval = tr.cells;
@ -5785,7 +5897,6 @@ function DeleteRow(rowid)
$('#EditCgst').val($('#Cgst'+userid).val());
$('#EditSgst').val($('#Sgst'+userid).val());
$('#EditIgst').val($('#Igst'+userid).val());
if($('#Cgst'+userid).val() != '0.00'){$("#EditIgst").prop("readonly", true);}
$('#EditAfterCgst').val($('#AfterCgst'+userid).val());
$('#EditAfterSgst').val($('#AfterSgst'+userid).val());
$('#EditAfterIgst').val($('#AfterIgst'+userid).val());
@ -5803,7 +5914,7 @@ function DeleteRow(rowid)
if (FreightType == "PER TRIP")
{
///salert();
///sswal();
$('#TripsValuelocedit').show();
}
@ -5911,7 +6022,7 @@ function DeleteRow(rowid)
$('#isEdit').val(1);
//alert(userid);
//swal(userid);
var tr= document.getElementById(userid);
var cellval = tr.cells;
@ -6076,7 +6187,7 @@ function DeleteRow(rowid)
}
else
{
alert('Please select the MaterialCode');
swal('Please select the MaterialCode');
return false;
}
@ -6127,7 +6238,7 @@ $("#EdittxtTotalOrderValue").val('');
}
function Save(status)
{ //alert('save function');
{ //swal('save function');
if(status == '0')
@ -6166,27 +6277,27 @@ var basicAmountRate = parseFloat($('#CapitalToatlOrder').val());
{
if(document.getElementById('serviceTax').rows.length < 2)
{
alert('Please Select Line item to Create PO');
swal('Please Select Line item to Create PO');
$('#Deliverydt').focus();
return false;
}
else if($('#Otherpayment').val()=='' && $('#PaymentMethod').val()=='PT08'){
alert('Please Enter Other Payable Terms Description');
swal('Please Enter Other Payable Terms Description');
$('#Otherpayment').focus();
return false;
}
// else if(parseInt(AvlBudAmt) < parseInt(basicAmountRate)) {
// alert('Total Order Amount is exceeding the Budget Limit.Please adjust the product value.');
// swal('Total Order Amount is exceeding the Budget Limit.Please adjust the product value.');
// return false;
// }
else
{
//alert('else');
//swal('else');
$('#content').loader('show');
//alert('ss');
//swal('ss');
$.ajax({
@ -6197,7 +6308,7 @@ var basicAmountRate = parseFloat($('#CapitalToatlOrder').val());
success:function(data) {
if(data)
{
alert(data);
swal(data);
$('#content').loader('hide');
$('#txtRowCount').val('');
@ -6212,7 +6323,7 @@ var basicAmountRate = parseFloat($('#CapitalToatlOrder').val());
else
{
$('#content').loader('hide');
alert("Error");
swal("Error");
}
}
@ -6260,19 +6371,19 @@ function clearAfterAddLineItemAdd(){
if($('#EditReqnumber').val() == "0")
{
alert('Please select the Requisition Number');
swal('Please select the Requisition Number');
$('#EditReqnumber').focus();
return false;
}
else if($('#EditMaterialCode').val() == "0")
{
alert('Please select the Material Code');
swal('Please select the Material Code');
$('#EditMaterialCode').focus();
return false;
}
else if($('#EditCostCenter').val() == "0")
{
alert('Please select the CostCenterCode');
swal('Please select the CostCenterCode');
$('#EditCostCenter').focus();
return false;
}
@ -6315,7 +6426,7 @@ var Freight=parseFloat($('#txtAfterFreightlocedit').val() == '' ? '0.00' : $('#t
var editCPtotal=parseFloat(BasicInINR)+parseFloat(Freight);
// alert(editCPtotal);
// swal(editCPtotal);
$('#EditCPTotalAmount').val(parseFloat(Tot).toFixed(2));
@ -6402,20 +6513,20 @@ var Freight=parseFloat($('#txtAfterFreightlocedit').val() == '' ? '0.00' : $('#t
// }
// }
// else{
// //alert('Please Enter Excise duty S & H cess');
// //swal('Please Enter Excise duty S & H cess');
// }
// }
// else{
// //alert('Please Enter Excise Duty ED_cess');
// //swal('Please Enter Excise Duty ED_cess');
// }
// }
// else{
// //alert('Please Enter Excise Duty');
// //swal('Please Enter Excise Duty');
// }
// }
// else{
// //alert('Please Enter Custom Duty');
// //swal('Please Enter Custom Duty');
// }
// }
@ -6423,7 +6534,7 @@ var Freight=parseFloat($('#txtAfterFreightlocedit').val() == '' ? '0.00' : $('#t
// }
// else{
// //alert('Please Enter Landing Charge ')
// //swal('Please Enter Landing Charge ')
// }
EditcalculateTotalValue();
@ -6452,7 +6563,7 @@ var Freight=parseFloat($('#txtAfterFreightlocedit').val() == '' ? '0.00' : $('#t
function ViewRatechange()
{
//alert('fdc');
//swal('fdc');
var txtQuantity = parseFloat( $('#ViewCPQuantity').val());
//var txtExchangeRate = parseFloat( $('#EditExchangeRtModal').val());
var RatePerTon = parseFloat( $('#ViewCPRate').val());
@ -6495,19 +6606,20 @@ var Freight=parseFloat($('#txtAfterFreightlocview').val() == '' ? '0.00' : $('#t
var EnterQuantity = $("#EditCPQuantity").val()== '' ? "0.00" : parseFloat($("#EditCPQuantity").val());
var ReqQuantity = parseFloat(RequistQuantity);
//alert(ReqQuantity);
if(EnterQuantity > ReqQuantity)
{
alert('Your exceeding the Quantity from the Requisition Quantity:'+ RequistQuantity +'.Please adjust the Quantity to proceed further.');
//swal(ReqQuantity);
// if(EnterQuantity != ReqQuantity)
// {
// swal('Your exceeding the Quantity from the Requisition Quantity:'+ RequistQuantity +'.Please adjust the Quantity to proceed further.');
$('#EditCPQuantity').focus();
return false;
}
else {
// $('#EditCPQuantity').focus();
// return false;
// }
// else
// {
return true;
}
//}
}
/**
* This function is used for Edit Capital
@ -6788,49 +6900,49 @@ function validateEditCapitalTax()
if($('#EditReqnumber').val() == "0")
{
alert('Please select the Requisition Number');
swal('Please select the Requisition Number');
$('#EditReqnumber').focus();
return false;
}
else if($('#EditCostCenter').val() == "0")
{
alert('Please select the Cost center');
swal('Please select the Cost center');
$('#EditCostCenter').focus();
return false;
}
else if($('#EditMaterialCode').val() == "0")
{
alert('Please select the Material Code');
swal('Please select the Material Code');
$('#EditMaterialCode').focus();
return false;
}
else if($('#EditCPQuantity').val() == '')
{
alert('Please Enter the Quantity value');
swal('Please Enter the Quantity value');
$('#EditCPQuantity').focus();
return false;
}
else if($('#EditCPQuantity').val() == "0")
{
alert('Please Enter the Valid Quantity value');
swal('Please Enter the Valid Quantity value');
$('#EditCPQuantity').focus();
return false;
}
else if($('#EditCPRate').val() == '')
{
alert('Please Enter the Rate of the Item');
swal('Please Enter the Rate of the Item');
$('#EditCPRate').focus();
return false;
}
else if($('#EditCPRate').val() == "0")
{
alert('Please Enter the Valid Rate of the Item');
swal('Please Enter the Valid Rate of the Item');
$('#EditCPRate').focus();
return false;
}
/* else if($('#EditItemDescription').val() == '')
{
alert('Please Enter the Capital Description');
swal('Please Enter the Capital Description');
$('#EditItemDescription').focus();
return false;
} */
@ -6929,7 +7041,7 @@ var Freight=parseFloat($('#txtAfterFreightlocedit').val() == '' ? '0.00' : $('#t
}
// if(basicAmountRate > avalbudAmt)
// {
// alert('Basic amount is exceeding the Budget Limit.Please adjust the product value.');
// swal('Basic amount is exceeding the Budget Limit.Please adjust the product value.');
// $('#EditCPRate').focus();
// return false;
// }
@ -7349,7 +7461,7 @@ $('#drpFreight').change(function() {
}
else
{
alert('Please Enter the Rate value');
swal('Please Enter the Rate value');
$('#drpFreight').val("0");
$('#CPRate').focus();
}
@ -7390,7 +7502,7 @@ $('#drpEditFreight').change(function() {
}
else
{
alert('Please Enter the Rate value');
swal('Please Enter the Rate value');
$('#drpEditFreight').val("0");
$('#EditCPRate').focus();
}
@ -7431,7 +7543,7 @@ $('#drpViewFreight').change(function() {
}
else
{
alert('Please Enter the Rate value');
swal('Please Enter the Rate value');
$('#drpViewFreight').val("0");
$('#ViewCPRate').focus();
}
@ -7446,7 +7558,7 @@ function calculateFreight(isEdit)
if($('#AfterBasicPriceTax').val() == '')
{
alert('Please Enter the Rate value');
swal('Please Enter the Rate value');
$('#CPRate').focus();
$('#txtFreight').val('') ;
return false;
@ -7458,7 +7570,7 @@ function calculateFreight(isEdit)
var FreightType =$("#drpFreight").val();
if(FreightType == "0")
{
alert('Please select Freight Type');
swal('Please select Freight Type');
$('#txtFreight').val('');
$("#drpFreight").focus();
}
@ -7491,7 +7603,7 @@ function calculateFreight(isEdit)
else if(FreightType == '<?php echo PERTRIP;?>')
{
if($('#NOOfTrips').val()==''){
alert('Please Enter No of Trip');
swal('Please Enter No of Trip');
$("#NOOfTrips").focus();
$('#txtFreight').val(0)
@ -7526,7 +7638,7 @@ function calculateFreight(isEdit)
if($('#ViewAfterBasicPriceTax').val() == '')
{
alert('Please Enter the Rate value');
swal('Please Enter the Rate value');
$('#ViewCPRate').focus();
$('#txtViewFreight').val('') ;
return false;
@ -7538,7 +7650,7 @@ function calculateFreight(isEdit)
var FreightType =$("#drpViewFreight").val();
if(FreightType == "0")
{
alert('Please select Freight Type');
swal('Please select Freight Type');
$('#txtViewFreight').val('');
$("#drpViewFreight").focus();
}
@ -7547,7 +7659,7 @@ function calculateFreight(isEdit)
var FreightValue = parseFloat($('#txtViewFreight').val());
var Quantity = parseFloat($('#ViewCPQuantity').val());
//alert(FreightType);
//swal(FreightType);
var AfterFreight = 0.0;
if(FreightType == '<?php echo PERCENTAGE;?>')
{
@ -7568,7 +7680,7 @@ function calculateFreight(isEdit)
else if(FreightType == '<?php echo PERTRIP;?>')
{
if($('#ViewNOOfTrips').val()==''){
alert('Please Enter No of Trip');
swal('Please Enter No of Trip');
$("#ViewNOOfTrips").focus();
$('#txtViewFreight').val(0)
@ -7637,7 +7749,7 @@ function calculateFreight(isEdit)
else if(FreightType == '<?php echo PERTRIP;?>')
{
if($('#NOOfTrips').val()==''){
alert('Please Enter No of Trip');
swal('Please Enter No of Trip');
$("#NOOfTrips").focus();
$('#txtFreight').val(0)
@ -7681,7 +7793,7 @@ function calculateFreight(isEdit)
var FreightValue = parseFloat($('#txtEditFreight').val());
var Quantity = parseFloat($('#EditCPQuantity').val());
//alert(FreightType);
//swal(FreightType);
var AfterFreight = 0.0;
if(FreightType == '<?php echo PERCENTAGE;?>')
{
@ -7702,7 +7814,7 @@ function calculateFreight(isEdit)
else if(FreightType == '<?php echo PERTRIP;?>')
{
if($('#EditNOOfTrips').val()==''){
alert('Please Enter No of Trip');
swal('Please Enter No of Trip');
$("#EditNOOfTrips").focus();
$('#txtEditFreight').val(0)
@ -7735,7 +7847,7 @@ function calculateFreight(isEdit)
{
if($('#EditAfterBasicPriceTax').val() == '')
{
alert('Please Enter the Rate value');
swal('Please Enter the Rate value');
$('#EditCPRate').focus();
$('#txtEditFreight').val('') ;
return false;
@ -7747,7 +7859,7 @@ function calculateFreight(isEdit)
var FreightType =$("#drpEditFreight").val();
if(FreightType == "0")
{
alert('Please select Freight Type');
swal('Please select Freight Type');
$('#txtEditFreight').val('');
$("#drpEditFreight").focus();
}
@ -7756,7 +7868,7 @@ function calculateFreight(isEdit)
var FreightValue = parseFloat($('#txtEditFreight').val());
var Quantity = parseFloat($('#EditCPQuantity').val());
//alert(FreightType);
//swal(FreightType);
var AfterFreight = 0.0;
if(FreightType == '<?php echo PERCENTAGE;?>')
{
@ -7777,7 +7889,7 @@ function calculateFreight(isEdit)
else if(FreightType == '<?php echo PERTRIP;?>')
{
if($('#EditNOOfTrips').val()==''){
alert('Please Enter No of Trip');
swal('Please Enter No of Trip');
$("#EditNOOfTrips").focus();
$('#txtEditFreight').val(0)
@ -7834,7 +7946,7 @@ function calculateFreight(isEdit)
}
else
{
alert('Please Rate Field Value');
swal('Please Rate Field Value');
$('#CPRate').focus();
}
@ -7864,7 +7976,7 @@ $('#EditDiscountType').change(function() {
}
else
{
alert('Please Select MaterialCode and Rate Field Value');
swal('Please Select MaterialCode and Rate Field Value');
$('#EditDiscountType').val("0");
$('#EditCPRate').focus();
}
@ -7881,7 +7993,7 @@ function calculateDiscount(isEdit)
if($('#CPRate').val() == '')
{
alert('Please Enter the Rate value');
swal('Please Enter the Rate value');
$('#CPRate').focus();
$('#txtDiscount').val('');
return false;
@ -7894,7 +8006,7 @@ function calculateDiscount(isEdit)
if(DiscountType == "0")
{
alert('Please Select the discount Type');
swal('Please Select the discount Type');
$('#txtDiscount').val('');
$("#DiscountType").focus();
}
@ -7940,7 +8052,7 @@ function calculateDiscount(isEdit)
if(DiscountType == "0")
{
alert('Please Select the discount Type');
swal('Please Select the discount Type');
$('#txtEditDiscount').val('');
$("#EditDiscountType").focus();
}
@ -8065,7 +8177,7 @@ $('#drpFreightloc').change(function()
}
else
{
alert('Please Select MaterialCode and Rate Field Value');
swal('Please Select MaterialCode and Rate Field Value');
$('#drpFreightloc').val("0");
$('#Rate').focus();
}
@ -8236,7 +8348,7 @@ $('#drpFreighteditloc').change(function()
}
else
{
alert('Please Select MaterialCode and Rate Field Value');
swal('Please Select MaterialCode and Rate Field Value');
$('#drpFreighteditloc').val("0");
$('#Rate').focus();
}
@ -8566,7 +8678,7 @@ function populateValueMainFormForupdateCapitalTax()
function EditCalculateloadingcharge()
{
//alert();
//swal();
var txtlanding=0;
var txtbasicprice=0;
var asss=0;
@ -8586,12 +8698,12 @@ function EditCalculateloadingcharge()
// var Assessable= <?php echo ASSESSBLE;?>;
var Assessable=parseFloat(txtbasicprice)+parseFloat(asss);
//console.log(Assessable);
//alert(Assessable);
//swal(Assessable);
$('#EditAfterLandingCharge').val(result.toFixed(2));
$('#EditAfterAssessable').val(Assessable);
EditCalculateCustomduty();
//alert();
//swal();
}
@ -8666,7 +8778,7 @@ txtedcesspercentage=parseFloat($('#EditCustomEDcess').val() == '' ? '0.00' : $('
function EditCalculateCustomSHcess()
{//alert();
{//swal();
var landingch=0;
var highsesssalles=0;
@ -8855,7 +8967,7 @@ function EditCalculateCtable()
function Calculateloadingcharge()
{
//alert();
//swal();
$('#AfterHighseas').val('');
$('#AfterCustomduty').val('');
$('#AfterExcisedutyTax').val('');
@ -8995,7 +9107,7 @@ var txtcustompercentage=parseFloat($('#Customduty').val() == '' ? '0.00' : $('#C
function CalculateCustomSHcess()
{//alert();
{//swal();
var landingch=0;
@ -9178,11 +9290,3 @@ function CalculateCtable()
}
</script>

File diff suppressed because it is too large Load Diff

View File

@ -5,19 +5,16 @@ $Value='';
$EXCRATE=0;
$parentPO= '';
$ServiceDescription='';
$Value=$unicode;
$Currencycode=$currencycode;
$Terms='';
$Terms='';
$DeliverySchedule='';
foreach ($CurrencyDetail as $Detail)
{
$Cur=$Detail->Currency_Code.' '.' - '.' '.$Detail->Country_and_Currency;
}
//echo $Cur;
foreach ($PaymentTerms as $TER)
@ -206,6 +203,17 @@ if(!empty($RequistionDetails))
}
}
if(!empty($getlogpodtl))
{
foreach ($getlogpodtl as $values )
{
$update=$values->FirstName;
}
}
?>
<style>
@ -282,6 +290,24 @@ tinymce.init({
});
/*****************************/
var update = '<?php echo json_encode($update)?>';
if(update !='null')
{
$('#editpodiv').show();
}
else
{
$('#editpodiv').hide();
}
/*****************************/
//Initialize Select2 Elements
//$("#drpSupplier").select2();
$("#currencytype").select2();
@ -292,10 +318,10 @@ tinymce.init({
var m=new Date(t);
$("#PODate").datepicker({
minDate : d,
maxDate : 'now',
dateFormat: 'dd-mm-yy',changeMonth: true, changeYear: true,yearRange: '-100:+0'
});
//minDate : d,
//maxDate : 'now',
dateFormat: 'dd-mm-yy',changeMonth: true, changeYear: true
});//,yearRange: '-100:+0'
// $("#PayableAT").datepicker({
// minDate : m,
@ -454,8 +480,8 @@ tinymce.init({
echo form_dropdown('drpSupplier', $options,set_value('drpSupplier',$SupId),'id="drpSupplier"' ,'required="true"' ,'class="form-control select2');
?>
?> <input type="hidden" name="b4supplier" id="b4supplier" value="<?php echo $SupId;?>">
<input type="hidden" name="newsup" id="changeSup">
</div>
@ -504,7 +530,7 @@ tinymce.init({
<?php
$data = array('name' => 'PODate','value' => set_value('PODate',$PODate),'id'=>'PODate', 'class' => 'form-control' ,'required' => 'true', 'onkeypress'=>'return false;');
echo form_input($data);
?>
?> <input type="hidden" name="b4podate" id="b4podate" value="<?php echo $PODate;?>">
</div>
</div>
</div>
@ -2750,7 +2776,9 @@ echo form_textarea($data);
<input type="hidden" name="<?php echo 'materialName'.$index ?>" id="<?php echo 'materialName'.$index ?>" value="<?php echo $record->MaterialName ; ?>" />
<input type="hidden" name="<?php echo 'uom'.$index ?>" id="<?php echo 'uom'.$index ?>" value="<?php echo $record->UOM ; ?>" />
<input type="hidden" name="<?php echo 'quantity'.$index ?>" id="<?php echo 'quantity'.$index ?>" value="<?php echo $record->Quantity ; ?>" />
<input align="right" type="hidden" name="<?php echo 'b4qty'.$index ?>" id="<?php echo 'b4qty'.$index ?>" value="<?php echo $record->Quantity ; ?>" />
<input type="hidden" name="<?php echo 'itemRate'.$index ?>" id="<?php echo 'itemRate'.$index ?>" value="<?php echo $record->Rate ; ?>" />
<input align="right" type="hidden" name="<?php echo 'b4rate'.$index ?>" id="<?php echo 'b4rate'.$index ?>" value="<?php echo $record->Rate ; ?>" />
<input type="hidden" name="<?php echo 'LandingCharge'.$index ?>" id="<?php echo 'LandingCharge'.$index ?>" value="<?php echo $record->LandingCharge; ?>" />
<input type="hidden" name="<?php echo 'AfterLandingCharge'.$index ?>" id="<?php echo 'AfterLandingCharge'.$index ?>" value="<?php echo $record->AfterLandingCharge; ?>" />
@ -2884,7 +2912,7 @@ echo form_textarea($data);
// $totorder=$record->TotalOrderValue;
// //$ServiceDescription=$record->ServiceDescription;
// echo $totorder;
//alert($totorder);
//swal($totorder);
}
@ -3037,7 +3065,73 @@ echo form_textarea($data);
</div>
<input type="hidden" name="txttot" id="txttot" value=<?php echo $totalhidden?>>
<!--################################################################## -->
<?php if(!empty($update)){?>
<div class="col-md-12" id="editpodiv">
<div class="col-md-12"><label>Editable POScreen</label>
<table id="edittable" class="table table-hover table-bordered" style="background-color:#fff;font-size:12px;" >
<thead style="background-color:#ddf">
<tr>
<th>Sno</th>
<th>PONO</th>
<!-- <th>Material</th> -->
<!-- <th>Date</th> -->
<th>LineItemNo</th>
<th>Entity</th>
<th>OldValue</th>
<th>NewValue</th>
<th>UpdatedBy</th>
<th>UpdateOn</th>
</tr>
</thead>
<tbody>
<?php
if(!empty($getlogpodtl))
{
//print_r($getlogpodtl); die;
$inde = 0;
foreach($getlogpodtl as $oldpo)
{
$inde = $inde+1;
?>
<tr id="<?php echo $inde ; ?>">
<td><?php echo $inde; ?></td>
<td><?php echo $oldpo->PONO ?></td>
<td><?php echo $oldpo->LineItemNo;?></td>
<td><?php echo $oldpo->Entity?></td>
<?php if($oldpo->Entity =='PO DateChanged'){
$oldValue = date('d-m-Y',strtotime($oldpo->OldValue));
}else{
$oldValue = $oldpo->OldValue;
}?>
<td><?php if(!empty($oldpo->SupplierName)){echo $oldValue.'-'.$oldpo->SupplierName;}else{echo $oldValue;} ?></td>
<?php if($oldpo->entity =='PO DateChanged'){
$newValue = date('d-m-Y',strtotime($oldpo->NewValue));
}else{
$newValue = $oldpo->NewValue;
}?>
<td><?php echo $newValue ?></td>
<td><?php echo $oldpo->FirstName?></td>
<td><?php $date = new DateTime($oldpo->UpdatedOn);
echo $date->format('d-m-Y'); ?></td>
</tr>
<?php
}
}
?>
</tbody>
<?php } else {}?>
</table>
</div>
</div>
<div class="col-md-12">
@ -3157,7 +3251,7 @@ var AvilBudAmt = '';
//var index='';
var index= '<?php echo $index; ?>';
//alert(index);
//swal(index);
// var index=$('#txtRowCount').val();
var userid = '';
var NilType = '<?php echo NILTYPE;?>';
@ -3226,7 +3320,7 @@ else
var paymentoption=<?php echo json_encode($PaymentTerms,JSON_PRETTY_PRINT)?>;
var payvalue=<?php echo json_encode($PaymentTermsCode,JSON_PRETTY_PRINT)?>;
//alert(payvalue);
//swal(payvalue);
if(paymentoption=='PT08')
{
$('#otheroptiondiv').show();
@ -3253,7 +3347,7 @@ var budamt=<?php echo $AvilableBudget; ?>;
$('#EditAvlBudAmt').val(<?php echo $AvlAmount; ?>);
$('#EditAvlBudAmt').val(parseFloat(budamt).toFixed(2));
//var a=$('#ExchangeRate').val();
//alert(a);
//swal(a);
@ -3261,25 +3355,25 @@ $('#EditAvlBudAmt').val(parseFloat(budamt).toFixed(2));
var txtexchangerate=parseFloat($('#ExchangeRate').val());
$('#EditExchangeRt').val(parseFloat(txtexchangerate).toFixed(2));
var txtbasics=parseFloat($('#BasicPriceInMTon').val());
//alert(txtexchangerate);
//alert(txtbasics);
//swal(txtexchangerate);
//swal(txtbasics);
var basicpriceinus=parseFloat($('#BasicPriceinUS').val());
var txtbasic=txtexchangerate*basicpriceinus;
//alert(txtbasic);
//swal(txtbasic);
$('#EditINRBasicvalue').val(txtbasic);
$('#currencytype').change(function()
{
//alert();
//swal();
var id = $('#currencytype').val();
//alert(id);
//swal(id);
var symbol=<?php echo json_encode($Currency,JSON_PRETTY_PRINT)?>;
//alert(symbol);
//alert(JSON.stringify(symbol));
//swal(symbol);
//swal(JSON.stringify(symbol));
$.each(symbol,function(idx,obj)
{
//alert(JSON.stringify(symbol[i]));
//swal(JSON.stringify(symbol[i]));
//console.log(obj);
if(obj.Currency_Code==id)
{
@ -3310,6 +3404,9 @@ $('#currencytype').change(function()
$('#drpSupplier').change(function() {
var cd = $("#drpSupplier option:selected").text();
//swal(cd);
$("#changeSup").val(cd);
var id = $('#drpSupplier').val();
@ -3330,7 +3427,7 @@ $('#drpSupplier').change(function() {
// console.log(a);
// if (a=="After")
// {
// //alert();
// //swal();
// document.getElementById("After").checked = true;
// }
@ -3398,7 +3495,7 @@ $('#drpSupplier').change(function() {
}
else
{
alert('Please select the SupplierID');
swal('Please select the SupplierID');
return false;
}
@ -3432,7 +3529,7 @@ $("#txtBasicValue").val('');
// console.log(Material);
//var AvlBudAmt = '<?php echo $AvlAmount ?>';
var AvlBudAmt = '<?php echo $AvilableBudget ?>';
//alert(JSON.stringify(Material));
//swal(JSON.stringify(Material));
// For Binding DepartmentName
@ -3452,7 +3549,7 @@ $("#txtBasicValue").val('');
for(i=0;i<Material.length;i++)
{
$.each(Material[i], function(idx, obj) {
//alert();
//swal();
if(obj.ReqNo === id )
{
@ -3488,7 +3585,7 @@ $("#txtBasicValue").val('');
}
else
{
alert('Please select the Requisition Number');
swal('Please select the Requisition Number');
return false;
}
id = '';
@ -3530,7 +3627,7 @@ $("#txtBasicValue").val('');
}
else
{
alert('Please select the MaterialCode');
swal('Please select the MaterialCode');
return false;
}
@ -3550,7 +3647,7 @@ function USRate()
$('#BasicPriceTax').val(txtINRvalue);
//txtINR = Math.ceil(txtINR*10)/10;
txtINR = Math.round(txtINRvalue);
//alert(txtINR);BasicPriceTax
//swal(txtINR);BasicPriceTax
$('#AfterBasicPriceTax').val(txtINR);
$('#imBasicPrice').val(txtbasics);
@ -3571,7 +3668,7 @@ function EditQtyZerocheck()
{
if(($('#EditRate').val()=="0")||$('#EditQuantity').val()=="0"||($('#EditRate').val()=='')||$('#EditQuantity').val()=='')
{
alert('Please Enter A Valid Number for Rate and Quantity');
swal('Please Enter A Valid Number for Rate and Quantity');
$('#EdittxtBasicValue').val(0);
$('#EditimBasicPrice').val(0);
var txtexchangerate=parseFloat($('#ExchangeRate').val());
@ -3619,7 +3716,7 @@ function QtyZerocheck()
{
if(($('#Rate').val()=="0")||$('#Quantity').val()=="0"||($('#Rate').val()=='')||$('#Quantity').val()=='')
{
alert('Please Enter A Valid Number for Rate and Quantity');
swal('Please Enter A Valid Number for Rate and Quantity');
$('#txtBasicValue').val(0);
$('#imBasicPrice').val(0);
$('#ExchangeRt').val(0);
@ -3638,22 +3735,22 @@ function QtyZerocheck()
function Ratechange()
{
//alert();
//swal();
if($('#ReqNo').val() == "0")
{
alert('Please select the Requisition Number');
swal('Please select the Requisition Number');
$('#ReqNo').focus();
return false;
}
else if($('#MaterialCode').val() == "0")
{
alert('Please select the Material Code');
swal('Please select the Material Code');
$('#MaterialCode').focus();
return false;
}
else if($('#CostCenter').val() == "0")
{
alert('Please select the CostCenterCode');
swal('Please select the CostCenterCode');
$('#CostCenter').focus();
return false;
}
@ -3664,7 +3761,7 @@ function Ratechange()
{
if(QtyZerocheck())
{ //alert('inside');
{ //swal('inside');
// var txtQuantity = parseFloat( $('#Quantity').val());
var txtQuantity = $('#Quantity').val() == '' ? '0.00' : $('#Quantity').val()
//var txtUnitPrice = parseFloat($('#Rate').val());
@ -3689,7 +3786,7 @@ function Ratechange()
$('#BasicPriceTax').val(parseFloat(txtINRvalue).toFixed(2));
//txtINR = Math.ceil(txtINR*10)/10;
txtINR = Math.round(txtINRvalue);
//alert(txtINR);BasicPriceTax
//swal(txtINR);BasicPriceTax
$('#AfterBasicPriceTax').val(parseFloat(txtINR).toFixed(2));
$('#imBasicPrice').val(parseFloat(txtbasics).toFixed(2));
@ -3707,7 +3804,7 @@ function Ratechange()
function Calculateloadingcharge()
{
//alert();
//swal();
$('#AfterHighseas').val('');
$('#AfterCustomduty').val('');
$('#AfterExcisedutyTax').val('');
@ -3772,7 +3869,7 @@ $('#RMCIncludingCustomers').val('');
function EditCalculateloadingcharge()
{
//alert();
//swal();
var txtlanding=0;
var txtbasicprice=0;
var asss=0;
@ -3792,12 +3889,12 @@ $('#RMCIncludingCustomers').val('');
// var Assessable= <?php echo ASSESSBLE;?>;
var Assessable=parseFloat(txtbasicprice)+parseFloat(asss);
//console.log(Assessable);
//alert(Assessable);
//swal(Assessable);
$('#EditAfterLandingCharge').val(result.toFixed(2));
$('#EditAfterAssessable').val(Assessable);
EditCalculateCustomduty();
//alert();
//swal();
}
@ -3833,22 +3930,23 @@ var txtcustompercentage=parseFloat($('#Customduty').val() == '' ? '0.00' : $('#C
function ExceedEditQuantityCheck()
{ //salert();
{ //sswal();
// RequistQuantity
var EnterQuantity = $("#EditQuantity").val()== '' ? "0.00" : parseFloat($("#EditQuantity").val());
var ReqQuantity = parseFloat(RequistQuantity);
//alert(reqq);
//swal(reqq);
//var ReqQuantity=parseFloat($('#EditQuantity').val());
if(EnterQuantity > ReqQuantity)
{
alert('Your exceeding the Quantity from the Requisition Quantity:'+ RequistQuantity +'.Please adjust the Quantity to proceed further.');
$('#EditQuantity').focus();
return false;
}
else{
//if(EnterQuantity != ReqQuantity)
// {
// swal('Your exceeding the Quantity from the Requisition Quantity:'+ RequistQuantity +'.Please adjust the Quantity to proceed further.');
// $('#EditQuantity').focus();
// return false;
// }
// else
// {
return true;
}
//}
}
@ -3964,7 +4062,7 @@ txtedcesspercentage=parseFloat($('#EditCustomEDcess').val() == '' ? '0.00' : $('
function CalculateCustomSHcess()
{//alert();
{//swal();
var landingch=0;
@ -4073,7 +4171,7 @@ CalculateCtable();
function EditCalculateCustomSHcess()
{//alert();
{//swal();
var landingch=0;
var highsesssalles=0;
@ -4341,16 +4439,17 @@ function ExceedQuantityCheck()
// RequistQuantity
var EnterQuantity = $("#Quantity").val()== '' ? "0.00" : parseFloat($("#Quantity").val());
var ReqQuantity = parseFloat(RequistQuantity);
if(EnterQuantity > ReqQuantity)
{
alert('Your exceeding the Quantity from the Requisition Quantity:'+ RequistQuantity +'.Please adjust the Quantity to proceed further.');
//$('#Quantity').val(RequistQuantity);
$('#Quantity').focus();
return false;
}
else{
//if(EnterQuantity > ReqQuantity)
// {
// swal('Your exceeding the Quantity from the Requisition Quantity:'+ RequistQuantity +'.Please adjust the Quantity to proceed further.');
// //$('#Quantity').val(RequistQuantity);
// $('#Quantity').focus();
// return false;
// }
// else
//{
return true;
}
//}
}
@ -4365,7 +4464,7 @@ function validateEditExceedLimit()
{
//var avalbudAmt = parseFloat($('#EditAvlBudAmt').val());
// var addedamount=parseFloat($('#txtavlbud').val());
// alert(addedamount);
// swal(addedamount);
var basicAmountRate = parseFloat($('#EdittxtBasicValue').val());
var totalAmount = parseFloat($('#EditTotalExp').val());
var exchangerate=parseFloat($('#EditExchangeRt').val());
@ -4375,7 +4474,7 @@ function validateEditExceedLimit()
// if(exp > totavlbud || totalAmount > totavlbud)
// {
// alert('Basic amount is exceeding the Budget Limit.Please adjust the product value.');
// swal('Basic amount is exceeding the Budget Limit.Please adjust the product value.');
// $('#EditRate').focus();
// return false;
// }
@ -4401,7 +4500,7 @@ var totavlbud=avalbudAmt+Sum;
function validateExceedLimit()
{
//alert('ddf');
//swal('ddf');
//avalbudAmt = parseFloat($('#AvlBudAmt').val());
var basicAmountRate = parseFloat($('#txtBasicValue').val());
@ -4413,7 +4512,7 @@ var totavlbud=avalbudAmt+Sum;
// if(exp > totavlbud || totalAmount > totavlbud)
// {
// alert('Basic amount is exceeding the Budget Limit.Please adjust the product value.');
// swal('Basic amount is exceeding the Budget Limit.Please adjust the product value.');
// $('#Rate').focus();
// return false;
// }
@ -4429,17 +4528,17 @@ var totavlbud=avalbudAmt+Sum;
$('.AddImport').click(function()
{
//alert('out');
//swal('out');
// if(validateImport())
if(validateImport()&&ExceedQuantityCheck()&&validateExceedLimit()&&QtyZerocheck())
{
//alert('in');
//swal('in');
index = parseInt(index)+1;
var temp = index;
//alert(temp);
//swal(temp);
var Reqnumber = $('#ReqNo').val();
//alert(JSON.strigify(Reqnumber));
//swal(JSON.strigify(Reqnumber));
var departmentName =$('#deptName').val();
var AvilBudget = $('#AvlBudAmt').val();
var costCode = $('#CostCenter').val();
@ -4521,10 +4620,10 @@ var splins=$.trim(tinymce.get('addtxtInstruction').getContent());
// populateValueMainFormForImportTax();
//alert('in');
//swal('in');
var template = jQuery("#ImportList").html();
$('#ImportAppend').append(_.template(template,{index:temp,ReqNo:Reqnumber,MaterialCode:materialCode,Description:materialName,Quantity:quantity,UOM:uom,Rate:itemRate,BasicAmount:BasicAmt,Taxvalue:taxamt,TotalValue:totalexp,ReceivedQty:receivedqty,RejectedQty:rejectedqty,PendingQty:pendingqty}));
//alert(JSON.strigify(BasicAmt));
//swal(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}));
@ -4594,7 +4693,7 @@ var splins=$.trim(tinymce.get('addtxtInstruction').getContent());
//addHidden(theForm,"TotalitemExp"+temp,TotalValue);
// alert(JSON.stringify(totalexp));
// swal(JSON.stringify(totalexp));
@ -4603,7 +4702,7 @@ var splins=$.trim(tinymce.get('addtxtInstruction').getContent());
//addHidden(theForm,"AfterBasicPriceTax"+temp,AfterBasicPriceTax);
$('#txtRow').val(index);
var a=parseFloat($('#txtRow').val());
//alert(a)
//swal(a)
populateValueMainFormForImportTax();
clearTaxField();
@ -4617,19 +4716,19 @@ var splins=$.trim(tinymce.get('addtxtInstruction').getContent());
$("#viewimportmodal").on("shown.bs.modal", function(e) {
// alert();
// swal();
userid = $(e.relatedTarget).data('userid');
//alert(userid);
//alert('inadd');
//swal(userid);
//swal('inadd');
var tr= document.getElementById(userid);
//alert(tr);
//swal(tr);
var cellval = tr.cells;
//alert(cellval);
//swal(cellval);
var id= $('#Reqnumber'+userid).val();
//alert(id);
//swal(id);
//var a=$('#Reqnumber'+userid).val();
//alert(a)
//swal(a)
$('#ViewReqNo').val($('#Reqnumber'+userid).val());
$('#ViewdeptName').val($('#departmentName'+userid).val());
@ -4777,40 +4876,40 @@ tinyMCE.get('viewtxtInstruction').setContent($('#Addinstruction'+userid).val());
function validateImport()
{
//alert();
//swal();
if($('#ReqNo').val() == "0")
{
alert('Please select the Requisition Number');
swal('Please select the Requisition Number');
$('#ReqNo').focus();
return false;
}
else if($('#CostCenter').val() == "0")
{
alert('Please select the Cost center');
swal('Please select the Cost center');
$('#CostCenter').focus();
return false;
}
else if($('#MaterialCode').val() == "0")
{
alert('Please select the Material Code');
swal('Please select the Material Code');
$('#MaterialCode').focus();
return false;
}
else if($('#Quantity').val() == '')
{
alert('Please Enter the Quantity value');
swal('Please Enter the Quantity value');
$('#Quantity').focus();
return false;
}
else if($('#Rate').val() == '')
{
alert('Please Enter the Rate of the Item');
swal('Please Enter the Rate of the Item');
$('#Rate').focus();
return false;
}
else if($('#imBasicPrice').val()=='')
{
alert('Please Enter Basic Price In Us');
swal('Please Enter Basic Price In Us');
$('#imBasicPrice').focus();
return false;
}
@ -4923,7 +5022,7 @@ $('#txttotalIgst').val(parseFloat(Totaligst).toFixed(2));
//console.log(r);
//var x=parseFloat($('#txttotalcustomED').val());
//console.log(x);
//alert(TotalOrder);
//swal(TotalOrder);
@ -5000,18 +5099,18 @@ function clearTaxField()
$("#editimportpomodel").on("shown.bs.modal", function(e) {
userid = $(e.relatedTarget).data('userid');
//alert(userid);
//alert('inadd');
//swal(userid);
//swal('inadd');
var tr= document.getElementById(userid);
//alert(tr);
//swal(tr);
var cellval = tr.cells;
//alert(cellval);
//swal(cellval);
var id= $('#Reqnumber'+userid).val();
//alert(id);
//swal(id);
$('#EditReqNo').val($('#Reqnumber'+userid).val());
//alert($('#Reqnumber'+userid).val());
//swal($('#Reqnumber'+userid).val());
$('#EditdeptName').val($('#departmentName'+userid).val());
$("#EditCostCenter").val($('#costCode'+userid).val());
// $('#EditAvlBudAmt').val($('#AvilBudget'+userid).val());
@ -5096,7 +5195,7 @@ $("#editimportpomodel").on("shown.bs.modal", function(e) {
if (FreightType == "PER TRIP")
{
///salert();
///sswal();
$('#EditTripsValue').show();
}
@ -5156,7 +5255,7 @@ $("#editimportpomodel").on("shown.bs.modal", function(e) {
$('.EditImport').click(function(){
//alert('inside edit');
//swal('inside edit');
if(validateEditExceedLimit() && ExceedEditQuantityCheck()&&EditQtyZerocheck())
{
var CostCode = $("#EditCostCenter").val();
@ -5195,7 +5294,7 @@ if(validateEditExceedLimit() && ExceedEditQuantityCheck()&&EditQtyZerocheck())
var Nett=$('#EditNett').val();
var TotalExp=$('#EdittxtBasicValue').val();
//alert(itemRate);
//swal(itemRate);
//console.log(GrossDuty);
var spclins=$.trim(tinymce.get('edittxtInstruction').getContent());
@ -5402,12 +5501,12 @@ TotalIgst=parseFloat(TotalIgst)+parseFloat(Igst);
// function DeleteRow(rowid)
// { //alert('Delete');
// { //swal('Delete');
// var DelRows = $('#txtDeletedRow').val();
// var answer = confirm(" Do you want to delete the Item from the List?")
// if (answer)
// {
// //alert('Confirm');
// //swal('Confirm');
// var td = document.getElementById(rowid);
// td.parentNode.removeChild(td);
@ -5422,7 +5521,7 @@ TotalIgst=parseFloat(TotalIgst)+parseFloat(Igst);
// SelectedMaterialList.Mat.splice(i, 1);
// }
// });
// // alert(SelectedMaterialCode);
// // swal(SelectedMaterialCode);
// if(DelRows != '')
// {
// DelRows = DelRows + ":" + rowid;
@ -5566,7 +5665,7 @@ function DeleteRow(rowid)
});
// alert(result);
// swal(result);
if(result == '0')
{
var DelRows = $('#txtDeletedRow').val();
@ -5604,11 +5703,11 @@ function DeleteRow(rowid)
if(data)
{
$('#content').loader('hide');
alert(data);
swal(data);
}
else
{
alert("Error");
swal("Error");
}
}});
@ -5717,7 +5816,7 @@ TotalFreight=parseFloat(TotalFreight)-parseFloat(Frieght);
function Budgetcheck()
{
//alert();
//swal();
var totalorderedamount=parseFloat($('#txttot').val());
var Exchange=parseFloat($('#ExchangeRate').val());
//console.log(Exchange);
@ -5726,7 +5825,7 @@ function Budgetcheck()
//console.log(TotalSum);
// if(totordring>TotalSum)
// {
// alert('You are Exceeding The Budget');
// swal('You are Exceeding The Budget');
// return false;
// }
@ -5743,7 +5842,7 @@ function Budgetcheck()
function Save(status)
{
//alert();
//swal();
if(status == '0')
@ -5763,34 +5862,34 @@ else
$('#txtStatus').val(stat);
//var txtRowCount = $('#txtRowCount').val();
//var Row=$('#txtRow').val();
//alert(Row);
//swal(Row);
//exit();
tinyMCE.triggerSave();
var Row=$('#txtRow').val();
//alert(Row);
//swal(Row);
var txtDeletedRow = $('#txtDeletedRow').val();
//alert(Row);
//alert(txtRowCount);
//swal(Row);
//swal(txtRowCount);
//exit();
//var TotalOrder=$('#txtToatlOrder').val();
//alert(TotalOrder);
//swal(TotalOrder);
//exit();
if(validate()&&Budgetcheck())
{ //alert();
{ //swal();
if(document.getElementById('ImportTax').rows.length <= 0)
{
alert('Please Select Line item to Create PO');
swal('Please Select Line item to Create PO');
$('#Deliverydt').focus();
return false;
}
else
{
//alert();
//swal();
$('#content').loader('show');
$.ajax({
data:$('.ImportPO').serialize()+"&txtRowCount="+Row+"&txtDeletedRow="+txtDeletedRow+"&textStatus="+stat,
@ -5802,7 +5901,7 @@ if(validate()&&Budgetcheck())
if(data)
{
$('#content').loader('hide');
alert(data);
swal(data);
$('#txtRowCount').val('');
$('#txtDeletedRow').val('');
//$('#SpcialInstruction').val('');
@ -5812,7 +5911,7 @@ if(validate()&&Budgetcheck())
}
else
{
alert("Error");
swal("Error");
}
}
@ -5935,7 +6034,7 @@ $('#edittxtAfterFreight').val('');
}
else
{
alert('Please Select MaterialCode and Rate Field Value');
swal('Please Select MaterialCode and Rate Field Value');
$('#drpEditFreight').val("0");
$('#EditRate').focus();
}
@ -5946,7 +6045,7 @@ calculateFreight(1);
$('#drpaddFreight').change(function(){
//alert();
//swal();
var FreightType = $('#drpaddFreight').val();
if (FreightType == "PER TRIP")
{
@ -5983,7 +6082,7 @@ if($('#Rate').val() != '' && $('#MaterialCode').val() != "0" )
}
else
{
alert('Please Select MaterialCode and Rate Field Value');
swal('Please Select MaterialCode and Rate Field Value');
$('#drpaddFreight').val("0");
$('#Rate').focus();
}
@ -5998,19 +6097,19 @@ function calculateFreight(isEdit)
{
//alert();
//swal();
if(isEdit == '0')
{ //alert();
{ //swal();
if($('#MaterialCode').val() == "0")
{
alert('Please Select the Material Code');
swal('Please Select the Material Code');
$('#MaterialCode').focus();
$('#txtFreight').val('') ;
return false;
}
else if($('#Rate').val() == '')
{
alert('Please Enter the Rate value');
swal('Please Enter the Rate value');
$('#Rate').focus();
$('#addtxtFreight').val('') ;
return false;
@ -6022,7 +6121,7 @@ function calculateFreight(isEdit)
var FreightType =$("#drpaddFreight").val();
if(FreightType == "0")
{
alert('Please select Freight Type');
swal('Please select Freight Type');
$('#addtxtFreight').val('');
$("#drpaddFreight").focus();
}
@ -6031,7 +6130,7 @@ function calculateFreight(isEdit)
var FreightValue = parseFloat($('#addtxtFreight').val());
var UOM = parseFloat($('#UOM').val());
var Quantity = parseFloat($('#Quantity').val());
//alert(FreightType);
//swal(FreightType);
var AfterFreight = 0.0;
if(FreightType == PercentageType)
{
@ -6053,7 +6152,7 @@ function calculateFreight(isEdit)
{
if($('#addNOOfTrips').val()=='')
{
alert('Please Enter No of Trip');
swal('Please Enter No of Trip');
$("#addNOOfTrips").focus();
$('#addtxtFreight').val(0)
@ -6093,17 +6192,17 @@ function calculateFreight(isEdit)
// alert('af');
// swal('af');
if($('#EditMaterialCode').val() == '')
{
alert('Please Select the Material Code');
swal('Please Select the Material Code');
$('#EditMaterialCode').focus();
$('#edittxtFreight').val('');
return false;
}
else if($('#EditRate').val() == '')
{
alert('Please Enter the Rate value');
swal('Please Enter the Rate value');
$('#EditRate').focus();
$('#edittxtFreight').val('');
return false;
@ -6114,7 +6213,7 @@ function calculateFreight(isEdit)
var FreightType =$("#drpeditFreight").val();
if(FreightType == "0")
{
alert('Please select Freight Type');
swal('Please select Freight Type');
$('#edittxtFreight').val('');
$("#drpeditFreight").focus();
}
@ -6123,7 +6222,7 @@ function calculateFreight(isEdit)
var FreightValue = parseFloat($('#edittxtFreight').val());
var UOM = parseFloat($('#EditUOM').val());
var Quantity = parseFloat($('#EditQuantity').val());
//alert(FreightType);
//swal(FreightType);
var AfterFreight = 0.0;
if(FreightType == PercentageType)
{
@ -6144,7 +6243,7 @@ function calculateFreight(isEdit)
else if(FreightType == '<?php echo PERTRIP;?>')
{
if($('#editNOOfTrips').val()==''){
alert('Please Enter No of Trip');
swal('Please Enter No of Trip');
$("#editNOOfTrips").focus();
$('#edittxtFreight').val(0)
@ -6178,14 +6277,14 @@ function calculateFreight(isEdit)
else
{
//alert();
//swal();
var basicValue = parseFloat($('#ViewINRBasicvalue').val());
///console.log(basicValue);
var FreightType =$("#drpviewFreight").val();
if(FreightType == "0")
{
alert('Please select Freight Type');
swal('Please select Freight Type');
$('#viewtxtFreight').val('');
$("#drpviewFreight").focus();
}
@ -6194,7 +6293,7 @@ function calculateFreight(isEdit)
var FreightValue = parseFloat($('#viewtxtFreight').val());
var UOM = parseFloat($('#ViewUOM').val());
var Quantity = parseFloat($('#ViewQuantity').val());
//alert(FreightType);
//swal(FreightType);
var AfterFreight = 0.0;
if(FreightType == PercentageType)
{
@ -6215,7 +6314,7 @@ function calculateFreight(isEdit)
else if(FreightType == '<?php echo PERTRIP;?>')
{
if($('#viewNOOfTrips').val()==''){
alert('Please Enter No of Trip');
swal('Please Enter No of Trip');
$("#viewNOOfTrips").focus();
$('#viewtxtFreight').val(0)
@ -6248,4 +6347,3 @@ function calculateFreight(isEdit)
}
</script>