10994015 1 year ago
parent
commit
949b37e330
  1. 22
      wms/contract/api/getComboNo.php
  2. 60
      wms/contract/api/postContractData.php

22
wms/contract/api/getComboNo.php

@ -1,19 +1,28 @@
<?php
class CreateComboNo{
<<<<<<< HEAD
private $comboarr = [
=======
public $comboarr = [
>>>>>>> f6b04618 (1106)
'week'=>'BW002',
'month'=>'EM002',
'quarter'=>'EQ002',
'half'=>'HY002',
'year'=>'EY002'
];
<<<<<<< HEAD
private $bwarr = [
=======
public $bwarr = [
>>>>>>> f6b04618 (1106)
'week','month','week','month','week','quarter',
'week','month','week','month','week','half',
'week','month','week','month','week','quarter',
'week','month','week','month','week','year'
];
<<<<<<< HEAD
private $emarr = [
'month','month','quarter','month','month','half',
'month','month','quarter','month','month','year'
@ -55,5 +64,18 @@ class CreateComboNo{
}
}
return json_encode($newarr);
=======
public $emarr = [
'month','month','quarter','month','month','half',
'month','month','quarter','month','month','year'
];
public $combo;
public $startdate;
public $enddate;
public function __construct($combo, $startdate, $enddate){
}
public function getComboNo(){
>>>>>>> f6b04618 (1106)
}
}

60
wms/contract/api/postContractData.php

@ -5,7 +5,11 @@ include_once("./getComboNo.php");
ini_set ( 'date.timezone' , 'Asia/Taipei' );
if(isset($_POST["contractno"]) && $_POST["contractno"] != "") {
try{
<<<<<<< HEAD
$created_at = date('Y-m-d H:i:s');
=======
>>>>>>> f6b04618 (1106)
$contractno = !empty($_POST['contractno'])? $_POST['contractno'] : null;
$total_price = !empty($_POST['total_price']) ? $_POST['total_price'] : null;
$vat = !empty($_POST['vat']) ? $_POST['vat'] : null;
@ -39,6 +43,7 @@ if(isset($_POST["contractno"]) && $_POST["contractno"] != "") {
$latitude = !empty($_POST['latitude']) ? $_POST['latitude'] : null;
$longitude = !empty($_POST['longitude']) ? $_POST['longitude'] : null;
$num = !empty($_POST['num']) ? $_POST['num'] : null;
<<<<<<< HEAD
$files = !empty($_FILES['files']) ? $_FILES['files'] : null;
// validate
@ -81,6 +86,11 @@ if(isset($_POST["contractno"]) && $_POST["contractno"] != "") {
exit();
}
=======
$files = !empty($_FILES['files']) ? $_FILES['files'] : null;
>>>>>>> f6b04618 (1106)
//create account table
$accounttype = "A";
$accountid = $vat;
@ -168,6 +178,56 @@ if(isset($_POST["contractno"]) && $_POST["contractno"] != "") {
$maintainance = "E";
$repairerid = $mworker;
$repairername = $worker['name'];
<<<<<<< HEAD
=======
foreach($facilityno as $fno){
$sql_str = "INSERT INTO facility (contractno, define, facilityno, latitude, longitude, customerid, weight, numberofpassenger, numberofstop, numberoffloor, opentype, speed, repairtype, maintainance, facility_kind, address, repairerid, repairername, creater, create_at, area, takecertificatedate, licensedate)
VALUES (:contractno, :define, :facilityno, :latitude, :longitude, :customerid, :weight, :numberofpassenger, :numberofstop, :numberoffloor, :opentype, :speed, :repairtype, :maintainance, :facility_kind, :address, :repairerid, :repairername, :creater, :create_at, :area, :takecertificatedate, :licensedate)";
$stmt = $conn -> prepare($sql_str);
$stmt -> bindParam(':contractno' ,$contractno);
$stmt -> bindParam(':define' ,$define);
$stmt -> bindParam(':facilityno' ,$fno);
$stmt -> bindParam(':latitude' ,$latitude);
$stmt -> bindParam(':longitude' ,$longitude);
$stmt -> bindParam(':customerid' ,$customerid);
$stmt -> bindParam(':weight' ,$weight);
$stmt -> bindParam(':numberofpassenger' ,$numberofpassenger);
$stmt -> bindParam(':numberofstop' ,$numberofstop);
$stmt -> bindParam(':numberoffloor' ,$numberoffloor);
$stmt -> bindParam(':opentype' ,$opentype);
$stmt -> bindParam(':speed' ,$speed);
$stmt -> bindParam(':repairtype' ,$repairtype);
$stmt -> bindParam(':maintainance' ,$maintainance);
$stmt -> bindParam(':facility_kind' ,$facility_kind);
$stmt -> bindParam(':address' ,$address);
$stmt -> bindParam(':repairerid' ,$repairerid);
$stmt -> bindParam(':repairername' ,$repairername);
$stmt -> bindParam(':creater' ,$creater);
$stmt -> bindParam(':create_at' ,$create_at);
$stmt -> bindParam(':area' ,$area);
$stmt -> bindParam(':takecertificatedate' ,$takecertificatedate);
$stmt -> bindParam(':licensedate' ,$licensedate);
$result = $stmt -> execute();
}
//create schedule table
$comboMo = new CreateComboNo();
$sql_str = 'INSERT INTO schedule (contractno, facilityno, combono, repairerid, repairername, duedate, creater, create_at) VALUES (:contractno, :facilityno, :combono, :repairerid, :repairername, :duedate, :creater, :create_at)';
$stmt = $conn -> prepare($sql_str);
$stmt -> bindParam(':contractno' ,$contractno);
$stmt -> bindParam(':facilityno' ,$facilityno);
$stmt -> bindParam(':combono' ,$combono);
$stmt -> bindParam(':repairerid' ,$repairerid);
$stmt -> bindParam(':repairername' ,$repairername);
$stmt -> bindParam(':duedate' ,$duedate);
$stmt -> bindParam(':creater' ,$creater);
$stmt -> bindParam(':create_at' ,$create_at);
$result = $stmt -> execute();
>>>>>>> f6b04618 (1106)
foreach($facilityno as $fno){

Loading…
Cancel
Save