CHANGE_PURCHASE_ORDER_ISSUE_SERVICE

This commit is contained in:
aadhavan valli 2024-09-20 16:27:06 +05:30
parent 825d56b4df
commit 5ca7372af5
7 changed files with 131 additions and 104 deletions

View File

@ -230,6 +230,7 @@ $routes->post('emergencypurchaseorder/addNewRevenuePurchaseOrder','Emergencypurc
$routes->post('purchaseorder/addNewPurchaseOrder', 'Purchaseorder::addNewPurchaseOrder');
$routes->post('purchaseorder/DeletePODetails', 'Purchaseorder::DeletePODetails');
$routes->post('purchaseorder/addNewCapitalPurchaseOrder', 'Purchaseorder::addNewCapitalPurchaseOrder');
$routes->post('purchaseorder/addNewImportPurchaseOrder', 'Purchaseorder::addNewImportPurchaseOrder');
$routes->post('servicepurchaseorder/addNewServicePurchaseOrder', 'Servicepurchaseorder::addNewServicePurchaseOrder');

View File

@ -545,7 +545,7 @@ class Purchaseorder extends BaseController
$ReqType = $this->request->getVar('ReqType');
$Req = $this->purchaseorder_model->getRequistionNoFromPO($PONO);
$data['ReqList'] = $Req;
$result = array();
@ -554,8 +554,8 @@ class Purchaseorder extends BaseController
foreach ($Req as $SID) :
$ReqArray[] = $SID->ReqNo;
$result[] = $this->purchaseorder_model->getRawPOMaterialList($SID->ReqNo);
// echo "<pre>";
// print_r($result);die;
// echo "<pre>";
// print_r($result);die;
endforeach;
$data['MaterialList'] = $result; //$this->purchaseorder_model->getRawMaterialList($ReqType,$ReqArray);
@ -1446,6 +1446,7 @@ class Purchaseorder extends BaseController
if ($SkipInsert == "False") {
if (strlen((string)$POLineItemNo) == 0) {
} else {
$LineItemNo = $POLineItemNo;
@ -1455,9 +1456,10 @@ class Purchaseorder extends BaseController
$POLineItem = $this->purchaseorder_model->updatePOLineItem($PONO, $POLineItemNo, $POLineItemList);
}
$isExists = $this->purchaseorder_model->LineItemExistsinRevenueTax($LineItemNo);
if (count($isExists) == 0) {
} 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);
}
@ -2156,7 +2158,7 @@ class Purchaseorder extends BaseController
}
}
}
// echo $PONO;
// echo $TotalOrder;

View File

@ -22,7 +22,7 @@ use App\Models\Requistion_model;
class Servicepurchaseorder extends BaseController
{
protected $session;
protected $purchaseorder_model;
protected $purchaseorder_model;
protected $requistion_model;
protected $costcenter_model;
/**
@ -36,8 +36,8 @@ class Servicepurchaseorder extends BaseController
$this->costcenter_model = new Costcenter_model();
$this->session = session();
helper('form'); //$this->load->library('form_validation');
$this->isLoggedIn();
}
@ -81,7 +81,7 @@ class Servicepurchaseorder extends BaseController
$UOM = $result[$i]['UOM'];
$Quantity = $result[$i]['Quantity'];
$Rate = $result[$i]['Rate'];
$ReqDate = format_date($result[$i]['ReqDate'], 0,'d-m-Y');
$ReqDate = format_date($result[$i]['ReqDate'], 0, 'd-m-Y');
$HTML .= "<tr id='" . $SNo . "'>
@ -113,7 +113,7 @@ class Servicepurchaseorder extends BaseController
$Remarks = $this->request->getPost('Remarks');
$updatedBy = $this->session->get('userId');
$updateddt = get_current_date_time();
if ($WorkStatus == SERVICE_COMPLETED) {
$POStatus = PO_SERVICE_COMPLETED;
@ -150,7 +150,7 @@ class Servicepurchaseorder extends BaseController
// To get the available Budget Amount
function AvilBudgetAmount()
{
$CostCode = $this->request->getPost('id');
$ReqType = $this->request->getPost('type');
$FYStart = '';
@ -164,7 +164,7 @@ class Servicepurchaseorder extends BaseController
}
$FYdt = $FYStart . " - " . $FYEnd;
$result = array();
if ($ReqType == CAPITAL) {
@ -206,7 +206,7 @@ class Servicepurchaseorder extends BaseController
$SupplierReference = $this->request->getPost('addsupplierreference');
$SuppliersOfferNo = $this->request->getPost('addsupplierofferno');
$OtherReferences = $this->request->getPost('addotherreference');
$Fincap = "";//$this->request->getPost('addfincap');
$Fincap = ""; //$this->request->getPost('addfincap');
$InsuranceOptions = $this->request->getPost('insuranceStatus');
$InsuranceNumber = $this->request->getPost('InsuranceNumber');
$ServiceTypeOptions = $this->request->getPost('PoTypeOptions');
@ -228,35 +228,35 @@ class Servicepurchaseorder extends BaseController
$comma_separated = explode(':', (string)$DeletedRow);
$createddt = get_current_date_time();
$WorkStatus = $this->request->getPost('workstatus');
$lastPONO = $this->purchaseorder_model->lastPONO();
$newPONO = generate_po_number($lastPONO);
$lastPONO = $this->purchaseorder_model->lastPONO();
$newPONO = generate_po_number($lastPONO);
$IsOpenOrder = ($this->request->getPost('IsOpenOrder') !== null && !empty($this->request->getPost('IsOpenOrder')) && $this->request->getPost('IsOpenOrder') === '1') ? $this->request->getPost('IsOpenOrder') : null;
$file = $this->request->getFile('POFile');
$requestfilename = $file->getName();
$requestfilename = $file->getName();
if (!empty($requestfilename)) {
if ($file->isValid() && !$file->hasMoved()) {
$path = ROOTPATH.'public/uploads/POfiles/';
if(!is_dir($path)) { mkdir($path, 0777, true); }
if (!empty($this->purchaseorder_model->isFileExists($requestfilename))) {
log_message('error', 'File already exists in the database'.$requestfilename);
$path = ROOTPATH . 'public/uploads/POfiles/';
if (!is_dir($path)) {
mkdir($path, 0777, true);
}
if (!empty($this->purchaseorder_model->isFileExists($requestfilename))) {
log_message('error', 'File already exists in the database' . $requestfilename);
$requestfilename = "";
} else {
$file->move($path, $requestfilename);
}
} else {
$requestfilename = "";
}
else{
$file->move($path, $requestfilename);
}
}else{
$requestfilename = "";
}
}
}
// PO Master
$POList = array('PONO'=>$newPONO,'SupplierID' => $SupplierID, 'TotalOrderValue' => $TotalOrderValueSummary, 'PODate' => $PODate, 'Status' => $POStatus, 'DeliverySchedule' => $DeliverySchedule, 'DeliveryOption' => $DeliveryOption, 'ServiceDescription' => $SpcialInstruction, 'CreatedBy' => $CreateBy, 'DeliveryAddress' => $DeliveryAddr, 'DeliveryDate' => $Deliverydt, 'CreatedDate' => $createddt, 'PaymentTerms' => $PaymentTerms, 'ServiceWorkStatus' => $WorkStatus, 'POType' => $POType, 'PaymentOtherDescription' => $OtherPayment, 'Supplier_Reference' => $SupplierReference, 'Mode_Of_Shipment' => $ModeOfShipment, 'Supplier_Offer_No' => $SuppliersOfferNo, 'Other_Reference' => $OtherReferences, 'Fincap' => $Fincap, 'Description_Of_Service' => $DescriptionOfPo, 'InsuranceStatus' => $InsuranceOptions, 'InsuranceNumber' => $InsuranceNumber, 'POSubType' => $ServiceTypeOptions, 'BudgetType' => $BudgetType,'IsOpenOrder'=>$IsOpenOrder);
$POList = array('PONO' => $newPONO, 'SupplierID' => $SupplierID, 'TotalOrderValue' => $TotalOrderValueSummary, 'PODate' => $PODate, 'Status' => $POStatus, 'DeliverySchedule' => $DeliverySchedule, 'DeliveryOption' => $DeliveryOption, 'ServiceDescription' => $SpcialInstruction, 'CreatedBy' => $CreateBy, 'DeliveryAddress' => $DeliveryAddr, 'DeliveryDate' => $Deliverydt, 'CreatedDate' => $createddt, 'PaymentTerms' => $PaymentTerms, 'ServiceWorkStatus' => $WorkStatus, 'POType' => $POType, 'PaymentOtherDescription' => $OtherPayment, 'Supplier_Reference' => $SupplierReference, 'Mode_Of_Shipment' => $ModeOfShipment, 'Supplier_Offer_No' => $SuppliersOfferNo, 'Other_Reference' => $OtherReferences, 'Fincap' => $Fincap, 'Description_Of_Service' => $DescriptionOfPo, 'InsuranceStatus' => $InsuranceOptions, 'InsuranceNumber' => $InsuranceNumber, 'POSubType' => $ServiceTypeOptions, 'BudgetType' => $BudgetType, 'IsOpenOrder' => $IsOpenOrder);
$POList['POFile'] = $requestfilename;
$POMaster = $this->purchaseorder_model->addPOMaster($POList, $POType, $ServiceTypeOptions);
$PONO = $POMaster ? $newPONO : "";
@ -370,7 +370,7 @@ class Servicepurchaseorder extends BaseController
$SupplierReference = $this->request->getPost('editsupplierreference');
$SuppliersOfferNo = $this->request->getPost('editsupplierofferno');
$OtherReferences = $this->request->getPost('editotherreference');
$Fincap = "";//$this->request->getPost('editfincap');
$Fincap = ""; //$this->request->getPost('editfincap');
$InsuranceOptions = $this->request->getPost('insuranceStatus');
$InsuranceNumber = $this->request->getPost('InsuranceNumber');
$ServiceTypeOptions = $this->request->getPost('PoTypeOptions');
@ -391,9 +391,8 @@ class Servicepurchaseorder extends BaseController
$updatedBy = $this->session->get('userId');
$RowCount = $this->request->getPost('txtRowCount');
$DeletedRow = $this->request->getPost('txtDeletedRow');
$comma_separated = explode(':', (string)$DeletedRow);
$updateddt = get_current_date_time();
$WorkStatus = $this->request->getPost('workstatus');
@ -402,31 +401,32 @@ class Servicepurchaseorder extends BaseController
// $lastPONO = $this->purchaseorder_model->lastPONO();
// $newPONO = generate_po_number($lastPONO);
// PO Master
$POList = array('SupplierID' => $SupplierID, 'TotalOrderValue' => $TotalOrderValueSummary, 'PODate' => $PODate, 'Status' => $POStatus, 'DeliverySchedule' => $DeliverySchedule, 'DeliveryOption' => $DeliveryOption, 'ServiceDescription' => $SpcialInstruction, 'UpdateBY' => $updatedBy, 'DeliveryAddress' => $DeliveryAddr, 'DeliveryDate' => $Deliverydt, 'UpdatedOn' => $updateddt, 'PaymentTerms' => $PaymentTerms, 'ServiceWorkStatus' => $WorkStatus, 'PaymentOtherDescription' => $OtherPayment, 'Supplier_Reference' => $SupplierReference, 'Mode_Of_Shipment' => $ModeOfShipment, 'Supplier_Offer_No' => $SuppliersOfferNo, 'Other_Reference' => $OtherReferences, 'Fincap' => $Fincap, 'Description_Of_Service' => $DescriptionOfPo, 'InsuranceStatus' => $InsuranceOptions, 'InsuranceNumber' => $InsuranceNumber, 'POSubType' => $ServiceTypeOptions, 'BudgetType' => $BudgetType,'IsOpenOrder'=>$IsOpenOrder);
$POList = array('SupplierID' => $SupplierID, 'TotalOrderValue' => $TotalOrderValueSummary, 'PODate' => $PODate, 'Status' => $POStatus, 'DeliverySchedule' => $DeliverySchedule, 'DeliveryOption' => $DeliveryOption, 'ServiceDescription' => $SpcialInstruction, 'UpdateBY' => $updatedBy, 'DeliveryAddress' => $DeliveryAddr, 'DeliveryDate' => $Deliverydt, 'UpdatedOn' => $updateddt, 'PaymentTerms' => $PaymentTerms, 'ServiceWorkStatus' => $WorkStatus, 'PaymentOtherDescription' => $OtherPayment, 'Supplier_Reference' => $SupplierReference, 'Mode_Of_Shipment' => $ModeOfShipment, 'Supplier_Offer_No' => $SuppliersOfferNo, 'Other_Reference' => $OtherReferences, 'Fincap' => $Fincap, 'Description_Of_Service' => $DescriptionOfPo, 'InsuranceStatus' => $InsuranceOptions, 'InsuranceNumber' => $InsuranceNumber, 'POSubType' => $ServiceTypeOptions, 'BudgetType' => $BudgetType, 'IsOpenOrder' => $IsOpenOrder);
if ($POStatus == 'ST026') {
$POList['ApprovedOn'] = get_current_date_time();
$POList['ApprovedBy'] = $this->session->get('userId');
$POList['ReleasedOn'] = get_current_date_time();
$POList['ReleasedBy'] = $this->session->get('userId');
}
$file = $this->request->getFile('POFile');
$requestfilename = $file->getName();
if (!empty($requestfilename)) {
if ($file && $file->isValid() && !$file->hasMoved()) {
$path = ROOTPATH.'public/uploads/POfiles/';
if(!is_dir($path)) { mkdir($path, 0777, true); }
if (!empty($this->purchaseorder_model->isFileExists($requestfilename))) {
log_message('error', 'File already exists in the database'.$requestfilename);
}
else{
$file->move($path, $requestfilename);
$POList['POFile'] = $requestfilename;
}
}
}
}
$file = $this->request->getFile('POFile');
$requestfilename = $file->getName();
if (!empty($requestfilename)) {
if ($file && $file->isValid() && !$file->hasMoved()) {
$path = ROOTPATH . 'public/uploads/POfiles/';
if (!is_dir($path)) {
mkdir($path, 0777, true);
}
if (!empty($this->purchaseorder_model->isFileExists($requestfilename))) {
log_message('error', 'File already exists in the database' . $requestfilename);
} else {
$file->move($path, $requestfilename);
$POList['POFile'] = $requestfilename;
}
}
}
$POMaster = $this->purchaseorder_model->updatePOMaster($PONO, $POList);
$LineItemStatus = REQITEM_NEW;
@ -559,13 +559,45 @@ class Servicepurchaseorder extends BaseController
if (trim((string)$POType) == SERVICE) {
// Check if LineItemExists() returns a valid array
$isExists = $this->purchaseorder_model->LineItemExists($LineItemNo);
if (is_array($isExists) && count($isExists) == 0) {
$ServiceTaxList = array('LineItemNo' => $LineItemNo, 'CGST' => $Cgst, 'After_CGST' => $AfterCgst, 'SGST' => $Sgst, 'After_SGST' => $AfterSgst, 'IGST' => $Igst, 'After_IGST' => $AfterIgst, 'TotalValue' => $TotalOrderValue, 'CreatedBy' => $updatedBy, 'CreatedDate' => $updateddt, 'otherallowance' => $OtherAmt);
// Ensure $isExists is an array, or initialize it as an empty array
if (!is_array($isExists)) {
$isExists = [];
}
if (count($isExists) == 0) {
// Insert new service tax record
$ServiceTaxList = array(
'LineItemNo' => $LineItemNo,
'CGST' => $Cgst,
'After_CGST' => $AfterCgst,
'SGST' => $Sgst,
'After_SGST' => $AfterSgst,
'IGST' => $Igst,
'After_IGST' => $AfterIgst,
'TotalValue' => $TotalOrderValue,
'CreatedBy' => $updatedBy,
'CreatedDate' => $updateddt,
'otherallowance' => $OtherAmt
);
$this->purchaseorder_model->addServiceTax($ServiceTaxList);
} else {
$ServiceTaxList1 = array('CGST' => $Cgst, 'After_CGST' => $AfterCgst, 'SGST' => $Sgst, 'After_SGST' => $AfterSgst, 'IGST' => $Igst, 'After_IGST' => $AfterIgst, 'TotalValue' => $TotalOrderValue, 'UpdateBY' => $updatedBy, 'UpdatedOn' => $updateddt, 'otherallowance' => $OtherAmt);
// Update existing service tax record
$ServiceTaxList1 = array(
'CGST' => $Cgst,
'After_CGST' => $AfterCgst,
'SGST' => $Sgst,
'After_SGST' => $AfterSgst,
'IGST' => $Igst,
'After_IGST' => $AfterIgst,
'TotalValue' => $TotalOrderValue,
'UpdateBY' => $updatedBy,
'UpdatedOn' => $updateddt,
'otherallowance' => $OtherAmt
);
$this->purchaseorder_model->updateServiceTax($LineItemNo, $ServiceTaxList1);
}
@ -595,7 +627,7 @@ class Servicepurchaseorder extends BaseController
$new_file_name = str_replace(" ", "", $new_file_name);
if (!empty($new_file_name)) {
$file = $this->request->getFile('file');
if ($file && $file->isValid()) {
$uploadPath = base_url() . 'public/uploads/BillFiles/';
@ -617,7 +649,7 @@ class Servicepurchaseorder extends BaseController
/*-----------------------------------*/
@ -665,9 +697,9 @@ class Servicepurchaseorder extends BaseController
}
public function adfile()
{
$picture = '';
$file = $this->request->getFile('file');
{
$picture = '';
$file = $this->request->getFile('file');
if ($file && $file->isValid()) {
$uploadPath = base_url() . 'public/uploads/BillFiles/';
@ -678,6 +710,6 @@ class Servicepurchaseorder extends BaseController
$picture = '';
}
return $picture;
}
return $picture;
}
}

View File

@ -1012,12 +1012,12 @@ mstr.CourierNo,pom.Status,pom.POType') //,bill.BillNo,bill.FilePath,
$subQuery = 'SELECT distinct LineItem.LineItemNo,LineItem.ReqNo,LineItem.Per,Mat.MaterialCode,Mat.MaterialName,Mat.UOM,LineItem.Quantity,ReceivedQuantity,Rate,LineItem.Status,(LineItem.Quantity *Rate) as BasicValue ,(After_CGST + After_SGST + After_IGST) as Taxamount,Dept.DepartmentName
,TotalValue,CGST,After_CGST,SGST,After_SGST,IGST,After_IGST,otherallowance,LineItem.CostCenterCode,LineItem.ServiceFrequency,LineItem.ServiceMaterialDescription,Req.Schedule_Type,Req.NumberOfService,Req.Service_Period,ReqDet.MaterialDescription
FROM t_purchaseorder_lineitem LineItem
join t_materialmaster Mat on Mat.MaterialCode = LineItem.MaterialCode
join t_service_tax Tax on Tax.LineItemNo = LineItem.LineItemNo
join t_requestion_master Req on Req.ReqNo = LineItem.ReqNo
join t_requestion_details ReqDet on ReqDet.ReqNo = LineItem.ReqNo and LineItem.MaterialCode = ReqDet.MaterialCode
left join t_materialmaster Mat on Mat.MaterialCode = LineItem.MaterialCode
left join t_service_tax Tax on Tax.LineItemNo = LineItem.LineItemNo
left join t_requestion_master Req on Req.ReqNo = LineItem.ReqNo
left join t_requestion_details ReqDet on ReqDet.ReqNo = LineItem.ReqNo and LineItem.MaterialCode = ReqDet.MaterialCode
left join t_employee_details emp on Req.Requestedby = emp.EmpID
join t_departmentdetails Dept on Req.RequestedDept = Dept.DEPCode
left join t_departmentdetails Dept on Req.RequestedDept = Dept.DEPCode
where LineItem.PONO =?';
$query = $this->db->query($subQuery, array($PONO));

View File

@ -3019,21 +3019,21 @@ if (!empty($getlogpodtl)) {
processData: false,
contentType: false,
success: function(data) {
console.log(data);
// if (data) {
// // $('#content').loader('hide');
// alert(data);
// $('#txtRowCount').val('');
// $('#txtDeletedRow').val('');
// $('#txtStatus').val('');
// $('#SpcialInstruction').val('');
// $('#txtDeliveryAddress').val('')
// window.location = "purchaseorderListing";
// console.log(data);
if (data) {
// $('#content').loader('hide');
alert(data);
$('#txtRowCount').val('');
$('#txtDeletedRow').val('');
$('#txtStatus').val('');
$('#SpcialInstruction').val('');
$('#txtDeliveryAddress').val('')
window.location = "purchaseorderListing";
// } else {
// // $('#content').loader('hide');
// alert("Error");
// }
} else {
// $('#content').loader('hide');
alert("Error");
}
}

View File

@ -4003,15 +4003,9 @@ if (!empty($getlogpodtl)) {
<td align="right">${quantity}</td>
<td align="left">${uom}</td>
<td align="right">${itemRate}</td>
<td align="right">${PER}</td>
<td align="right">${service_description}</td>
<td align="right">${basicval}</td>
<td align="right">${TotalTaxValue}</td>
<td align="right">${TotalOrderValue}</td>
<td align="right">${quantity}</td>
<td align="right">0</td>
<td align="right">${quantity}</td>
<td>
<a data-target='#EDITREVENUE' data-id="${temp}" data-userid="${temp}" data-toggle="modal" href="#EDITREVENUE">
<i class="ri-pencil-fill"></i>
@ -4891,15 +4885,15 @@ if (!empty($getlogpodtl)) {
processData: false,
contentType: false,
success: function(data) {
// console.log(data);
console.log(data);
if (data) {
alert(data);
$('#txtRowCount').val('');
$('#txtDeletedRow').val('');
$('#txtStatus').val('');
$('#SpcialInstruction').val('');
$('#txtDeliveryAddress').val('')
window.location = "purchaseorderListing";
// alert(data);
// $('#txtRowCount').val('');
// $('#txtDeletedRow').val('');
// $('#txtStatus').val('');
// $('#SpcialInstruction').val('');
// $('#txtDeliveryAddress').val('')
// window.location = "purchaseorderListing";
} else {
alert("Error");

View File

@ -1166,13 +1166,13 @@ if (!empty($getlogpodtl)) {
<div class="form-group col-md-12">
<div align="right"><br>
<div>
<div align="right">
<div class="form-group col-md-3">
<input type="file" class="form-control" name="POFile" id="POFile">
<?php if ($PrePOFile) { ?>
<label><a title="previously uploaded PO File" href="<?php echo base_url() . 'public/uploads/POfiles/' . $PrePOFile ?>"><span>previously uploaded - </span><small><?= $PrePOFile; ?></small></a></label>
<?php } ?>
<input type="hidden" id="PrePOFile" name="PrePOFile" value="<?php echo $PrePOFile; ?>" /><br><br>
<input type="hidden" id="PrePOFile" name="PrePOFile" value="<?php echo $PrePOFile; ?>" />
</div>
<input type="hidden" name="txtPoRange" id="txtPoRange" />
<input type="hidden" name="isEdit" id="isEdit" value="0" />
@ -1211,10 +1211,8 @@ if (!empty($getlogpodtl)) {
</div>
<div class="form-row p-3" align="left" style="padding-right:10px">
<div class="col-md-5 col-md-offset-7" align="right"><br />
<br><br>
<div class="form-group col-md-12" align="left" style="padding-right:10px">
<div class="col-md-5 col-md-offset-7" align="left"><br />
<label>Request On :</label><?php echo $Reqon; ?><br />
<label>Request By :</label><?php echo $RequesterName; ?><br />
<label>Status : </label><?php