FIX_igr Changes : ps
This commit is contained in:
parent
873a206fa7
commit
f861d6635d
@ -141,9 +141,9 @@ define('REQ_READYFORDELIVERY','ST049');
|
||||
define('REQ_DELIVERED','ST050');
|
||||
|
||||
/* IGR Status */
|
||||
define('IGR_DRAFT','ST074');
|
||||
define('IGR_CREATED','ST027');
|
||||
define('IGR_CLOSED','ST028');
|
||||
define('IGR_DRAFT','ST074');
|
||||
define('IGR_CANCELLED','ST029');
|
||||
define('POLINEITEM_IGRPARTIAL_CREATED','ST042');
|
||||
|
||||
|
||||
@ -261,6 +261,7 @@ $routes->post('inwardgateregister/edituploadfile', 'Inwardgateregister::edituplo
|
||||
$routes->post('inwardgateregister/addloadfile', 'Inwardgateregister::addloadfile');
|
||||
$routes->post('inwardgateregister/UpdateIGR', 'Inwardgateregister::UpdateIGR');
|
||||
$routes->post('inwardgateregister/updateIGRLineItem', 'Inwardgateregister::updateIGRLineItem');
|
||||
$routes->post('inwardgateregister/ViewIGRHistory', 'Inwardgateregister::ViewIGRHistory');
|
||||
|
||||
// Application OGR Page
|
||||
$routes->match(['get', 'post', 'put', 'delete'],'AddOgr', 'Inwardgateregister::addoutwardgateregister');
|
||||
|
||||
@ -67,7 +67,6 @@ class Inwardgateregister extends BaseController
|
||||
return !($item->status === 'ST027' && $item->IsOpenOrder === null);
|
||||
});
|
||||
|
||||
|
||||
$this->loadViews("inwardgateregister", $this->global, $data, NULL);
|
||||
}
|
||||
|
||||
@ -314,11 +313,81 @@ class Inwardgateregister extends BaseController
|
||||
$prefile = array();
|
||||
$fileupdated_count = 0;
|
||||
$fileupdated_name = [];
|
||||
$GrossWeight = $this->request->getPost('GrossWeight');
|
||||
$TareWeight = $this->request->getPost('TareWeight');
|
||||
$NetWeight = $this->request->getPost('NetWeight');
|
||||
$GrossWeightDate = (string)$this->request->getPost('GrossWeightDate');
|
||||
$GrossWtDt = get_date_time_format($GrossWeightDate);
|
||||
$TareWeightDate = (string)$this->request->getPost('TareWeightDate');
|
||||
$TareWtDt = get_date_time_format($TareWeightDate);
|
||||
|
||||
$igr = array('PONO' => $PONO, 'VehicleNo' => $VehicleNo, 'DeliveryChellanOrInvoiceNo' => $DeliveryChellanOrInvoiceNo, 'DeliveryChellanDate' => $DeliveryChellanDate, 'MaterialRcvdDate' => $MaterialRcvdDt, 'DriverName' => $DriverName, 'DriverMobileNumber' => $DriverMobileNumber,'IGRStatus' => $IGRStatus, 'CreatedBy' => $CreatedBy, 'CreatedDate' => $createddt, 'PaymentStatus' => $paymentstatus);
|
||||
// $igr = array('PONO' => $PONO, 'VehicleNo' => $VehicleNo, 'DeliveryChellanOrInvoiceNo' => $DeliveryChellanOrInvoiceNo, 'DeliveryChellanDate' => $DeliveryChellanDate, 'MaterialRcvdDate' => $MaterialRcvdDt, 'DriverName' => $DriverName, 'DriverMobileNumber' => $DriverMobileNumber,'IGRStatus' => $IGRStatus, 'CreatedBy' => $CreatedBy, 'CreatedDate' => $createddt, 'PaymentStatus' => $paymentstatus);
|
||||
$igr = array('PONO' => $PONO, 'VehicleNo' => $VehicleNo, 'DeliveryChellanOrInvoiceNo' => $DeliveryChellanOrInvoiceNo, 'DeliveryChellanDate' => $DeliveryChellanDate, 'MaterialRcvdDate' => $MaterialRcvdDt, 'DriverName' => $DriverName, 'DriverMobileNumber' => $DriverMobileNumber,'IGRStatus' => $IGRStatus, 'CreatedBy' => $CreatedBy, 'CreatedDate' => $createddt, 'PaymentStatus' => $paymentstatus,'GrossWeight'=>$GrossWeight,'TareWeight'=>$TareWeight,'NetWeight'=>$NetWeight,'GrossWeightDate'=>$GrossWtDt,'TareWeightDate'=>$TareWtDt);
|
||||
|
||||
|
||||
//Saving IGR details Here
|
||||
$IGRNO = $this->inwardgateregister_model->addigrM($igr);
|
||||
if($IGRNO){
|
||||
#Step 1.1 Fetch On History
|
||||
if($GrossWeight){
|
||||
$igr_history = array('field' => 'GrossWeight','is_add' => 1,'new_data' => $GrossWeight,'old_data' => NULL,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNO);
|
||||
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||
|
||||
}
|
||||
if($TareWeight){
|
||||
$igr_history = array('field' => 'TareWeight','is_add' => 1,'new_data' => $TareWeight,'old_data' => NULL,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNO);
|
||||
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||
|
||||
}
|
||||
if($NetWeight){
|
||||
$igr_history = array('field' => 'NetWeight','is_add' => 1,'new_data' => $NetWeight,'old_data' => NULL,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNO);
|
||||
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||
|
||||
}
|
||||
if($GrossWtDt){
|
||||
$igr_history = array('field' => 'GrossWeightDate','is_add' => 1,'new_data' => $GrossWtDt,'old_data' => NULL,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNO);
|
||||
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||
|
||||
}
|
||||
if($TareWtDt){
|
||||
$igr_history = array('field' => 'TareWeightDate','is_add' => 1,'new_data' => $TareWtDt,'old_data' => NULL,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNO);
|
||||
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||
}
|
||||
// if($DeliveryChellanOrInvoiceNo){
|
||||
// $igr_history = array('field' => 'DeliveryChellanOrInvoiceNo','is_add' => 1,'new_data' => $DeliveryChellanOrInvoiceNo,'old_data' => NULL,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNO);
|
||||
// $history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||
// log_message('error', "History updated successfully. History id: " . $history_id);
|
||||
// }
|
||||
// if($DeliveryChellanDate){
|
||||
// $igr_history = array('field' => 'DeliveryChellanDate','is_add' => 1,'new_data' => $DeliveryChellanDate,'old_data' => NULL,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNO);
|
||||
// $history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||
// log_message('error', "History updated successfully. History id: " . $history_id);
|
||||
// }
|
||||
// if($MaterialRcvdDt){
|
||||
// $igr_history = array('field' => 'MaterialRcvdDate','is_add' => 1,'new_data' => $MaterialRcvdDt,'old_data' => NULL,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNO);
|
||||
// $history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||
// log_message('error', "History updated successfully. History id: " . $history_id);
|
||||
// }
|
||||
if($VehicleNo){
|
||||
$igr_history = array('field' => 'VehicleNo','is_add' => 1,'new_data' => $VehicleNo,'old_data' => NULL,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNO);
|
||||
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||
}
|
||||
if($DriverName){
|
||||
$igr_history = array('field' => 'DriverName','is_add' => 1,'new_data' => $DriverName,'old_data' => NULL,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNO);
|
||||
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||
}
|
||||
if($DriverMobileNumber){
|
||||
$igr_history = array('field' => 'DriverMobileNumber','is_add' => 1,'new_data' => $DriverMobileNumber,'old_data' => NULL,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNO);
|
||||
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||
}
|
||||
#Step 2 File Details Gathering
|
||||
if($constant){
|
||||
for ($i = 1; $i <= $constant; $i++) {
|
||||
@ -411,6 +480,7 @@ class Inwardgateregister extends BaseController
|
||||
$igrDetails = array('IGRNO' => $IGRNO, 'MaterialCode' => $MaterialCode, 'QuantityAsPerInvoice' => $QuantityAsPerInvoice, 'Remarks' => $Remarks, 'IGRItemStatus' => $IGRItemStatus, 'CreatedBy' => $CreatedBy, 'CreatedDate' => $createddt);
|
||||
$igrD = $this->inwardgateregister_model->addigrD($igrDetails);
|
||||
$igrlineno = !empty($igrD) ? $igrD : '';
|
||||
|
||||
$itemvalue = '';
|
||||
$SupplierId = '';
|
||||
$polineitemvalue = $this->inwardgateregister_model->getitemvalue($PONO, $MaterialCode);
|
||||
@ -420,6 +490,16 @@ class Inwardgateregister extends BaseController
|
||||
}
|
||||
$historydetails = array('MaterialCode' => $MaterialCode, 'Transaction_type' => "Add", 'Ref_Type' => "IGR", 'Ref_No' => $igrlineno, 'Quantity' => $QuantityAsPerInvoice, 'CreatedBy' => $CreatedBy, 'CreatedOn' => $createddt, 'SupplierID' => $SupplierId, 'ItemValue' => $itemvalue);
|
||||
$this->inwardgateregister_model->addmaterialhistory($historydetails);
|
||||
if($QuantityAsPerInvoice){
|
||||
$igr_history = array('field' => 'QuantityAsPerInvoice','is_add' => 1,'new_data' => $QuantityAsPerInvoice,'old_data' => NULL,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNO,'IGRItem_No'=>$igrlineno);
|
||||
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||
}
|
||||
if($Remarks){
|
||||
$igr_history = array('field' => 'Remarks','is_add' => 1,'new_data' => $Remarks,'old_data' => NULL,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNO,'IGRItem_No'=>$igrlineno);
|
||||
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||
}
|
||||
$get_pre_qty = $this->inwardgateregister_model->get_CurrentQty($MaterialCode);
|
||||
$av_qty = 0;
|
||||
if (!empty($get_pre_qty)) {
|
||||
@ -668,7 +748,8 @@ echo "<script>
|
||||
$IGRNO = $this->request->getPost('id');
|
||||
|
||||
$data = $this->inwardgateregister_model->viewigr($IGRNO);
|
||||
// print_r( $data);die;
|
||||
// echo $IGRNO;
|
||||
// print_r($data);die;
|
||||
|
||||
echo json_encode($data);
|
||||
}
|
||||
@ -680,6 +761,12 @@ echo "<script>
|
||||
$data = array_merge($igrfile, $billfile);
|
||||
echo json_encode($data);
|
||||
}
|
||||
function ViewIGRHistory()
|
||||
{
|
||||
$IGRNO = $this->request->getPost('igr');
|
||||
$result = $this->inwardgateregister_model->ViewIGRHistory($IGRNO);
|
||||
return $this->response->setJSON($result);
|
||||
}
|
||||
|
||||
|
||||
function UpdateIGR()
|
||||
@ -705,18 +792,199 @@ echo "<script>
|
||||
echo "Not Updated!";
|
||||
}
|
||||
}
|
||||
function updateIGRLineItem() {
|
||||
$IGRNo = $this->request->getPost('igr');
|
||||
$Status = $this->request->getPost('status');
|
||||
function updateIGRLineItem() {
|
||||
|
||||
$IGRNo = $this->request->getPost('IGRNO');
|
||||
$Status = $this->request->getPost('IGRStatus');
|
||||
$DriverName = $this->request->getPost('DriverName');
|
||||
$DriverMobileNumber = $this->request->getPost('DriverMobileNumber');
|
||||
$GrossWeight = $this->request->getPost('GrossWeight');
|
||||
$TareWeight = $this->request->getPost('TareWeight');
|
||||
$NetWeight = $this->request->getPost('NetWeight');
|
||||
$VehicleNo = $this->request->getPost('VehicleNo');
|
||||
$requestdata = $this->request->getPost('data');
|
||||
$updateby = $this->session->get('userId');
|
||||
$GrossWeightDate = (string)$this->request->getPost('GrossWeightDate');
|
||||
$GrossWtDt = get_date_time_format($GrossWeightDate);
|
||||
$TareWeightDate = (string)$this->request->getPost('TareWeightDate');
|
||||
$TareWtDt = get_date_time_format($TareWeightDate);
|
||||
|
||||
|
||||
// Check if request data is not null and is a string
|
||||
if (is_string($requestdata)) {
|
||||
$lineitemdata = json_decode($requestdata, true); // Decode JSON data
|
||||
|
||||
if (is_array($lineitemdata)) {
|
||||
$igrarr = array('IGRStatus' => $Status, 'UpdateBY' => $updateby);
|
||||
if($GrossWeight){
|
||||
$gross = $this->inwardgateregister_model->get_igr_history('GrossWeight',$IGRNo);
|
||||
if(!empty($gross)){
|
||||
$old_data = NULL;
|
||||
foreach ($gross as $row) {
|
||||
if ($row->field == 'GrossWeight') {
|
||||
$old_data = $row->new_data;
|
||||
}
|
||||
}
|
||||
$igr_history = array('field' => 'GrossWeight','new_data' => $GrossWeight,'old_data' => $old_data,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNo);
|
||||
($old_data != NULL) ? $igr_history['is_edit'] = 1 : $igr_history['is_add'] = 1 ;
|
||||
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||
}else{
|
||||
$igr_history = array('field' => 'GrossWeight','is_add' => 1,'new_data' => $GrossWeight,'old_data' => NULL,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNo);
|
||||
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||
|
||||
}
|
||||
}
|
||||
if($TareWeight){
|
||||
$tare = $this->inwardgateregister_model->get_igr_history('TareWeight',$IGRNo);
|
||||
if(!empty($tare)){
|
||||
$old_data = NULL;
|
||||
foreach ($gross as $row) {
|
||||
if ($row->field == 'TareWeight') {
|
||||
$old_data = $row->new_data;
|
||||
}
|
||||
}
|
||||
$igr_history = array('field' => 'TareWeight','new_data' => $TareWeight,'old_data' => $old_data,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNo);
|
||||
($old_data != NULL) ? $igr_history['is_edit'] = 1 : $igr_history['is_add'] = 1 ;
|
||||
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||
}else{
|
||||
$igr_history = array('field' => 'TareWeight','is_edit' => 1,'new_data' => $TareWeight,'old_data' => NULL,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNo);
|
||||
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||
}
|
||||
}
|
||||
if($NetWeight){
|
||||
$net = $this->inwardgateregister_model->get_igr_history('NetWeight',$IGRNo);
|
||||
if(!empty($net)){
|
||||
$old_data = NULL;
|
||||
foreach ($gross as $row) {
|
||||
if ($row->field == 'NetWeight') {
|
||||
$old_data = $row->new_data;
|
||||
}
|
||||
}
|
||||
$igr_history = array('field' => 'NetWeight','new_data' => $NetWeight,'old_data' => $old_data,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNo);
|
||||
($old_data != NULL) ? $igr_history['is_edit'] = 1 : $igr_history['is_add'] = 1 ;
|
||||
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||
} else{
|
||||
$igr_history = array('field' => 'NetWeight','is_edit' => 1,'new_data' => $NetWeight,'old_data' => NULL,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNo);
|
||||
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||
}
|
||||
}
|
||||
if($GrossWtDt){
|
||||
$grossdate = $this->inwardgateregister_model->get_igr_history('GrossWeightDate',$IGRNo);
|
||||
if(!empty($grossdate)){
|
||||
$old_data = NULL;
|
||||
foreach ($gross as $row) {
|
||||
if ($row->field == 'GrossWeightDate') {
|
||||
$old_data = $row->new_data;
|
||||
}
|
||||
}
|
||||
$igr_history = array('field' => 'GrossWeightDate','new_data' => $GrossWtDt,'old_data' => $old_data,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNo);
|
||||
($old_data != NULL) ? $igr_history['is_edit'] = 1 : $igr_history['is_add'] = 1 ;
|
||||
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||
} else{
|
||||
$igr_history = array('field' => 'GrossWeightDate','is_edit' => 1,'new_data' => $GrossWtDt,'old_data' => NULL,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNo);
|
||||
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||
}
|
||||
}
|
||||
if($TareWtDt){
|
||||
$taredate = $this->inwardgateregister_model->get_igr_history('TareWeightDate',$IGRNo);
|
||||
|
||||
if(!empty($taredate)){
|
||||
$old_data = NULL;
|
||||
foreach ($taredate as $row) {
|
||||
if ($row->field == 'TareWeightDate') {
|
||||
$old_data = $row->new_data;
|
||||
}
|
||||
}
|
||||
$igr_history = array('field' => 'TareWeightDate','new_data' => $TareWtDt,'old_data' => $old_data,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNo);
|
||||
($old_data != NULL) ? $igr_history['is_edit'] = 1 : $igr_history['is_add'] = 1 ;
|
||||
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||
} else{
|
||||
$igr_history = array('field' => 'TareWeightDate','is_edit' => 1,'new_data' => $TareWtDt,'old_data' => NULL,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNo);
|
||||
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||
}
|
||||
}
|
||||
// if($DeliveryChellanOrInvoiceNo){
|
||||
// $igr_history = array('field' => 'DeliveryChellanOrInvoiceNo','is_edit' => 1,'new_data' => $DeliveryChellanOrInvoiceNo,'old_data' => NULL,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNO);
|
||||
// $history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||
// log_message('error', "History updated successfully. History id: " . $history_id);
|
||||
// }
|
||||
// if($DeliveryChellanDate){
|
||||
// $igr_history = array('field' => 'DeliveryChellanDate','is_edit' => 1,'new_data' => $DeliveryChellanDate,'old_data' => NULL,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNO);
|
||||
// $history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||
// log_message('error', "History updated successfully. History id: " . $history_id);
|
||||
// }
|
||||
// if($MaterialRcvdDt){
|
||||
// $igr_history = array('field' => 'MaterialRcvdDate','is_edit' => 1,'new_data' => $MaterialRcvdDt,'old_data' => NULL,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNO);
|
||||
// $history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||
// log_message('error', "History updated successfully. History id: " . $history_id);
|
||||
// }
|
||||
if($VehicleNo){
|
||||
$vecno = $this->inwardgateregister_model->get_igr_history('VehicleNo',$IGRNo);
|
||||
|
||||
if(!empty($vecno)){
|
||||
$old_data = NULL;
|
||||
foreach ($vecno as $row) {
|
||||
if ($row->field == 'VehicleNo') {
|
||||
$old_data = $row->new_data;
|
||||
}
|
||||
}
|
||||
$igr_history = array('field' => 'VehicleNo','new_data' => $VehicleNo,'old_data' => $old_data,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNo);
|
||||
($old_data != NULL) ? $igr_history['is_edit'] = 1 : $igr_history['is_add'] = 1 ;
|
||||
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||
} else{$igr_history = array('field' => 'VehicleNo','is_edit' => 1,'new_data' => $VehicleNo,'old_data' => NULL,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNo);
|
||||
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||
}}
|
||||
if($DriverName){
|
||||
$drname = $this->inwardgateregister_model->get_igr_history('DriverName',$IGRNo);
|
||||
|
||||
if(!empty($drname)){
|
||||
$old_data = NULL;
|
||||
foreach ($drname as $row) {
|
||||
if ($row->field == 'DriverName') {
|
||||
$old_data = $row->new_data;
|
||||
}
|
||||
}
|
||||
$igr_history = array('field' => 'DriverName','new_data' => $DriverName,'old_data' => $old_data,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNo);
|
||||
($old_data != NULL) ? $igr_history['is_edit'] = 1 : $igr_history['is_add'] = 1 ;
|
||||
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||
} else{
|
||||
$igr_history = array('field' => 'DriverName','is_edit' => 1,'new_data' => $DriverName,'old_data' => NULL,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNo);
|
||||
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||
}}
|
||||
if($DriverMobileNumber){
|
||||
$drmob = $this->inwardgateregister_model->get_igr_history('DriverMobileNumber',$IGRNo);
|
||||
|
||||
if(!empty($drmob)){
|
||||
$old_data = NULL;
|
||||
foreach ($drmob as $row) {
|
||||
if ($row->field == 'GrossWeight') {
|
||||
$old_data = $row->new_data;
|
||||
}
|
||||
}
|
||||
$igr_history = array('field' => 'DriverMobileNumber','new_data' => $DriverMobileNumber,'old_data' => $old_data,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNo);
|
||||
($old_data != NULL) ? $igr_history['is_edit'] = 1 : $igr_history['is_add'] = 1 ;
|
||||
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||
} else{
|
||||
$igr_history = array('field' => 'DriverMobileNumber','is_edit' => 1,'new_data' => $DriverMobileNumber,'old_data' => NULL,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNo);
|
||||
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||
}}
|
||||
$igrarr = array('VehicleNo' => $VehicleNo, 'DriverName' => $DriverName, 'DriverMobileNumber' => $DriverMobileNumber,'IGRStatus' => $Status, 'UpdateBY' => $updateby,'GrossWeight'=>$GrossWeight,'TareWeight'=>$TareWeight,'NetWeight'=>$NetWeight,'GrossWeightDate'=>$GrossWtDt,'TareWeightDate'=>$TareWtDt);
|
||||
|
||||
$masterdata = $this->inwardgateregister_model->updateigr($igrarr, $IGRNo);
|
||||
$dummy = 0;
|
||||
$i=1;
|
||||
@ -738,6 +1006,43 @@ echo "<script>
|
||||
);
|
||||
// print_r($igrline);
|
||||
$lineitemdata = $this->inwardgateregister_model->updateIGRLineItem($igrline, $IGRItemNo);
|
||||
if($QuantityAsPerInvoice){
|
||||
$qu = $this->inwardgateregister_model->get_igr_history('QuantityAsPerInvoice',$IGRNo,$IGRItemNo);
|
||||
|
||||
if(!empty($qu)){
|
||||
$old_data = NULL;
|
||||
foreach ($qu as $row) {
|
||||
if ($row->field == 'QuantityAsPerInvoice') {
|
||||
$old_data = $row->new_data;
|
||||
}
|
||||
}
|
||||
$igr_history = array('field' => 'QuantityAsPerInvoice','new_data' => $QuantityAsPerInvoice,'old_data' => $old_data,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNo,'IGRItem_No' => $IGRItemNo);
|
||||
($old_data != NULL) ? $igr_history['is_edit'] = 1 : $igr_history['is_add'] = 1 ;
|
||||
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||
} else{
|
||||
$igr_history = array('field' => 'QuantityAsPerInvoice','is_add' => 1,'new_data' => $QuantityAsPerInvoice,'old_data' => NULL,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNo,'IGRItem_No' => $IGRItemNo);
|
||||
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||
}}
|
||||
if($Remarks){
|
||||
$remak = $this->inwardgateregister_model->get_igr_history('Remarks',$IGRNo,$IGRItemNo);
|
||||
|
||||
if(!empty($remak)){
|
||||
$old_data = NULL;
|
||||
foreach ($remak as $row) {
|
||||
if ($row->field == 'Remarks') {
|
||||
$old_data = $row->new_data;
|
||||
}
|
||||
}
|
||||
$igr_history = array('field' => 'Remarks','new_data' => $Remarks,'old_data' => $old_data,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNo,'IGRItem_No' => $IGRItemNo);
|
||||
($old_data != NULL) ? $igr_history['is_edit'] = 1 : $igr_history['is_add'] = 1 ;
|
||||
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||
} else{$igr_history = array('field' => 'Remarks','is_add' => 1,'new_data' => $Remarks,'old_data' => NULL,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNo,'IGRItem_No' => $IGRItemNo);
|
||||
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||
}}
|
||||
$i++;
|
||||
if ($lineitemdata > 0) {
|
||||
$dummy++;
|
||||
|
||||
@ -196,6 +196,38 @@ class Inwardgateregister_model extends Model
|
||||
$result = $query->getResult();
|
||||
return $result; */
|
||||
}
|
||||
|
||||
public function igr_history($hsty_arr) {
|
||||
$this->db->transStart();
|
||||
$builder = $this->db->table('T_IGR_History');
|
||||
$builder->insert($hsty_arr);
|
||||
$this->db->transComplete();
|
||||
if ($this->db->transStatus() === FALSE) {
|
||||
return false;
|
||||
} else {
|
||||
return $this->db->insertID();
|
||||
}
|
||||
}
|
||||
|
||||
function get_igr_history($col,$IGR,$IGRITEM = null)
|
||||
{
|
||||
|
||||
$builder = $this->db->table('T_IGR_History Hist')
|
||||
->select("Hist.*");
|
||||
$builder->where('Hist.field', $col);
|
||||
if($IGR){
|
||||
$builder->where('Hist.IGR_No', $IGR);
|
||||
}
|
||||
if ($IGRITEM !== null) {
|
||||
$builder->where('Hist.IGRItem_No', $IGRITEM);
|
||||
}
|
||||
$query = $builder->get();
|
||||
$result = $query->getResult();
|
||||
return $result;
|
||||
// $result = $model->get_igr_history('001');
|
||||
// $result = $model->get_igr_history('001', 1);
|
||||
|
||||
}
|
||||
|
||||
function addigrM($igrM)
|
||||
{
|
||||
@ -289,6 +321,11 @@ class Inwardgateregister_model extends Model
|
||||
|
||||
function viewigr($IGRNO)
|
||||
{
|
||||
// ->select('igr.IGRNO','igr.PONO','igr.DeliveryChellanOrInvoiceNo','igr.DeliveryChellanDate','igr.MaterialRcvdDate','igr.VehicleNo','igr.CourierNo','igr.Remarks','igr.IGRStatus','igr.CreatedDate','igr.CreatedBy','igr.UpdateBY','igr.UpdatedOn','igr.file','igr.Paymentstatus','igr.DriverName','igr.DriverMobileNumber','igr.NetWeight','igr.GrossWeight','igr.TareWeight','igr.GrossWeightDate','igr.TareWeightDate')
|
||||
// ->select('igrd.IGRItemNo','igrd.IGRNO','igrd.MaterialCode','igrd.QuantityAsPerInvoice')
|
||||
// ->select('igrd.Remarks','igrd.IGRItemStatus','igrd.CancelNote','igrd.BankStatus')
|
||||
// ->select('MM.MaterialName,MM.UOM,sup.Address,sup.SupplierName,POM.ServiceDescription,POL.Quantity,POM.POType')
|
||||
|
||||
$builder = $this->db->table('T_IGR_Master igr')
|
||||
->distinct()
|
||||
->select('igr.IGRNO,igr.*,igrd.*,MM.MaterialName,MM.UOM,sup.Address,sup.SupplierName,POM.ServiceDescription,POL.Quantity,POM.POType')
|
||||
@ -302,7 +339,7 @@ class Inwardgateregister_model extends Model
|
||||
$query = $builder->get();
|
||||
|
||||
$result = $query->getResult();
|
||||
|
||||
// echo $this->db->getLastQuery()->getQuery();
|
||||
return $result;
|
||||
}
|
||||
|
||||
@ -691,7 +728,7 @@ class Inwardgateregister_model extends Model
|
||||
return $OGRNO;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -823,4 +860,21 @@ class Inwardgateregister_model extends Model
|
||||
$update = $this->db->affectedRows();
|
||||
return $update;
|
||||
}
|
||||
|
||||
public function ViewIGRHistory($igr)
|
||||
{
|
||||
$builder = $this->db->table('T_IGR_History');
|
||||
|
||||
$builder->select('T_IGR_History.*, CONCAT_WS(" ", T_Employee_Details.FirstName, T_Employee_Details.LastName) AS FullName');
|
||||
$builder->join('tbl_users', 'tbl_users.userId = T_IGR_History.by', 'left');
|
||||
$builder->join('T_Employee_Details', 'tbl_users.EmpID = T_Employee_Details.EmpID', 'left');
|
||||
$builder->where('IGR_No', $igr);
|
||||
|
||||
$query = $builder->get();
|
||||
$result = $query->getResult();
|
||||
return $result;
|
||||
|
||||
// Pass the result to the view or return it as JSON
|
||||
// return $this->response->setJSON($result);
|
||||
}
|
||||
}
|
||||
@ -30,9 +30,8 @@ class Mrir_model extends Model
|
||||
function ViewigrListing()
|
||||
{
|
||||
|
||||
|
||||
$builder = $this->db->table('T_IGR_Master igr')
|
||||
->select('igr.*,PO.DeliveryDate,sup.SupplierName')
|
||||
->select('igr.*,PO.DeliveryDate,sup.SupplierName,PO.POType')
|
||||
->join('T_PurchaseOrder_Master PO', 'igr.PONO = PO.PONO')
|
||||
->join('T_SupplierDetailsN` sup', 'PO.SupplierID = sup.SupplierID')
|
||||
->where('igr.IGRStatus !=', MRIR_CREATED)
|
||||
|
||||
@ -1489,7 +1489,7 @@
|
||||
<?php $link = ($DEPCode == SECURITY) ? base_url() . 'ViewigrDetails' : base_url() . 'Viewigr'; ?>
|
||||
<a href="<?php echo $link; ?>">
|
||||
<i class="fa fa-upload"></i>
|
||||
<span>View Inward Gate Register</span>
|
||||
<span>View Inward Gate Register 1</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
@ -1548,7 +1548,7 @@
|
||||
<!-- <li class="treeview">
|
||||
<a href="<?php echo base_url(); ?>ViewigrDetails">
|
||||
<i class="fa fa-upload"></i>
|
||||
<span>View Inward Gate Register</span>
|
||||
<span>View Inward Gate Register 2</span>
|
||||
</a>
|
||||
</li> -->
|
||||
<?php } ?>
|
||||
@ -1563,7 +1563,7 @@
|
||||
<li class="treeview">
|
||||
<a href="<?php echo base_url(); ?>ViewigrDetails">
|
||||
<i class="fa fa-upload"></i>
|
||||
<span>View Inward Gate Register</span>
|
||||
<span>View Inward Gate Register 3</span>
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?> -->
|
||||
@ -1607,7 +1607,7 @@
|
||||
<?php $link = ($DEPCode == SECURITY) ? base_url() . 'ViewigrDetails' : base_url() . 'Viewigr'; ?>
|
||||
<a href="<?php echo $link; ?>">
|
||||
<i class="fa fa-eye"></i>
|
||||
<span>View Inward Gate Register</span>
|
||||
<span>View Inward Gate Register 4</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
@ -1704,7 +1704,7 @@
|
||||
<?php $link = ($DEPCode == SECURITY) ? base_url() . 'ViewigrDetails' : base_url() . 'Viewigr'; ?>
|
||||
<a href="<?php echo $link; ?>">
|
||||
<i class="fa fa-upload"></i>
|
||||
<span>View Inward Gate Register</span>
|
||||
<span>View Inward Gate Register 5</span>
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
@ -1743,19 +1743,14 @@
|
||||
<span>Inward Gate Register Entry</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?php echo base_url(); ?>ViewigrDetails">
|
||||
|
||||
<li>
|
||||
<?php $link = ($DEPCode == SECURITY) ? base_url() . 'ViewigrDetails' : base_url() . 'Viewigr'; ?>
|
||||
<a href="<?php echo $link; ?>">
|
||||
<i class="fa fa-eye"></i>
|
||||
<span>View Inward Gate Register</span>
|
||||
</a>
|
||||
</li>
|
||||
<!-- <li>
|
||||
<?php // $link = ($DEPCode !== SECURITY) ? base_url() . 'ViewigrDetails' : base_url() . 'Viewigr'; ?>
|
||||
<a href="<?php // echo $link; ?>">
|
||||
<i class="fa fa-eye"></i>
|
||||
<span>View Inward Gate Register</span>
|
||||
</a>
|
||||
</li> -->
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
|
||||
@ -55,8 +55,12 @@
|
||||
|
||||
<div class="content-wrapper" style="min-height:537px;">
|
||||
<section class="content-header">
|
||||
<div class="pull-right hidden-xs">
|
||||
<!-- <b><?php // $date = date('Y-m-d H:i:s'); echo $date; ?> </b> -->
|
||||
<b><div id="clock"></div></b>
|
||||
</div>
|
||||
<h1>
|
||||
<center> Inward Gate Register </center>
|
||||
<center> Inward Gate Register</center>
|
||||
</h1>
|
||||
</section>
|
||||
<section class="content" style="margin: 15px;"><br/>
|
||||
@ -161,7 +165,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- <div class="col-md-12">
|
||||
<div class="col-md-offset-4">
|
||||
<div class="box-header">
|
||||
@ -186,6 +189,8 @@
|
||||
<input type="hidden" name="hidecounters" id="hidecounters" value="0" />
|
||||
<input type="hidden" name="hideconstants" id="hideconstants" value="0" />
|
||||
<input type="hidden" name="hideIGRStatus" id="hideIGRStatus" value="0" />
|
||||
<input type="hidden" name="hideIGRRemarks" id="hideIGRRemarks" value="" />
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
@ -202,8 +207,8 @@
|
||||
<th>UOM</th>
|
||||
<th>Ordered Quantity</th>
|
||||
<th>Received Quantity</th>
|
||||
<th>Advised Quantity</th>
|
||||
<th>Balance Quantity</th>
|
||||
<th>Balance Quantity</th>
|
||||
<th>Pending Quantity</th>
|
||||
<th>Remarks</th>
|
||||
|
||||
</tr>
|
||||
@ -245,10 +250,64 @@
|
||||
|
||||
|
||||
</div> -->
|
||||
<div class="col-md-4 col-md-offset-8">
|
||||
<div class="container">
|
||||
<div class="form-group row">
|
||||
<label for="GrossWeight" class="col-md-2 col-form-label">Gross Weight</label>
|
||||
<div class="col-md-3">
|
||||
<?php
|
||||
$data = array('name' => 'GrossWeight', 'value' => set_value('GrossWeight'), 'id' => 'GrossWeight', 'class' => 'form-control', 'onkeypress' => 'return isNumberKey(event);', 'maxlength' => '50', 'onchange' => 'WeightDiffer(this);');
|
||||
echo form_input($data);
|
||||
?>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<?php
|
||||
$data = array('name' => 'GrossWeightDate', 'value' => set_value('GrossWeightDate'), 'id' => 'GrossWeightDate', 'class' => 'form-control', 'readonly' => true);
|
||||
echo form_input($data);
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="TareWeight" class="col-md-2 col-form-label">Tare Weight</label>
|
||||
<div class="col-md-3">
|
||||
<?php
|
||||
$data = array('name' => 'TareWeight', 'value' => set_value('TareWeight'), 'id' => 'TareWeight', 'class' => 'form-control', 'onkeypress' => 'return isNumberKey(event);', 'maxlength' => '50', 'onchange' => 'WeightDiffer(this);');
|
||||
echo form_input($data);
|
||||
?>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<?php
|
||||
$data = array('name' => 'TareWeightDate', 'value' => set_value('TareWeightDate'), 'id' => 'TareWeightDate', 'class' => 'form-control', 'readonly' => true);
|
||||
echo form_input($data);
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="NetWeight" class="col-md-2 col-form-label">Net Weight</label>
|
||||
<div class="col-md-3">
|
||||
<?php
|
||||
$data = array('name' => 'NetWeight', 'value' => set_value('NetWeight'), 'id' => 'NetWeight', 'class' => 'form-control', 'maxlength' => '50', 'readonly' => true);
|
||||
echo form_input($data);
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ($DEPCode == ADMIN) { $class = "col-md-5 col-md-offset-7"; }else{ $class="col-md-4 col-md-offset-8";} ?>
|
||||
<div class="<?php echo $class; ?>">
|
||||
<input type="file" name="browseFiles1" id="images1" onchange="Copyfilenames(this.name); "><br>
|
||||
<?php if (($DEPCode == SECURITY || $DEPCode == ADMIN)) { ?>
|
||||
<button class="btn btn-success" id='IGRDraftLink' type="submit" name='IGRDraftLink' onclick="filecheck(0);">Draft IGR</button>
|
||||
<button class="btn btn-success" id='IGRLink' type="submit" name='IGRLink' onclick="filecheck(1);">Generate IGR</button>
|
||||
<?php } if (($DEPCode == SECURITY || $DEPCode == ADMIN && 1)) { ?>
|
||||
<button class="btn btn-success" id='IGRCreatedLink' type="submit" name='IGRCreatedLink' onclick="filecheck(1);">Generate IGR</button>
|
||||
<?php } if ($DEPCode == ADMIN) { ?>
|
||||
<button class="btn btn-success" id='IGRCompleteLink' type="submit" name='IGRCompleteLink' onclick="filecheck(2);">Complete IGR</button>
|
||||
<?php } if ($DEPCode == ADMIN) { ?>
|
||||
<button class="btn btn-success" id='IGRCancelLink' type="submit" name='IGRCancelLink' onclick="filecheck(3);">Cancel IGR</button>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -311,13 +370,13 @@ function validate()
|
||||
var isExceed = 0;
|
||||
for(k=1;k<=rowcount ; k++)
|
||||
{
|
||||
var AdvisedQty = parseFloat( $('#QuantityAsPerInvoice'+k).val() == '' ? '0.00' : $('#QuantityAsPerInvoice'+k).val());
|
||||
var PendingQty = parseFloat( $('#QuantityAsPerInvoice'+k).val() == '' ? '0.00' : $('#QuantityAsPerInvoice'+k).val());
|
||||
var RecQty = parseFloat( $('#txtReceivedQuantity'+k).val() == '' ? '0.00' : $('#txtReceivedQuantity'+k).val());
|
||||
var OrderedQty =parseFloat($('#Quantity_1'+k).text());
|
||||
if(AdvisedQty != '0.00')
|
||||
if(PendingQty != '0.00')
|
||||
{
|
||||
|
||||
if(OrderedQty < (AdvisedQty+RecQty))
|
||||
if(OrderedQty < (PendingQty+RecQty))
|
||||
{
|
||||
isExceed = 1;
|
||||
return false;
|
||||
@ -355,13 +414,13 @@ function validate()
|
||||
else if (Noval == 0 )
|
||||
{
|
||||
|
||||
alert('Advised Quantity is Empty.Please Enter the value');
|
||||
alert('Pending Quantity is Empty.Please Enter the value');
|
||||
return false;
|
||||
|
||||
}
|
||||
else if(isExceed == 1 ){
|
||||
|
||||
alert("Advised Quantity is exceeding the Ordered Quantity.Please Contact Purchase Team for further Process ")
|
||||
alert("Pending Quantity is exceeding the Ordered Quantity.Please Contact Purchase Team for further Process ")
|
||||
return false;
|
||||
}
|
||||
else
|
||||
@ -477,9 +536,9 @@ function validate()
|
||||
'<td name="UOM">' + item.UOM + '</td>' +
|
||||
'<td name="Quantity1'+i+'" id="Quantity_1'+i+'">' + item.Quantity + '</td>' +
|
||||
'<td name="ReceivedQuantity'+i+'" id="ReceivedQuantity'+i+'">'+ item.ReceivedQuantity +'</td>'+
|
||||
'<td name="PendingQuantity'+i+'" id="PendingQuantity'+i+'">'+ item.PendingQty +'</td>'+
|
||||
'<td data-name="sel" ><input type="text" onchange="validateReceivedQuantity('+i+')"id="QuantityAsPerInvoice'+ i +'" name="QuantityAsPerInvoice'+ i +'" value="" onkeypress="return isNumberKey(event);"></td>' +
|
||||
|
||||
'<td name="PendingQuantity'+i+'" id="PendingQuantity'+i+'">'+ item.PendingQty +'</td>'+
|
||||
|
||||
'<td><input type="text" id="Remark'+ i +'" name="Remark'+ i +'" class="form" onchange="SetRemarks('+i+')"> </td>' +
|
||||
'</tr>';
|
||||
$('#txtRowCount').val(i);
|
||||
@ -496,12 +555,12 @@ function validate()
|
||||
$('#QuantityAsPerInvoice'+i).attr('readonly', 'true');
|
||||
// $('#txtEditFreight').attr('readonly', 'true');
|
||||
}
|
||||
$("#IGRLink").show();
|
||||
$("#IGRCreatedLink").show();
|
||||
|
||||
}else{
|
||||
|
||||
if(JSON.parse(data).length == 1 && item.PendingQty == 0){
|
||||
$("#IGRLink").hide();
|
||||
$("#IGRCreatedLink").hide();
|
||||
//alert('The Order is new completed!!');
|
||||
}
|
||||
|
||||
@ -526,11 +585,11 @@ function validate()
|
||||
if((status == '<?php echo IGR_CREATED ?>' || status == '<?php echo MRIR_CREATED ?>' || status == '<?php echo MRIR_APPROVED ?>') && ((hiddenIsOpenOrder === null || hiddenIsOpenOrder === "")) )
|
||||
{
|
||||
alert('The Order is completed!!');
|
||||
$("#IGRLink").hide();
|
||||
$("#IGRCreatedLink").hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#IGRLink").show();
|
||||
$("#IGRCreatedLink").show();
|
||||
}
|
||||
|
||||
}
|
||||
@ -563,7 +622,7 @@ function validateReceivedQuantity(Rowid){
|
||||
|
||||
if (parseInt(OrderedQty) !== 0) {
|
||||
if((InvoiceQty+RecQty) > OrderedQty){
|
||||
alert("Advised Quantity is exceeding the Ordered Quantity.Please Contact Purchase Team for further Process ")
|
||||
alert("Pending Quantity is exceeding the Ordered Quantity.Please Contact Purchase Team for further Process ")
|
||||
$("#QuantityAsPerInvoice"+Rowid).focus();
|
||||
$("#QuantityAsPerInvoice"+Rowid).val('');
|
||||
return false;
|
||||
@ -606,10 +665,10 @@ function isNumberKey(evt)
|
||||
function Save(status)
|
||||
{
|
||||
alert("save function worked "+status);
|
||||
return true;
|
||||
}
|
||||
if(status == '3'){
|
||||
$('#cancelIGR').modal('show');
|
||||
}
|
||||
|
||||
function S(){
|
||||
//alert("save function worked ");
|
||||
// var file = $('#images'+counterConstants).val()
|
||||
|
||||
@ -845,6 +904,21 @@ function Copyfilenames(id)
|
||||
}
|
||||
|
||||
|
||||
function WeightDiffer(element)
|
||||
{
|
||||
// console.log(element);
|
||||
var v1 = $("#GrossWeight").val();
|
||||
var v2 = $("#TareWeight").val();
|
||||
var v3 = v1-v2;
|
||||
$("#NetWeight").val(v3);
|
||||
if (element.id === 'GrossWeight') {
|
||||
$("#GrossWeightDate").val($("#clock").text());
|
||||
}
|
||||
|
||||
if (element.id === 'TareWeight') {
|
||||
$("#TareWeightDate").val($("#clock").text());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -875,4 +949,21 @@ function removeRows(inputs) {
|
||||
$("#addemorebutton").show();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
<script>
|
||||
function updateTime() {
|
||||
const now = new Date();
|
||||
const year = now.getFullYear();
|
||||
const month = (now.getMonth() + 1).toString().padStart(2, '0');
|
||||
const todaydate = now.getDate().toString().padStart(2, '0');
|
||||
const hours = now.getHours().toString().padStart(2, '0');
|
||||
const minutes = now.getMinutes().toString().padStart(2, '0');
|
||||
const seconds = now.getSeconds().toString().padStart(2, '0');
|
||||
const dateString = todaydate+'-'+month+'-'+year;
|
||||
const timeString = hours+":"+minutes+":"+seconds;
|
||||
document.getElementById('clock').textContent = dateString+" "+timeString;
|
||||
}
|
||||
|
||||
setInterval(updateTime, 1000); // Update every second
|
||||
updateTime(); // Initial call to display time immediately
|
||||
</script>
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,111 +1,127 @@
|
||||
<style>
|
||||
.modal
|
||||
{
|
||||
padding-right:25% ! important;
|
||||
.modal {
|
||||
padding-right: 25% ! important;
|
||||
}
|
||||
.num{
|
||||
text-align:right;
|
||||
}
|
||||
.modal-content
|
||||
{
|
||||
width: 800px ! important;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
$(function() {
|
||||
var d = new Date();
|
||||
|
||||
var month = d.getMonth();
|
||||
var day = d.getDate();
|
||||
var year = d.getFullYear() ;
|
||||
var SIAStartYear = year - 2015;
|
||||
var mindt = year-70;
|
||||
var maxdt = year-15;
|
||||
.num {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.modal-content {
|
||||
width: 800px ! important;
|
||||
}
|
||||
|
||||
.modal-footer {
|
||||
border-top-color: #fff ! important;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
$(function() {
|
||||
var d = new Date();
|
||||
|
||||
var month = d.getMonth();
|
||||
var day = d.getDate();
|
||||
var year = d.getFullYear();
|
||||
var SIAStartYear = year - 2015;
|
||||
var mindt = year - 70;
|
||||
var maxdt = year - 15;
|
||||
|
||||
$("#Invoice_Date , #MaterialRcvdDate ").datepicker({
|
||||
minDate : new Date(year-SIAStartYear,1,1),
|
||||
maxDate :'now',
|
||||
dateFormat: 'dd-mm-yy',changeMonth: true, changeYear: true,
|
||||
});
|
||||
});
|
||||
</script>
|
||||
minDate: new Date(year - SIAStartYear, 1, 1),
|
||||
maxDate: 'now',
|
||||
dateFormat: 'dd-mm-yy',
|
||||
changeMonth: true,
|
||||
changeYear: true,
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<div class="content-wrapper">
|
||||
|
||||
<section class="content"><br/>
|
||||
<div class="box">
|
||||
<div class=" container-fluid">
|
||||
<div class="box-header">
|
||||
<center><b><h3 class="box-title">View Inward Gate Register</h3></b></center>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
<table id="Inwardgateregistertable" class="table table-bordered table-hover" style="background-color:#fff;font-size:12px;">
|
||||
<thead style="background-color: #ddd;">
|
||||
<tr>
|
||||
<!-- <th>S.No</th> -->
|
||||
<th>IGR No</th>
|
||||
<th>PO No</th>
|
||||
<th>Supplier Name</th>
|
||||
<th>Invoice No</th>
|
||||
<th>Date of Invoice</th>
|
||||
<th>Vechicle No</th>
|
||||
<th>Courier No</th>
|
||||
<th>Action</th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<?php
|
||||
if(!empty($IGR))
|
||||
{ $index = 0;
|
||||
foreach($IGR as $record)
|
||||
{
|
||||
|
||||
$index = $index +1;
|
||||
?>
|
||||
<tr id="<?php echo $index ?>" >
|
||||
<!-- <td style="text-align: center;"><?php echo $index?></td> -->
|
||||
<td><a data-toggle="modal" data-target="#Igrshow" data-id="<%=index%>" data-userid="<?php echo $record->IGRNO ?>" > <u><?php echo $record->IGRNO ?></u></a></td>
|
||||
<td><?php echo $record->PONO ?></a></td>
|
||||
<td><?php echo $record->SupplierName ?></td>
|
||||
<td><?php echo $record->DeliveryChellanOrInvoiceNo ?></td>
|
||||
<td align="right"><?php
|
||||
$date = new DateTime($record->DeliveryChellanDate);
|
||||
echo $date->format('d-m-Y'); ?></td>
|
||||
<td><?php echo $record->VehicleNo ?></td>
|
||||
<td><?php echo $record->CreatedDate ?></td>
|
||||
<td>
|
||||
<a href="<?php echo base_url().'MRIRcontroller/igrdatavalues?IGRNO='.$record->IGRNO; ?>"><button style="font-size:12px" id="generated" name="generated">Generate MRIR <i class="fa fa-file-text"></i></button></a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
//$SNo++;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div> <!-- col-md-12 -->
|
||||
</div><!-- class row -->
|
||||
</div> <!-- class container-fluid -->
|
||||
|
||||
<section class="content"><br />
|
||||
<div class="box">
|
||||
<div class=" container-fluid">
|
||||
<div class="box-header">
|
||||
<center><b>
|
||||
<h3 class="box-title">View Inward Gate Register</h3>
|
||||
</b></center>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
<table id="Inwardgateregistertable" class="table table-bordered table-hover" style="background-color:#fff;font-size:12px;">
|
||||
<thead style="background-color: #ddd;">
|
||||
<tr>
|
||||
<!-- <th>S.No</th> -->
|
||||
<th>IGR No</th>
|
||||
<th>PO No</th>
|
||||
<th>Supplier Name</th>
|
||||
<th>Invoice No</th>
|
||||
<th>Date of Invoice</th>
|
||||
<th>Vechicle No</th>
|
||||
<th>Courier No</th>
|
||||
<th>Action</th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<?php
|
||||
if (!empty($IGR)) {
|
||||
$index = 0;
|
||||
foreach ($IGR as $record) {
|
||||
|
||||
$index = $index + 1;
|
||||
?>
|
||||
<tr id="<?php echo $index ?>">
|
||||
<!-- <td style="text-align: center;"><?php echo $index ?></td> -->
|
||||
<td><a data-toggle="modal" data-target="#Igrshow" data-id="<%=index%>" data-userid="<?php echo $record->IGRNO ?>" data-igrstatus="<?php echo $record->IGRStatus ?>" title="View Generated IGR details/edit Draft IGR details"> <u><?php echo $record->IGRNO ?></u></a></td>
|
||||
<td><?php echo $record->PONO ?></a></td>
|
||||
<td><?php echo $record->SupplierName ?></td>
|
||||
<td><?php echo $record->DeliveryChellanOrInvoiceNo ?></td>
|
||||
<td align="right"><?php
|
||||
$date = new DateTime($record->DeliveryChellanDate);
|
||||
echo $date->format('d-m-Y'); ?></td>
|
||||
<td><?php echo $record->VehicleNo ?></td>
|
||||
<td><?php echo $record->CreatedDate ?></td>
|
||||
<td>
|
||||
<a target="_blank" data-toggle="modal" data-target="#Historyshow" title="IGR History" data-igrno="<?php echo $record->IGRNO ?>"><button class="btn btn-success btn-sm">History <i class="fa fa-history"></i></button></a>
|
||||
<a href="<?php echo base_url() . 'MRIRcontroller/igrdatavalues?IGRNO=' . $record->IGRNO; ?>"><button style="font-size:12px" id="generated" name="generated">Generate MRIR <i class="fa fa-file-text"></i></button></a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
//$SNo++;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div> <!-- col-md-12 -->
|
||||
</div><!-- class row -->
|
||||
</div> <!-- class container-fluid -->
|
||||
</div><!-- class box -->
|
||||
|
||||
<div class="modal fade" id="Igrshow" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<!-- Modal content-->
|
||||
<form>
|
||||
<div class="modal-content" style="width:800px;">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<center><h4>Inward Gate Register Details</h4></center> <!-- IGR number should display here-->
|
||||
|
||||
<div class="modal fade" id="Igrshow" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<!-- Modal content-->
|
||||
<form>
|
||||
<div class="modal-content" style="width:800px;">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<center>
|
||||
<h4>Inward Gate Register Details</h4>
|
||||
</center> <!-- IGR number should display here-->
|
||||
<div class="pull-right hidden-xs">
|
||||
<b>
|
||||
<div id="clock"></div>
|
||||
</b>
|
||||
</div>
|
||||
<!--<div class="col-md-12">
|
||||
</div>
|
||||
|
||||
<!--<div class="col-md-12">
|
||||
<div class="col-md-3">
|
||||
<label>IGR Number :</label>
|
||||
</div>
|
||||
@ -145,15 +161,15 @@
|
||||
</div>
|
||||
|
||||
</div>-->
|
||||
|
||||
|
||||
<div class="col-md-12">
|
||||
<div class="col-md-4">
|
||||
<label>IGR Number </label>
|
||||
<?php
|
||||
$data = array('name' => 'IGRNumber','value' => set_value('IGRNumber'),'id'=>'IGRNO1', 'class' => 'form-control', 'required=>"true"' , 'readonly'=>'true' );
|
||||
|
||||
echo form_input($data);
|
||||
?>
|
||||
<label>IGR Number </label>
|
||||
<?php
|
||||
$data = array('name' => 'IGRNumber', 'value' => set_value('IGRNumber'), 'id' => 'IGRNO1', 'class' => 'form-control', 'required=>"true"', 'readonly' => 'true');
|
||||
|
||||
echo form_input($data);
|
||||
?>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div style="display: flex; justify-content: space-between; align-items: center;">
|
||||
@ -163,208 +179,456 @@
|
||||
</a>
|
||||
</div>
|
||||
<?php
|
||||
$data = array('name' => 'PurchaseOrderNumber','value' => set_value('PurchaseOrderNumber'),'id'=>'PONo', 'class' => 'form-control', 'required=>"true"' , 'readonly'=>'true' );
|
||||
|
||||
echo form_input($data);
|
||||
?>
|
||||
$data = array('name' => 'PurchaseOrderNumber', 'value' => set_value('PurchaseOrderNumber'), 'id' => 'PONo', 'class' => 'form-control', 'required=>"true"', 'readonly' => 'true');
|
||||
|
||||
echo form_input($data);
|
||||
?>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label>Supplier Name </label>
|
||||
<label>Supplier Name </label>
|
||||
<?php
|
||||
$data = array('name' => 'SupplierName','value' => set_value('SupplierName'),'id'=>'Supplier', 'class' => 'form-control', 'required=>"true"' , 'readonly'=>'true' );
|
||||
|
||||
echo form_input($data);
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12" style=" padding-bottom: 10px;">
|
||||
<div class="col-md-4">
|
||||
<label>Invoice Number </label>
|
||||
<?php
|
||||
$data = array('name' => 'InvoiceNO','value' => set_value('InvoiceNO'),'id'=>'Invoice_No', 'class' => 'form-control', 'required=>"true"' , 'readonly'=>'true' );
|
||||
|
||||
echo form_input($data);
|
||||
?>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label>Invoice Date </label>
|
||||
<?php
|
||||
$data = array('name' => 'InvoiceDate','value' => set_value('InvoiceDate'),'id'=>'Invoice_Date', 'class' => 'form-control', 'required=>"true"');
|
||||
echo form_input($data);
|
||||
?>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label>Material Received Date </label>
|
||||
<?php
|
||||
$data = array('name' => 'MaterialRcvdDate','value' => set_value('MaterialRcvdDate'),'id'=>'MaterialRcvdDate', 'class' => 'form-control');
|
||||
echo form_input($data);
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12" style=" padding-bottom: 10px;">
|
||||
<div class="col-md-4">
|
||||
<label>Vehicle Number</label>
|
||||
<?php
|
||||
$data = array('name' => 'VehicleNo','value' => set_value('VehicleNo'),'id'=>'Vehicle_No', 'class' => 'form-control', 'required=>"true"' , 'readonly'=>'true' );
|
||||
echo form_input($data);
|
||||
?>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label>Driver Name </label>
|
||||
<?php
|
||||
$data = array('name' => 'DriverName','value' => set_value('DriverName'),'id'=>'Driver_Name', 'class' => 'form-control', 'required=>"true"' , 'readonly'=>'true' );
|
||||
|
||||
echo form_input($data);
|
||||
?>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label>Driver Mobile Number </label>
|
||||
<?php
|
||||
$data = array('name' => 'DriverMobileNumber','value' => set_value('DriverMobileNumber'),'id'=>'DriverMobileNumber', 'class' => 'form-control' , 'readonly'=>'true' );
|
||||
echo form_input($data);
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
$data = array('name' => 'SupplierName', 'value' => set_value('SupplierName'), 'id' => 'Supplier', 'class' => 'form-control', 'required=>"true"', 'readonly' => 'true');
|
||||
|
||||
|
||||
<!-- Table to show the line item of po -->
|
||||
<div id="content" > </div>
|
||||
<table id="Inwardgateregistertable1" class="table table-bordered table-hover" style="background-color:#fff;font-size:12px;">
|
||||
<thead style="background-color: #ddd !important;">
|
||||
<tr>
|
||||
<th>SNo</th>
|
||||
<th>Item Code</th>
|
||||
<th>Item Description</th>
|
||||
<th>UOM</th>
|
||||
<th>Ordred Quantity</th>
|
||||
<th>Received Quantity</th>
|
||||
<th>Balance Quantity</th>
|
||||
<th>Remarks</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="tbleAppend1"></tbody>
|
||||
</table>
|
||||
|
||||
<div class="modal-footer">
|
||||
<a class="btn btn-success" id="update" value="Update">Update</a>
|
||||
<a class="btn btn-success" data-dismiss="modal" value="Cancel">Cancel</a>
|
||||
echo form_input($data);
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div><!-- modal-dialog -->
|
||||
</div> <!-- modal -->
|
||||
</section><!-- content-->
|
||||
</div><!-- content-wrapper -->
|
||||
|
||||
<script>
|
||||
<!-- script for table , It works under the datatable plugin-->
|
||||
<div class="col-md-12" style="padding-bottom: 10px;">
|
||||
<div class="col-md-4">
|
||||
<label>Invoice Number </label>
|
||||
<?php
|
||||
$data = array('name' => 'InvoiceNO', 'value' => set_value('InvoiceNO'), 'id' => 'Invoice_No', 'class' => 'form-control', 'required=>"true"', 'readonly' => 'true');
|
||||
|
||||
$(function () {
|
||||
$.fn.dataTable.moment( 'DD-MM-YYYY' );
|
||||
$('#Inwardgateregistertable').DataTable({
|
||||
"paging": true,
|
||||
"lengthChange": true,
|
||||
"searching": true,
|
||||
"ordering": true,
|
||||
//"columnDefs" : [{"targets":5, "type":"date-eu"}],
|
||||
// "aaSorting": [[ 4, "desc" ]],
|
||||
"info": true,
|
||||
"autoWidth": true
|
||||
|
||||
});
|
||||
});
|
||||
</script><!--
|
||||
<script src="https://cdn.datatables.net/plug-ins/1.10.11/sorting/date-eu.js"></script> -->
|
||||
<script src="https://cdn.datatables.net/plug-ins/1.10.16/sorting/datetime-moment.js"></script>
|
||||
echo form_input($data);
|
||||
?>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label>Invoice Date </label>
|
||||
<?php
|
||||
$data = array('name' => 'InvoiceDate', 'value' => set_value('InvoiceDate'), 'id' => 'Invoice_Date', 'class' => 'form-control', 'required=>"true"');
|
||||
echo form_input($data);
|
||||
?>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label>Material Received Date </label>
|
||||
<?php
|
||||
$data = array('name' => 'MaterialRcvdDate', 'value' => set_value('MaterialRcvdDate'), 'id' => 'MaterialRcvdDate', 'class' => 'form-control');
|
||||
echo form_input($data);
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12" style="padding-bottom: 10px;">
|
||||
<div class="col-md-4">
|
||||
<label>Vehicle Number</label>
|
||||
<?php
|
||||
$data = array('name' => 'VehicleNo', 'value' => set_value('VehicleNo'), 'id' => 'Vehicle_No', 'class' => 'form-control', 'required=>"true"', 'readonly' => 'true');
|
||||
echo form_input($data);
|
||||
?>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label>Driver Name </label>
|
||||
<?php
|
||||
$data = array('name' => 'DriverName', 'value' => set_value('DriverName'), 'id' => 'Driver_Name', 'class' => 'form-control', 'required=>"true"', 'readonly' => 'true');
|
||||
|
||||
echo form_input($data);
|
||||
?>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label>Driver Mobile Number </label>
|
||||
<?php
|
||||
$data = array('name' => 'DriverMobileNumber', 'value' => set_value('DriverMobileNumber'), 'id' => 'DriverMobileNumber', 'class' => 'form-control', 'readonly' => 'true');
|
||||
echo form_input($data);
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Table to show the line item of po -->
|
||||
<div id="content"> </div>
|
||||
<table id="Inwardgateregistertable1" class="table table-bordered table-hover" style="background-color:#fff;font-size:12px;">
|
||||
<thead style="background-color: #ddd !important;">
|
||||
<tr>
|
||||
<th>SNo</th>
|
||||
<th>Item Code</th>
|
||||
<th>Item Description</th>
|
||||
<th>UOM</th>
|
||||
<th>Ordred Quantity</th>
|
||||
<th>Received Quantity</th>
|
||||
<th id="pendingQuantityHeader" style="display:none;">Balance Quantity</th>
|
||||
<th>Remarks</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="tbleAppend1"></tbody>
|
||||
</table>
|
||||
<div class="container">
|
||||
<div class="form-group row">
|
||||
<label for="GrossWeight" class="col-md-2 col-form-label">Gross Weight</label>
|
||||
<div class="col-md-3">
|
||||
<?php
|
||||
$data = array('name' => 'GrossWeight', 'value' => set_value('GrossWeight'), 'id' => 'GrossWeight', 'class' => 'form-control', 'onkeypress' => 'return isNumberKey(event);', 'maxlength' => '50', 'onchange' => 'WeightDiffer(this);');
|
||||
echo form_input($data);
|
||||
?>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<?php
|
||||
$data = array('name' => 'GrossWeightDate', 'value' => set_value('GrossWeightDate'), 'id' => 'GrossWeightDate', 'class' => 'form-control', 'readonly' => true);
|
||||
echo form_input($data);
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="TareWeight" class="col-md-2 col-form-label">Tare Weight</label>
|
||||
<div class="col-md-3">
|
||||
<?php
|
||||
$data = array('name' => 'TareWeight', 'value' => set_value('TareWeight'), 'id' => 'TareWeight', 'class' => 'form-control', 'onkeypress' => 'return isNumberKey(event);', 'maxlength' => '50', 'onchange' => 'WeightDiffer(this);');
|
||||
echo form_input($data);
|
||||
?>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<?php
|
||||
$data = array('name' => 'TareWeightDate', 'value' => set_value('TareWeightDate'), 'id' => 'TareWeightDate', 'class' => 'form-control', 'readonly' => true);
|
||||
echo form_input($data);
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="NetWeight" class="col-md-2 col-form-label">Net Weight</label>
|
||||
<div class="col-md-3">
|
||||
<?php
|
||||
$data = array('name' => 'NetWeight', 'value' => set_value('NetWeight'), 'id' => 'NetWeight', 'class' => 'form-control', 'maxlength' => '50', 'readonly' => true);
|
||||
echo form_input($data);
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<!-- <a class="btn btn-success" id="update" value="Update">Update</a>
|
||||
<a class="btn btn-success" data-dismiss="modal" value="Cancel">Cancel</a> -->
|
||||
<a class="btn btn-success" id="draftIGR" onclick="setStatusAndSubmit('draft')">Draft IGR</a>
|
||||
<a class="btn btn-success" id="generateIGR" onclick="setStatusAndSubmit('generate')">Generate IGR</a>
|
||||
<a class="btn btn-success" data-dismiss="modal" value="Close">Close IGR</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div><!-- modal-dialog -->
|
||||
</div> <!-- modal -->
|
||||
</section><!-- content-->
|
||||
</div><!-- content-wrapper -->
|
||||
|
||||
<script>
|
||||
$("#Igrshow").on("shown.bs.modal", function(e) {
|
||||
var igr = $(e.relatedTarget).data('userid');
|
||||
|
||||
|
||||
$('#content').loader('show');
|
||||
$.ajax({
|
||||
data:{id:igr},
|
||||
type:"POST",
|
||||
$(function(){
|
||||
$.fn.dataTable.moment('DD-MM-YYYY');
|
||||
$('#Inwardgateregistertable').DataTable({
|
||||
"paging":true,
|
||||
"lengthChange":true,
|
||||
"searching":true,
|
||||
"ordering":true,
|
||||
//"columnDefs":[{ "targets": 5,"type": "date-eu"}],
|
||||
"aaSorting":[[4,"desc"]],
|
||||
"info":true,
|
||||
"autoWidth":true
|
||||
});
|
||||
});
|
||||
</script><!-- <script src="https://cdn.datatables.net/plug-ins/1.10.11/sorting/date-eu.js"></script> -->
|
||||
<script src="https://cdn.datatables.net/plug-ins/1.10.16/sorting/datetime-moment.js"></script>
|
||||
<script>
|
||||
$("#Igrshow").on("shown.bs.modal", function(e) {
|
||||
var igr = $(e.relatedTarget).data('userid');
|
||||
var igrstatus = $(e.relatedTarget).data('igrstatus');
|
||||
// alert(igrstatus);
|
||||
var buttonContainer = $("#buttonContainer");
|
||||
var modal = $(this); // Reference to the modal itself
|
||||
var invoiceDateInput = modal.find('#Invoice_Date');
|
||||
var MaterialRcvdDateInput = modal.find('#MaterialRcvdDate');
|
||||
var VehicleNoInput = modal.find('#Vehicle_No');
|
||||
var DriverInput = modal.find('#Driver_Name');
|
||||
var DriverMobileNumberInput = modal.find('#DriverMobileNumber');
|
||||
var GrossWeightInput = modal.find('#GrossWeight');
|
||||
var TareWeightInput = modal.find('#TareWeight');
|
||||
|
||||
|
||||
if (igrstatus == "ST074") {
|
||||
// Show buttons in the container
|
||||
buttonContainer.find("#draftIGR, #generateIGR").css("display", "inline-block");
|
||||
// Changed into Readonly = false
|
||||
invoiceDateInput.prop('readonly', false);
|
||||
MaterialRcvdDateInput.prop('readonly', false);
|
||||
VehicleNoInput.prop('readonly', false);
|
||||
DriverInput.prop('readonly', false);
|
||||
DriverMobileNumberInput.prop('readonly', false);
|
||||
GrossWeightInput.prop('readonly', false);
|
||||
TareWeightInput.prop('readonly', false);
|
||||
} else {
|
||||
// Hide buttons in the container
|
||||
buttonContainer.find("#draftIGR, #generateIGR").css("display", "none");
|
||||
// Changed into Readonly = true
|
||||
invoiceDateInput.prop('readonly', true);
|
||||
MaterialRcvdDateInput.prop('readonly', true);
|
||||
VehicleNoInput.prop('readonly', true);
|
||||
DriverInput.prop('readonly', true);
|
||||
DriverMobileNumberInput.prop('readonly', true);
|
||||
GrossWeightInput.prop('readonly', true);
|
||||
TareWeightInput.prop('readonly', true);
|
||||
}
|
||||
|
||||
$("#tbleAppend1").empty();
|
||||
$('#content').loader('show');
|
||||
$.ajax({
|
||||
data: {
|
||||
id: igr
|
||||
},
|
||||
type: "POST",
|
||||
//dataType: 'json',
|
||||
url:"<?php echo base_url() ?>inwardgateregister/ViewIGR",
|
||||
success:function(data) {
|
||||
// success:function(data) {
|
||||
url: "<?php echo base_url() ?>inwardgateregister/ViewIGR",
|
||||
success: function(data) {
|
||||
console.log(data);
|
||||
console.log('d');
|
||||
$('#content').loader('hide');
|
||||
var trHTML = '';
|
||||
|
||||
$.each(JSON.parse(data), function (i, item) {
|
||||
if(igr == item.IGRNO)
|
||||
{
|
||||
|
||||
$("#IGRNO1").val(item.IGRNO);
|
||||
var baseUrl = '<?php echo base_url(); ?>purchaseorder/CreatePOPrint';
|
||||
var newUrl = baseUrl + '?PONO=' + item.PONO + '&ReqType=' + item.POType;
|
||||
$('#printLink').attr('href', newUrl);
|
||||
//alert(item.IGRNO);
|
||||
|
||||
$("#Vehicle_No").val(item.VehicleNo);
|
||||
$("#Driver_Name").val(item.DriverName);
|
||||
$("#DriverMobileNumber").val(item.DriverMobileNumber);
|
||||
$("#IGRStatus").val(item.IGRStatus);
|
||||
$("#PONo").val(item.PONO);
|
||||
$("#Supplier").val(item.SupplierName);
|
||||
$("#Add1").val(item.Address);
|
||||
$("#Invoice_No").val(item.DeliveryChellanOrInvoiceNo);
|
||||
//alert(item.DeliveryChellanDate);
|
||||
var dcd = new Date(item.DeliveryChellanDate);
|
||||
console.log(item.MaterialRcvdDate) ;
|
||||
|
||||
//alert(item.MaterialRcvdDate);
|
||||
//alert(dcd.getDate()+ '.' + (dcd.getMonth() + 1)+ '.' + dcd.getFullYear());
|
||||
|
||||
var dcd2 = (dcd.getDate()+ '-' + (dcd.getMonth() + 1)+ '-' + dcd.getFullYear());
|
||||
//var MR_dt = item.MaterialRcvdDate === null ? ' - ' : new Date(item.MaterialRcvdDate).toDateString("d-m-Y");
|
||||
if(item.MaterialRcvdDate === null) {
|
||||
var Mat_rcv_date = ' '; }
|
||||
else {
|
||||
var MR_dt = new Date(item.MaterialRcvdDate);
|
||||
var Mat_rcv_date = (MR_dt.getDate()+ '-' + (MR_dt.getMonth() + 1)+ '-' + MR_dt.getFullYear());
|
||||
}
|
||||
$("#MaterialRcvdDate").val(Mat_rcv_date);
|
||||
$("#Invoice_Date").val(dcd2);
|
||||
$("#ser").val(item.ServiceDescription);
|
||||
|
||||
|
||||
i=i+1;
|
||||
trHTML += '<tr>' +
|
||||
'<td align="right">' + i + '</td>' +
|
||||
'<td name="MaterialName" id="MaterialCode" onchange="test('+i+')">' + item.MaterialCode + '</td>' +
|
||||
'<td>' + item.MaterialName + '</td>' +
|
||||
'<td name="UOM">' + item.UOM + '</td>' +
|
||||
'<td align="right" name="Quantity">' + item.Quantity + '</td>' +
|
||||
'<td align="right" data-name="sel" >'+item.QuantityAsPerInvoice+'</td>' +
|
||||
'<td>'+ item.Remarks+ '</td>' +
|
||||
'</tr>';
|
||||
//alert(item.QuantityAsPerInvoice);
|
||||
}
|
||||
|
||||
});
|
||||
$("#tbleAppend1").empty();
|
||||
$('#Inwardgateregistertable1 > tbody').append(trHTML);
|
||||
}
|
||||
});
|
||||
});
|
||||
$('#update').click(function(){
|
||||
//alert('updated function entered');
|
||||
$('#content').loader('show');
|
||||
var igrno = $("#IGRNO1").val();
|
||||
var materialrcv_date = $("#MaterialRcvdDate").val();
|
||||
var inv_date = $("#Invoice_Date").val();
|
||||
$.each(JSON.parse(data), function(i, item) {
|
||||
if (igr == item.IGRNO) {
|
||||
|
||||
$.ajax({
|
||||
data:{igr:igrno,mrc:materialrcv_date,invdate:inv_date},
|
||||
type:"POST",
|
||||
url:"<?php echo base_url() ?>inwardgateregister/UpdateIGR",
|
||||
success:function(data) {
|
||||
$('#content').loader('hide');
|
||||
alert(data);
|
||||
$("#IGRNO1").val(item.IGRNO);
|
||||
$("#IGRItemNo").val(item.IGRItemNo);
|
||||
var baseUrl = '<?php echo base_url(); ?>purchaseorder/CreatePOPrint';
|
||||
var newUrl = baseUrl + '?PONO=' + item.PONO + '&ReqType=' + item.POType;
|
||||
$('#printLink').attr('href', newUrl);
|
||||
$("#Vehicle_No").val(item.VehicleNo);
|
||||
$("#Driver_Name").val(item.DriverName);
|
||||
$("#DriverMobileNumber").val(item.DriverMobileNumber);
|
||||
$("#IGRStatus").val(item.IGRStatus);
|
||||
$("#PONo").val(item.PONO);
|
||||
$("#Supplier").val(item.SupplierName);
|
||||
$("#Add1").val(item.Address);
|
||||
$("#Invoice_No").val(item.DeliveryChellanOrInvoiceNo);
|
||||
//alert(item.DeliveryChellanDate);
|
||||
var dcd = new Date(item.DeliveryChellanDate);
|
||||
//alert(dcd.getDate()+ '.' + (dcd.getMonth() + 1)+ '.' + dcd.getFullYear());
|
||||
var dcd2 = (dcd.getDate() + '/' + (dcd.getMonth() + 1) + '/' + dcd.getFullYear());
|
||||
$("#Invoice_Date").val(dcd2);
|
||||
if (item.MaterialRcvdDate === null) {
|
||||
var Mat_rcv_date = ' ';
|
||||
} else {
|
||||
var MR_dt = new Date(item.MaterialRcvdDate);
|
||||
var Mat_rcv_date = (MR_dt.getDate() + '/' + (MR_dt.getMonth() + 1) + '/' + MR_dt.getFullYear());
|
||||
}
|
||||
$("#MaterialRcvdDate").val(Mat_rcv_date);
|
||||
if (item.GrossWeightDate === null) {
|
||||
var gross_rcv_date = ' ';
|
||||
} else {
|
||||
var G_dt = new Date(item.GrossWeightDate);
|
||||
var gross_rcv_date = formatDateTime(G_dt);
|
||||
}
|
||||
$("#GrossWeight").val(parseFloat(item.GrossWeight));
|
||||
$("#GrossWeightDate").val(gross_rcv_date);
|
||||
if (item.TareWeightDate === null) {
|
||||
var tare_rcv_date = ' ';
|
||||
} else {
|
||||
var T_dt = new Date(item.TareWeightDate);
|
||||
var tare_rcv_date = formatDateTime(T_dt);
|
||||
}
|
||||
$("#TareWeight").val(parseFloat(item.TareWeight));
|
||||
$("#TareWeightDate").val(tare_rcv_date);
|
||||
$("#NetWeight").val(parseFloat(item.NetWeight));
|
||||
$("#ser").val(item.ServiceDescription);
|
||||
i = i + 1;
|
||||
if (igrstatus == "ST074") {
|
||||
// document.getElementById('pendingQuantityHeader').style.display = 'table-cell';
|
||||
$("#pendingQuantityHeader").css("display", "table-cell");
|
||||
|
||||
trHTML += '<tr>' +
|
||||
'<td align="right">' + i + '</td>' +
|
||||
'<td name="MaterialName" onchange="test(' + i + ')">' + item.MaterialCode + '</td>' +
|
||||
'<td>' + item.MaterialName + '</td>' +
|
||||
'<td name="UOM">' + item.UOM + '</td>' +
|
||||
'<td align="right" id="Quantity' + i + '" name="Quantity">' + parseInt(item.Quantity) + '</td>' +
|
||||
'<td align="right" data-name="sel" ><input type="text" onchange="validateReceivedQuantity(' + i + ')"id="QuantityAsPerInvoice' + i + '" name="QuantityAsPerInvoice' + i + '" value="' + parseInt(item.QuantityAsPerInvoice) + '" onkeypress="return isNumberKey(event);"></td>' +
|
||||
'<td name="PendingQuantity' + i + '" id="PendingQuantity' + i + '">' + parseInt(item.Quantity - item.QuantityAsPerInvoice) + '</td>' +
|
||||
'<td><input type="text" id="Remark' + i + '" name="Remark' + i + '" class="form" onchange="SetRemarks(' + i + ')"> </td>' +
|
||||
|
||||
'<input type="hidden" id="IGRNO' + i + '" name="IGRNO' + i + '" value="' + item.IGRNO + '">' +
|
||||
'<input type="hidden" id="IGRItemNo' + i + '" name="IGRItemNo' + i + '" value="' + item.IGRItemNo + '">' +
|
||||
'<input type="hidden" id="MaterialCode' + i + '" name="MaterialCode' + i + '" value="' + item.MaterialCode + '">' +
|
||||
'<input type="hidden" id="txtQuantityAsPerInvoice' + i + '" name="txtQuantityAsPerInvoice' + i + '" value="' + item.QuantityAsPerInvoice + '">' +
|
||||
'<input type="hidden" id="txtOrderedQuantity' + i + '" name="txtOrderedQuantity' + i + '" value="' + item.Quantity + '">' +
|
||||
'<input type="hidden" id="txtRemarks' + i + '" name="txtRemarks' + i + '">'; // Example with no initial value
|
||||
'</tr>';
|
||||
|
||||
//alert(item.PendingQty);
|
||||
if ((item.Quantity - item.QuantityAsPerInvoice) == 0.00) {
|
||||
$('#QuantityAsPerInvoice' + i).attr('readonly', 'true');
|
||||
}
|
||||
} else {
|
||||
$("#pendingQuantityHeader").css("display", "none");
|
||||
|
||||
trHTML += '<tr>' +
|
||||
'<td align="right">' + i + '</td>' +
|
||||
'<td name="MaterialName" id="MaterialCode" onchange="test(' + i + ')">' + item.MaterialCode + '</td>' +
|
||||
'<td>' + item.MaterialName + '</td>' +
|
||||
'<td name="UOM">' + item.UOM + '</td>' +
|
||||
'<td align="right" name="Quantity">' + item.Quantity + '</td>' +
|
||||
'<td align="right" data-name="sel" >' + item.QuantityAsPerInvoice + '</td>' +
|
||||
'<td>' + item.Remarks + '</td>' +
|
||||
'</tr>';
|
||||
}
|
||||
|
||||
//alert(item.QuantityAsPerInvoice);
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
$("#tbleAppend1").empty();
|
||||
$('#Inwardgateregistertable1 > tbody').append(trHTML);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
|
||||
$('#update').click(function() {
|
||||
alert('updated function entered');
|
||||
$('#content').loader('show');
|
||||
var igrno = $("#IGRNO1").val();
|
||||
var materialrcv_date = $("#MaterialRcvdDate").val();
|
||||
var inv_date = $("#Invoice_Date").val();
|
||||
|
||||
$.ajax({
|
||||
data:{igr:igrno,mrc:materialrcv_date,invdate:inv_date},
|
||||
type:"POST",
|
||||
url:"<?php echo base_url() ?>inwardgateregister/UpdateIGR",
|
||||
success:function(data) {
|
||||
$('#content').loader('hide');
|
||||
alert(data);
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
function setStatusAndSubmit(status) {
|
||||
var statuscode = (status == "draft") ? 'ST074' : 'ST027';
|
||||
alert('updated function entered');
|
||||
$('#content').loader('show');
|
||||
var igrno = $("#IGRNO1").val();
|
||||
var VehicleNo = $("#Vehicle_No").val();
|
||||
var DriverName = $("#Driver_Name").val();
|
||||
var DriverMobileNumber = $("#DriverMobileNumber").val();
|
||||
var GrossWeight = $("#GrossWeight").val()
|
||||
var TareWeight = $("#TareWeight").val()
|
||||
var NetWeight = $("#NetWeight").val()
|
||||
var GrossWeightDate = $("#GrossWeightDate").val()
|
||||
var TareWeightDate = $("#TareWeightDate").val()
|
||||
|
||||
var dataToSend = [];
|
||||
|
||||
$('#tbleAppend1 tr').each(function(index, row) {
|
||||
var rowData = {};
|
||||
|
||||
$(row).find('input[type="hidden"]').each(function() {
|
||||
var fieldName = $(this).attr('name');
|
||||
var fieldValue = $(this).val();
|
||||
rowData[fieldName] = fieldValue;
|
||||
});
|
||||
|
||||
dataToSend.push(rowData);
|
||||
});
|
||||
console.log(dataToSend);
|
||||
$.ajax({
|
||||
url: "<?php echo base_url() ?>inwardgateregister/updateIGRLineItem",
|
||||
type: "POST",
|
||||
dataType: 'json',
|
||||
data: {
|
||||
IGRNO: igrno,
|
||||
IGRStatus: statuscode,
|
||||
VehicleNo: VehicleNo,
|
||||
DriverName: DriverName,
|
||||
DriverMobileNumber: DriverMobileNumber,
|
||||
GrossWeight: GrossWeight,
|
||||
TareWeight: TareWeight,
|
||||
NetWeight: NetWeight,
|
||||
GrossWeightDate: GrossWeightDate,
|
||||
TareWeightDate: TareWeightDate,
|
||||
data: JSON.stringify(dataToSend)
|
||||
},
|
||||
success: function(response) {
|
||||
$('#content').loader('hide');
|
||||
console.log('Data saved successfully:', response);
|
||||
alert(response.message);
|
||||
// Close the modal
|
||||
$('#Igrshow').modal('hide');
|
||||
// location.reload();
|
||||
setTimeout(function() {
|
||||
location.reload();
|
||||
}, 500);
|
||||
},
|
||||
error: function(jqXHR, textStatus, errorThrown) {
|
||||
$('#content').loader('hide');
|
||||
console.error('Error saving data:', textStatus, errorThrown);
|
||||
alert(response.message);
|
||||
$('#Igrshow').modal('hide');
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
function WeightDiffer(element) {
|
||||
// console.log(element);
|
||||
var v1 = $("#GrossWeight").val();
|
||||
var v2 = $("#TareWeight").val();
|
||||
var v3 = v1 - v2;
|
||||
$("#NetWeight").val(v3);
|
||||
if (element.id === 'GrossWeight') {
|
||||
$("#GrossWeightDate").val($("#clock").text());
|
||||
}
|
||||
|
||||
if (element.id === 'TareWeight') {
|
||||
$("#TareWeightDate").val($("#clock").text());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function updateTime() {
|
||||
const now = new Date();
|
||||
const year = now.getFullYear();
|
||||
const month = (now.getMonth() + 1).toString().padStart(2, '0');
|
||||
const todaydate = now.getDate().toString().padStart(2, '0');
|
||||
const hours = now.getHours().toString().padStart(2, '0');
|
||||
const minutes = now.getMinutes().toString().padStart(2, '0');
|
||||
const seconds = now.getSeconds().toString().padStart(2, '0');
|
||||
const dateString = todaydate + '-' + month + '-' + year;
|
||||
const timeString = hours + ":" + minutes + ":" + seconds;
|
||||
document.getElementById('clock').textContent = dateString + " " + timeString;
|
||||
}
|
||||
|
||||
setInterval(updateTime, 1000); // Update every second
|
||||
updateTime(); // Initial call to display time immediately
|
||||
</script>
|
||||
<script>
|
||||
function formatDateTime(dateString) {
|
||||
// Check if the date string is null
|
||||
if (dateString === null) {
|
||||
return ' ';
|
||||
} else {
|
||||
// Create a new Date object from the date string
|
||||
var date = new Date(dateString);
|
||||
|
||||
// Extract date components
|
||||
var day = date.getDate().toString().padStart(2, '0');
|
||||
var month = (date.getMonth() + 1).toString().padStart(2, '0'); // Months are zero-based
|
||||
var year = date.getFullYear();
|
||||
|
||||
// Extract time components
|
||||
var hours = date.getHours().toString().padStart(2, '0');
|
||||
var minutes = date.getMinutes().toString().padStart(2, '0');
|
||||
var seconds = date.getSeconds().toString().padStart(2, '0');
|
||||
|
||||
// Format the date and time in DD-MM-YYYY HH:MM:SS format
|
||||
var formattedDate = `${day}-${month}-${year} ${hours}:${minutes}:${seconds}`;
|
||||
|
||||
return formattedDate;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Loading…
Reference in New Issue
Block a user