Initial import
This commit is contained in:
115
application/controllers/tools/Check_verify.php
Normal file
115
application/controllers/tools/Check_verify.php
Normal file
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
class Check_verify extends MY_Controller
|
||||
{
|
||||
var $db_onedev;
|
||||
public function index()
|
||||
{
|
||||
echo "Cek Verify ";
|
||||
}
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->db_onedev = $this->load->database("onedev", true);
|
||||
}
|
||||
|
||||
function fo_verify($orderID,$userID) {
|
||||
$sql="INSERT INTO fo_verificationsvalue (
|
||||
Fo_VerificationsValueT_OrderHeaderID,
|
||||
Fo_VerificationsValueFo_VerificationsLabelID,
|
||||
Fo_VerificationsValueCheck,
|
||||
Fo_VerificationsValueNote,
|
||||
Fo_VerificationsValueUserID,
|
||||
Fo_VerificationsValueCreated )
|
||||
SELECT {$orderID},
|
||||
Fo_VerificationsLabelID,
|
||||
'Y',
|
||||
'', {$userID},
|
||||
NOW()
|
||||
FROM fo_verificationslabel
|
||||
WHERE
|
||||
Fo_VerificationsLabelIsActive = 'Y' ";
|
||||
$this->db_onedev->query($sql);
|
||||
|
||||
$sql = "call sp_fo_barcode_generate({$orderID})";
|
||||
$this->db_onedev->query($sql);
|
||||
|
||||
$fostatusid = 3;
|
||||
$fologcode = 'FO.VERIFICATION.CONFIRM';
|
||||
|
||||
$sql = "insert into fo_status(
|
||||
Fo_StatusDate,
|
||||
Fo_StatusT_OrderHeaderID,
|
||||
Fo_StatusM_StatusID,
|
||||
Fo_StatusM_UserID,
|
||||
Fo_StatusCreated,
|
||||
Fo_StatusUpdated)
|
||||
values( now(), ?, ?, ?, now(),now())";
|
||||
|
||||
$query = $this->db_onedev->query($sql,
|
||||
array(
|
||||
$orderID,
|
||||
$fostatusid, $userID
|
||||
)
|
||||
);
|
||||
|
||||
if (!$query) {
|
||||
return "Error Fo Status";
|
||||
}
|
||||
|
||||
$sql = "SELECT * FROM fo_verificationsvalue WHERE Fo_VerificationsValueT_OrderHeaderID = {$orderID}";
|
||||
|
||||
$data_log = array();
|
||||
$data_log['orderid'] = $orderID;
|
||||
$data_log['values'] = $this->db_onedev->query($sql)->result_array();
|
||||
$data_log['note'] = '';
|
||||
|
||||
$json_dt_log = json_encode($data_log);
|
||||
$sql = "insert into one_log.log_fo(
|
||||
Log_FoDate,
|
||||
Log_FoCode,
|
||||
Log_FoJson,
|
||||
Log_FoUserID)
|
||||
values( now(), ?, ?, ?)";
|
||||
$query = $this->db_onedev->query($sql,
|
||||
array(
|
||||
$fologcode,
|
||||
$json_dt_log,
|
||||
$userID
|
||||
)
|
||||
);
|
||||
|
||||
if (!$query) {
|
||||
return "Error Fo Log";
|
||||
}
|
||||
|
||||
/* T_OrderSample */
|
||||
$adminUserID = $userID;
|
||||
$sql = "update t_ordersample
|
||||
set T_OrderSampleSampling='Y', T_OrderSampleSamplingDate = now(),
|
||||
T_OrderSampleSamplingTime = now(),T_OrderSampleSamplingUserID = $adminUserID,
|
||||
T_OrderSampleReceive='Y', T_OrderSampleReceiveDate = now() , T_OrderSampleReceiveTime = now(),
|
||||
T_OrderSampleReceiveUserID = $adminUserID,
|
||||
T_OrderSampleVerification='Y', T_OrderSampleVerificationDate=now(), T_OrderSampleVerificationTime=now(),
|
||||
T_OrderSampleVerificationUserID = $adminUserID,
|
||||
T_OrderSampleSendHandling = 'Y', T_OrderSampleSendHandlingDate =now(), T_OrderSampleSendHandlingTime=now(),
|
||||
T_OrderSampleSendHandlingUserID = $adminUserID,
|
||||
T_OrderSampleReceiveHandling = 'Y', T_OrderSampleReceiveHandlingDate=now(), T_OrderSampleReceiveHandlingTime=now(),
|
||||
T_OrderSampleReceiveHandlingUserID=$adminUserID,
|
||||
T_OrderSampleHandling='Y', T_OrderSampleHandlingDate=now(), T_OrderSampleHandlingTime=now(),
|
||||
T_OrderSampleHandlingUserID=$adminUserID,
|
||||
T_OrderSampleProcessing='Y', T_OrderSampleReadyToProcessDateTime=now(), T_OrderSampleProcessingDate=now(),
|
||||
T_OrderSampleProcessingTime=now(), T_OrderSampleProcessingUserID=$adminUserID,
|
||||
T_OrderSampleUserID=$adminUserID
|
||||
where T_OrderSampleT_OrderHeaderID = ?";
|
||||
|
||||
|
||||
$qry = $this->db_onedev->query($sql, array($orderID) );
|
||||
if (!$qry) {
|
||||
return "Error T_OrderSample : " . $this->db_onedev->last_query();
|
||||
}
|
||||
return "OK";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user