Browse Source

Merge branch 'main' into gary

gary
gary_chen\gary_chen 1 year ago
parent
commit
d27e98d1f4
  1. 9
      wms/T8_APItest.php
  2. 8
      wms/T8_Authorization.php
  3. 136
      wms/account-receivable-index.php
  4. 4
      wms/mkt/pricereview-create.php
  5. 2
      wms/mkt/pricereview_renovate-create.php
  6. 2
      wms/mkt/pricereview_repair-index.php
  7. 48
      wms/rib02-purReceive-submit.php

9
wms/T8_APItest.php

@ -6,12 +6,13 @@ echo "ii";
get_Auth();
window.addEventListener('message', function(event) {
if (event.origin === "http://localhost:3000" && (typeof event.data === "string")) {
// if (event.origin === "https://masada.com.tw" && (typeof event.data === "string")) {
var validation = event.data;
console.log("event");
console.log(validation);
// var corsurl = 'http://cors-anywhere.herokuapp.com/';
var apiurl = 'http://60.244.87.101:880/twWebAPI/V1/APCHECKBILL/PostERPData';
var apiurl = 'https://erp.masada.com.tw:780/twWebAPI/V1/SALDISPATCHLIST/GetERPData?pkValue=SS20230825001';
headerParam = {
CHI_Authorization: `${validation}`,
};
@ -71,13 +72,13 @@ echo "ii";
];
var json = JSON.stringify(body);
obj = {
type: 'POST',
type: 'GET',
// url: `${corsurl}${apiurl}`,
url: `${apiurl}`,
// dataType: 'json',
headers: headerParam,
data: json,
dataType: "json",
// data: json,
// dataType: "json",
success: function(res) {
console.log(res.Status);
console.log(res.ErrorMsg);

8
wms/T8_Authorization.php

@ -2,16 +2,17 @@
<?php
$now = gmdate("YmdHis");
$data = 'M0000.' . $now;
$sign = hash_hmac('SHA256', $data, '964C834F7BF2BB70', false);
$sign = hash_hmac('SHA256', $data, 'B2D6395D2883E26C', false);
?>
<script>
function get_Auth() {
var api_key = '964C834F7BF2BB70';
var api_key = 'B2D6395D2883E26C';
var validation = "";
// var corsurl = 'http://cors-anywhere.herokuapp.com/';
var apiurl = 'http://60.244.87.101:880//twWebAPI/GetAuth';
// var apiurl = 'http://60.244.87.101:880//twWebAPI/GetAuth';
var apiurl = 'https://erp.masada.com.tw:780/twWebAPI/GetAuth'
headerParam = {
UserId: 'M0000',
Pwd: 'M012290493119',
@ -26,6 +27,7 @@ $sign = hash_hmac('SHA256', $data, '964C834F7BF2BB70', false);
headers: headerParam,
success: function(res) {
validation = res.Data['CHI_Authorization'];
console.log("validation:",validation);
window.parent.postMessage(validation,'http://localhost:3000');
// window.parent.postMessage(validation,'https://masada.com.tw');
}

136
wms/account-receivable-index.php

@ -0,0 +1,136 @@
<?php
include "header.php";
require_once dirname(__DIR__) . '/common/composer/vendor/autoload.php';
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx as xls;
//use PhpOffice\PhpSpreadsheet\Reader\Xls;
use PhpOffice\PhpSpreadsheet\Reader\Xlsx;
$arrayData = [];
echo "合約號,部門,經理,營業員,客戶名稱,簽約款,二次款,貨抵工地款,安裝款,試車款,交車款,取得許可證約交款,取得許可函後6個月約交款,狀態</br>";
// $T8_array = mysqli_fetch_all($T8_array, MYSQLI_ASSOC);
// $sql_depid = "SELECT department_id, name from department";
// $dept_query = mysqli_query($link, $sql_depid);
// $deptype = mysqli_fetch_all($dept_query, MYSQLI_ASSOC);
$sql_contract = "SELECT a.BillNo, a.PayStage, a.PlanPayAmt,s.BizPartnerId,c.BizPartnerName FROM salOrderStagePay AS a
LEFT JOIN salSalesOrder AS s on a.BillNo = s.BillNo
LEFT JOIN comBusinessPartner as c ON s.BizPartnerId=c.BizPartnerId
WHERE s.ModeId = 'M' AND (s.CurrentState=2 OR s.CurrentState=4) ";
$contract = $conn->query($sql_contract);
foreach ($contract as $cont) {
// print_r($cont);
// echo "<br>";
$BillNo = $cont['BillNo'];
$PayStage = $cont['PayStage'];
$PayAmount = $cont['PlanPayAmt'];
$partnerName = $cont['BizPartnerName'];
if (isset($arrayData[$BillNo])) {
if (stristr($PayStage, '二次款') || stristr($PayStage, '出貨前') || stristr($PayStage, '簽約後') || stristr($PayStage, '簽訂後') || stristr($PayStage, '建照核發時') || stristr($PayStage, '簽約60')) {
$arrayData[$BillNo][5] = $PayAmount;
} elseif ($PayStage == '簽約' || stristr($PayStage, '簽定') || stristr($PayStage, '簽訂') || stristr($PayStage, '訂金')) {
$arrayData[$BillNo][4] = $PayAmount;
} elseif (stristr($PayStage, '貨抵工地') || stristr($PayStage, '貨底工地')) {
$arrayData[$BillNo][6] = $PayAmount;
} elseif (stristr($PayStage, '安裝')) {
$arrayData[$BillNo][7] = $PayAmount;
} elseif (stristr($PayStage, '試車')) {
$arrayData[$BillNo][8] = $PayAmount;
} elseif (stristr($PayStage, '交車') || stristr($PayStage, '完工') || stristr($PayStage, '驗收')) {
$arrayData[$BillNo][9] = $PayAmount;
} elseif (stristr($PayStage, '取得合格函') || stristr($PayStage, '取得許可函')) {
$arrayData[$BillNo][10] = $PayAmount;
} elseif (stristr($PayStage, '得合格函後6個月') || stristr($PayStage, '核可函取得後6個月')) {
$arrayData[$BillNo][11] = $PayAmount;
} else {
$arrayData[$BillNo][12] = $PayAmount;
}
} else {
$arrayData[$BillNo] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
$arrayData[$BillNo][3] = $partnerName;
if (stristr($PayStage, '二次款') || stristr($PayStage, '出貨前') || stristr($PayStage, '簽約後') || stristr($PayStage, '簽訂後') || stristr($PayStage, '建照核發時') || stristr($PayStage, '簽約60')) {
$arrayData[$BillNo][5] = $PayAmount;
} elseif ($PayStage == '簽約' || stristr($PayStage, '簽定') || stristr($PayStage, '簽訂') || stristr($PayStage, '訂金')) {
$arrayData[$BillNo][4] = $PayAmount;
} elseif (stristr($PayStage, '貨抵工地') || stristr($PayStage, '貨底工地')) {
$arrayData[$BillNo][6] = $PayAmount;
} elseif (stristr($PayStage, '安裝')) {
$arrayData[$BillNo][7] = $PayAmount;
} elseif (stristr($PayStage, '試車')) {
$arrayData[$BillNo][8] = $PayAmount;
} elseif (stristr($PayStage, '交車') || stristr($PayStage, '完工') || stristr($PayStage, '驗收')) {
$arrayData[$BillNo][9] = $PayAmount;
} elseif (stristr($PayStage, '取得合格函') || stristr($PayStage, '取得許可函')) {
$arrayData[$BillNo][10] = $PayAmount;
} elseif (stristr($PayStage, '得合格函後6個月') || stristr($PayStage, '核可函取得後6個月')) {
$arrayData[$BillNo][11] = $PayAmount;
} else {
$arrayData[$BillNo][12] = $PayAmount;
}
}
}
foreach ($arrayData as $key => $value) {
$sql = "SELECT
tmp2.*,
d.name AS depart_name
FROM(
SELECT
a.manager,
a2.name as manager_name,
a.name,
a.department_id,
w.salesid,
w.contractno,
w.facilityno,
w.estimated_shipping_date,
w.actual_tofactory_date,
w.real_arrival_date,
w.install_end_date,
w.tryrun_end_date,
w.delivery_date
from wipwholestatus AS w
left join account AS a
ON w.salesid = a.accountid
left join account AS a2
ON a2.accountid = a.manager
where w.status = '1' AND w.contractno='" . $key . "'" . "
)AS tmp2
left join (
SELECT DISTINCT
department_id,
name
FROM department
) AS d
ON d.department_id = tmp2.department_id";
$facitities = "";
$wipwhole_array = mysqli_query($link, $sql);
foreach ($wipwhole_array as $wip) {
$value[0] = $wip['depart_name'];
$value[1] = $wip['manager_name'];
$value[2] = $wip['name'];
if ($wip['delivery_date'] != NULL) {
$facitities .= $wip['facilityno'] . "(" . $wip['delivery_date'] . "已移交);\n";
} elseif ($wip['tryrun_end_date'] != NULL) {
$facitities .= $wip['facilityno'] . "(" . $wip['tryrun_end_date'] . "試車完畢);\n";
} elseif ($wip['install_end_date'] != NULL) {
$facitities .= $wip['facilityno'] . "(" . $wip['install_end_date'] . "安裝完畢);\n";
} elseif ($wip['real_arrival_date'] != NULL) {
$facitities .= $wip['facilityno'] . "(" . $wip['real_arrival_date'] . "貨抵工地);\n";
} elseif ($wip['actual_tofactory_date'] != NULL) {
$facitities .= $wip['facilityno'] . "(" . $wip['actual_tofactory_date'] . "實際到觀音日);\n";
} elseif ($wip['estimated_shipping_date'] != NULL) {
$facitities .= $wip['facilityno'] . "(" . $wip['estimated_shipping_date'] . "預計到港);\n";
} else {
$facitities .= $wip['facilityno'] . "(預計到港日待確認);\n";
}
}
echo $key . "," . $value[0] . "," . $value[1] . "," . $value[2] . "," . $value[3] . "," . $value[4] . "," . $value[5] . "," . $value[6] . "," . $value[7] . "," . $value[8] . "," . $value[9] . "," . $value[10] . "," . $value[11] . "," . $facitities . "<br>";
}

4
wms/mkt/pricereview-create.php

@ -43,8 +43,10 @@ if (count($last_pr_arr) > 0) {
$res = mysqli_query($link, $sql);
while ($row = mysqli_fetch_assoc($res)) {
$last_pritem_arr[$row["item_group"]][$row["item_no"]] = $row;
if (isset($last_pritem_arr["A"][$row["item_no"]])) {
$last_pr_arr["qty_total"] += $last_pritem_arr["A"][$row["item_no"]]["item_qty"];
}
}
mysqli_free_result($res);
$sql ="select * from pricereview_pay where mid = '".$last_pr_arr["id"]."' order by pay_kind";
@ -1673,7 +1675,7 @@ if (count($last_pritem_arr) > 0 && isset($last_pritem_arr["B"])) {
<td><input type="text" name="option_unit_price" class="form-control dollar-right" size="8" value="<?php echo number_format($v["item_unit_price"]); ?>" readonly ></td>
<td><input type="text" name="option_qty" class="form-control" size="2" maxlength="2" value="<?php echo $v["item_qty"]; ?>"></td>
<td><input type="text" name="option_price_bp" class="form-control dollar-right" size="8" value="<?php echo number_format($v["item_price_bp"]); ?>" readonly>
<input type="hidden" name="item_group" value="B"><input type="hidden" name="op_id">
<input type="hidden" name="item_group" value="B"><input type="hidden" name="op_id" value="<?php echo $v["price_id"]; ?>">
</td>
<td><input type="text" name="option_memo" class="form-control" size="20" values="<?php echo $v["memo"]; ?>"></td>
<td name="option_relate_facil"></td>

2
wms/mkt/pricereview_renovate-create.php

@ -44,8 +44,10 @@ if (count($last_pr_arr) > 0) {
$res = mysqli_query($link, $sql);
while ($row = mysqli_fetch_assoc($res)) {
$last_pritem_arr[$row["item_group"]][$row["item_no"]] = $row;
if (isset($last_pritem_arr["A"][$row["item_no"]])) {
$last_pr_arr["qty_total"] += $last_pritem_arr["A"][$row["item_no"]]["item_qty"];
}
}
mysqli_free_result($res);
$sql ="select * from pricereview_pay where mid = '".$last_pr_arr["id"]."' order by pay_kind";

2
wms/mkt/pricereview_repair-index.php

@ -119,7 +119,7 @@ $(function () {
objInput1.setAttribute("type", "text");
objInput1.setAttribute("name", "total_price");
objInput1.setAttribute("readonly", true);
objInput1.setAttribute("value", pobj.find('td').eq(6).html().trim());
objInput1.setAttribute("value", pobj.find('td').eq(5).html().trim());
var objLabel2 = document.createElement("label");
objLabel2.setAttribute("for", "final_price");
objLabel2.textContent = "議價後金額";

48
wms/rib02-purReceive-submit.php

@ -1,6 +1,6 @@
<?php
include "T8_Authorization.php";
echo "收貨申請單";
echo "收貨申請單////有問題,要問俊佑";
?>
<script>
@ -22,26 +22,30 @@ echo "收貨申請單";
"name": "purReceivingOrderMaster",
"rows": [
{
"BillNo": "Z001",
"BillNo": "Z003",
"BillDate": 20210420,
"ReceiveOrgId": "1000",
"OrgId": "1000",
"DemandOrgId": "1000",
"TypeId": "RC",
"BizPartnerId": "Z001",
"PersonId": "Z001",
"CurrId": "NTD",
"CurrOAmount": 1,
"CurrLAmount": 1,
"ReciveDate": 20210420,
"DueToId": "Z001",
"TaxId": "ST005",
"DebtorOrgId": "1000",
"DebtorCurrOAmount": 1,
"DebtorCurrLAmount": 1,
"ReceiveCompId": "1000",
"DebtorCompId": "1000",
"DemandCompId": "1000"
"TypeId": "MA",
"FromSourceTag":"PO",
"FromTransId":"Z003",
// "BizPartnerId": "16547907",
// "PersonId": "M0122",
// "CurrId": "TWD",
// "CurrOAmount": 1,
// "CurrLAmount": 1,
// "ReciveDate": 20210420,
// "DueToId": "Z001",
// "TaxId": "ST005",
// "DebtorOrgId": "1000",
// "DebtorCurrOAmount": 1,
// "DebtorCurrLAmount": 1,
// "ReceiveCompId": "1000",
// "DebtorCompId": "1000",
// "DemandCompId": "1000",
"InStoreState":2,
"CurrentState":2
}
]
},
@ -49,13 +53,15 @@ echo "收貨申請單";
"name": "purReceivingOrderDetail",
"rows": [
{
"TaxId": "ST005",
"BillNo": "Z001",
// "TaxId": "ST005",
"FromSourceTag":"PO",
"FromBillNo":"Z003",
"BillNo": "Z002",
"RowCode": "1",
"ItemType": 0,
"MaterialId": "Z001",
"MaterialId": "MX01030018",
"ReceivingSQty": 1,
"SUnitId": "SET",
// "SUnitId": "SET",
"SPrice": "100"
}
]

Loading…
Cancel
Save