Browse Source

Merge branch 'main' into gary

gary
gary_chen\gary_chen 1 year ago
parent
commit
e42c7eb2c8
  1. 17
      wms/mkt/pricereview-check.php
  2. 15
      wms/mkt/pricereview_mi-api.php
  3. 3
      wms/mkt/pricereview_renovate-check.php
  4. 3
      wms/rib01-check.php
  5. 7
      wms/rib02-create.php
  6. 82
      wms/rib02-submit.php
  7. 6
      wms/rib03-submit.php

17
wms/mkt/pricereview-check.php

@ -270,12 +270,6 @@ function getMI(id) {
}
$("#tb1").find("input[name=mi_fix]").eq(k).keyup();
var mihtml = "";
//mihtml += "基准採購成本:"+commafy(data.content[k][1])+"<br>";
//mihtml += "±1停材料費:"+commafy(data.content[k][2])+"<br>";
//mihtml += "設計費:"+commafy(data.content[k][3])+"<br>";
//mihtml += "出口費用:"+commafy(data.content[k][4])+"<br>";
//mihtml += "利潤:"+commafy(data.content[k][5])+"<br>";
//mihtml += "報價:"+commafy(data.content[k][6])+"<br>";
mihtml += "<h5>電梯設備</h5>";
mihtml += "<li>設備"+data.content[k][8]+":"+commafy(data.content[k][1])+"</li>";
mihtml += "<li>報關+運輸費:"+commafy(data.content[k][2])+"</li>";
@ -284,7 +278,7 @@ function getMI(id) {
mihtml += "<li>安裝成本:"+commafy(data.content[k][5])+"</li>";
mihtml += "<li>一年免保:"+commafy(data.content[k][6])+"</li>";
mihtml += "<li>起吊+木箱+耗材:"+commafy(data.content[k][7])+"</li>";
mihtml += "<li>加價:"+commafy(data.content[k][9])+"</li>";
//mihtml += "<li>加價:"+commafy(data.content[k][9])+"</li>";
mihtml += "以上合計:"+commafy(data.content[k][12])+"/台";
mihtml += "<hr>";
mihtml += "<h5>OPTION</h5>";
@ -297,6 +291,7 @@ function getMI(id) {
Object.keys(data.content[k][18]).forEach(function(m){
mihtml += "<li>"+data.content[k][18][m][0]+":"+commafy(data.content[k][18][m][1])+"</li>";
});
mihtml += "<li>"+data.content[k][19][0]+":"+commafy(data.content[k][19][1])+"</li>";
mihtml += "以上合計:"+commafy(data.content[k][13])+"<br>";
$("#tb1").find("tr[name=facil_templ2]").eq(k).find('td').eq(1).html(mihtml);
//$("#tb1").find("input[name=mi_fix]").eq(k).closest('td').append(mihtml);
@ -850,10 +845,6 @@ hr {
<label for="price_total_broken">破價總額(B-A)</label>
<input type="text" name="price_total_broken" id="price_total_broken" class="dollar-right" value="<?=number_format($data["price_total_broken"]);?>">
</div>
<div>
<label for="price_rate">價率%(B/A)</label>
<input type="text" name="price_rate" id="price_rate" value="<?=number_format($data["price_rate"], 1);?>">
</div>
<div>
<label for="qty_total">總台數</label>
<input type="text" name="qty_total" id="qty_total" value="<?=number_format($data["qty_total"]);?>">
@ -862,6 +853,10 @@ hr {
<label for="special_fee">特殊費用</label>
<input type="text" name="special_fee" id="special_fee" value="<?php echo number_format($data["special_fee"]); ?>">
</div>
<div>
<label for="price_rate">價率%(B/A)</label>
<input type="text" name="price_rate" id="price_rate" value="<?=number_format($data["price_rate"], 1);?>">
</div>
<div>
<label for="price_broken">破價(台)</label>
<input type="text" name="price_broken" id="price_broken" class="dollar-right" value="<?=number_format($data["price_broken"]);?>">

15
wms/mkt/pricereview_mi-api.php

@ -76,6 +76,16 @@ try {
}
mysqli_free_result($res);
// 特殊費用平均分到每台電梯
$specarr = [];
$sql = "select special_fee from pricereview_main where id = '$id'";
$res = mysqli_query($link, $sql);
$row = mysqli_fetch_row($res);
$special_fee = $row[0];
mysqli_free_result($res);
$specarr[0] = "特殊費用";
$specarr[1] = round($special_fee/$elev_qty_all, 0);
// 電梯所屬OPTION
$opt_sel_id_arr = [];
$sql = "select id, price_id, item_spec, item_qty, option_relate_spec from pricereview_item where mid = '$id' and item_group = 'B'";
@ -178,6 +188,8 @@ try {
}
$res_e = mysqli_query($link, $sql2);
if ($row_e = mysqli_fetch_assoc($res_e)) {
// 加價:先不納入
$row_e["option_price"] = 0;
// 基准采购成本+±1停材料费+设计费+出口费用
$part1 = $row_e["purchase_cost"]+($v["floors"]-$row_e["base_floor"])*$row_e["material_plus"]+$row_e["design"]*$row_e["design_hour"]+$row_e["export_fee"];
// 利潤
@ -348,12 +360,13 @@ try {
$mi_arr[$i][10] = 0+$dismantle_fee;
$mi_arr[$i][11] = 0+$polishing_fee;
$mi_arr[$i][12] = $mi_arr[$i][1]+$mi_arr[$i][2]+$mi_arr[$i][3]+$mi_arr[$i][4]+$mi_arr[$i][5]+$mi_arr[$i][6]+$mi_arr[$i][7]+$mi_arr[$i][9]+$mi_arr[$i][10]+$mi_arr[$i][11];
$mi_arr[$i][13] = $option_fee+$ex_fee+$mn_fee;
$mi_arr[$i][13] = $option_fee+$ex_fee+$mn_fee+$special_fee;
$mi_arr[$i][14] = $oparr;
$mi_arr[$i][15] = 0+$ex_fee;
$mi_arr[$i][16] = $exarr;
$mi_arr[$i][17] = 0+$mn_fee;
$mi_arr[$i][18] = $mnarr;
$mi_arr[$i][19] = $specarr;
$i++;
}
}

3
wms/mkt/pricereview_renovate-check.php

@ -284,7 +284,7 @@ function getMI(id) {
mihtml += "<li>安裝成本:"+commafy(data.content[k][5])+"</li>";
mihtml += "<li>一年免保:"+commafy(data.content[k][6])+"</li>";
mihtml += "<li>起吊+木箱+耗材:"+commafy(data.content[k][7])+"</li>";
mihtml += "<li>加價:"+commafy(data.content[k][9])+"</li>";
//mihtml += "<li>加價:"+commafy(data.content[k][9])+"</li>";
mihtml += "<li>拆除電梯:"+commafy(data.content[k][10])+"</li>";
mihtml += "<li>美容抛光:"+commafy(data.content[k][11])+"</li>";
mihtml += "以上合計:"+commafy(data.content[k][12])+"/台";
@ -299,6 +299,7 @@ function getMI(id) {
Object.keys(data.content[k][18]).forEach(function(m){
mihtml += "<li>"+data.content[k][18][m][0]+":"+commafy(data.content[k][18][m][1])+"</li>";
});
mihtml += "<li>"+data.content[k][19][0]+":"+commafy(data.content[k][19][1])+"</li>";
mihtml += "以上合計:"+commafy(data.content[k][13])+"<br>";
$("#tb1").find("tr[name=facil_templ2]").eq(k).find('td').eq(1).html(mihtml);
//$("#tb1").find("input[name=mi_fix]").eq(k).closest('td').append(mihtml);

3
wms/rib01-check.php

@ -383,6 +383,9 @@ $feetype = mysqli_fetch_all($feetype_query, MYSQLI_ASSOC);
<td><a href="rib02-edit.php?id=<?php echo $pay['ribsub_id'] ?>&state=1&<?= $token_link ?>" class="btn btn-warning btn-sm">
<span class=" glyphicon glyphicon-pencil"></span>
</a>
<a href="rib02-delete.php?ribsub_id=<?php echo $pay['ribsub_id'] ?>&rib_id=<?php echo $pay['rib_id'] ?>&<?= $token_link ?>" class="btn btn-danger btn-sm">
<span class=" glyphicon glyphicon-trash"></span>
</a>
</td>
<?php } else { ?>

7
wms/rib02-create.php

@ -258,7 +258,7 @@ $materials = $conn->query($sql_Material);
<div class="form-group">
<div class="col-md-3">
<label for="TaxId">稅碼</label>
<select name="TaxId" class="form-control">
<select name="TaxId" id="TaxId" class="form-control">
<option value="ST005" selected>營業稅5%</option>
<option value="ST101">零稅</option>
<option value="ST102">免稅</option>
@ -266,7 +266,7 @@ $materials = $conn->query($sql_Material);
</div>
<div class="col-md-3">
<label for="IsCounteract">抵扣</label>
<select name="IsCounteract" class="form-control">
<select name="IsCounteract" id="IsCounteract" class="form-control">
<option value=1 selected>可抵扣</option>
<option value=0>不可抵扣</option>
</select>
@ -276,7 +276,7 @@ $materials = $conn->query($sql_Material);
<div class="form-group">
<div class="col-md-3">
<label for="UnitId" style="color: red;">計量單位</label>
<select name="UnitId" class="form-control" required>
<select name="UnitId" id="UnitId" class="form-control" required>
<?php
foreach ($unit as $key => $value) { ?>
<option value="<?php echo $value['UnitId']; ?>"><?php echo $value['UnitName']; ?></option>
@ -636,6 +636,7 @@ $materials = $conn->query($sql_Material);
if ($user_id == "M0056" || $user_id == "M0209") { ?>
$("#OTax").prop("disabled", false);
$("#LTax").prop("disabled", false);
$("#CurrLAmount").prop("disabled", false);
$("#OAmountUnWithTax").prop("disabled", false);
$("#LAmountUnWithTax").prop("disabled", false);
$("#LAmount").prop("disabled", false);

82
wms/rib02-submit.php

@ -12,7 +12,7 @@ $BizPartner = $conn->query($sql_Biz);
foreach ($BizPartner as $biz) {
$bizKey = $biz['BizPartnerId'];
$bizValue = $biz['BizPartnerName'];
$BusinessPartner[$bizKey]=$bizValue;
$BusinessPartner[$bizKey] = $bizValue;
}
$RowCode = $_POST['RowCode'];
@ -35,6 +35,7 @@ $VoucherCount = empty($_POST['VoucherCount']) ? 1 : $_POST['VoucherCount'];
$VoucherType = isset($_POST['VoucherType']) ? $_POST['VoucherType'] : 0;
$InvoiceNo = empty($_POST['InvoiceNo']) ? NULL : $_POST['InvoiceNo'];
$CurrId = empty($_POST['CurrId']) ? null : $_POST['CurrId'];
$CurrLAmount = empty($_POST['CurrLAmount']) ? null : $_POST['CurrLAmount'];
// $comSupplierName = empty($_POST['comSupplierName']) ? null : $_POST['comSupplierName'];
$FromSourceTag = 0;
$TaxRate = ($TaxId == "ST005") ? 0.05 : 0;
@ -44,12 +45,12 @@ $OAmountUnWithTax = isset($_POST['OAmountUnWithTax']) ? $_POST['OAmountUnWithTax
$LAmountUnWithTax = isset($_POST['LAmountUnWithTax']) ? $_POST['LAmountUnWithTax'] : null;
$LAmount = isset($_POST['LAmount']) ? $_POST['LAmount'] : null;
$TaxNo = empty($_POST['TaxNo']) ? '' : $_POST['TaxNo'];
if (empty($TaxNo)){
if (empty($TaxNo)) {
$comSupplierName = "雜項請款用";
}else{
if (isset($BusinessPartner[$TaxNo])){
$comSupplierName= $BusinessPartner[$TaxNo];
}else{
} else {
if (isset($BusinessPartner[$TaxNo])) {
$comSupplierName = $BusinessPartner[$TaxNo];
} else {
$comSupplierName = "雜項請款用";
}
}
@ -70,31 +71,59 @@ if (isset($comSupplierName) && ($comSupplierName != "雜項請款用")) {
$SQL1 = "";
if ($submit == "add") {
$SQL1 = "INSERT INTO rib_sub (`RowCode`,`rib_id`,`RowNo`,`FeeDate`,`FeeTypeId`,`WriteOffType`,
if (($user_id == "M0056" )|| ($user_id == "M0209")) {
$SQL1 = "INSERT INTO rib_sub (`RowCode`,`rib_id`,`RowNo`,`FeeDate`,`FeeTypeId`,`WriteOffType`,
`BizOrgId`,`WriteOffId`,`FeeOrgId`,`FeeDeptId`,`FeeCompanyId`,`UnitId`,`Quantity`,
`Price`,`OAmount`,`FeeNoteShow`,`CurrId`,`SupplyOrgId`,`CurrOAmount`,`FromSourceTag`,`TaxId`,`IsCounteract`,`InvoiceId`,`TaxRate`,`CreatorId`,`TaxNo`,`CurrentLAmount`,`OTax`,`LTax`,
`OAmountUnWithTax`,`LAmountUnWithTax`,`LAmount`";
$SQL1 .= empty($ProjectId) ? "" : ",`ProjectId`";
$SQL1 .= isset($FeeTypeGen) ? ",`FeeTypeGen`" : "";
$SQL1 .= empty($CU_MaterialId) ? "" : ",`CU_MaterialId`";
$SQL1 .= empty($VoucherCount) ? "" : ",`VoucherCount`";
$SQL1 .= isset($VoucherType) ? ",`VoucherType`" : "";
$SQL1 .= empty($InvoiceNo) ? "" : ",`InvoiceNo`";
$SQL1 .= empty($comSupplierName) ? "" : ",`comSupplierName`";
$SQL1 .= empty($comSupplierId) ? ",`comSupplierId`" : ",`comSupplierId`";
$SQL2 = ") VALUES ($RowCode, $rib_id, $RowCode,$FeeDate,'$FeeTypeId',2,
'1000','$WriteOffId','1000','$FeeDeptId','1000','$UnitId',$Quantity,
$Price,$OAmount,'$FeeNoteShow','$CurrId','1000',1,0,'$TaxId',$IsCounteract,'$InvoiceId',$TaxRate,'$user_id','$TaxNo',$CurrLAmount,$OTax,$LTax,
$OAmountUnWithTax,$LAmountUnWithTax,$LAmount";
$SQL2 .= empty($ProjectId) ? "" : ",'" . $ProjectId . "'";
$SQL2 .= isset($FeeTypeGen) ? "," . $FeeTypeGen : "";
$SQL2 .= empty($CU_MaterialId) ? "" : ",'" . $CU_MaterialId . "'";
$SQL2 .= empty($VoucherCount) ? "" : "," . $VoucherCount;
$SQL2 .= isset($VoucherType) ? "," . $VoucherType : "";
$SQL2 .= empty($InvoiceNo) ? "" : ",'" . $InvoiceNo . "'";
$SQL2 .= empty($comSupplierName) ? "" : ",'" . $comSupplierName . "'";
$SQL2 .= empty($comSupplierId) ? ",' '" : ",'" . $comSupplierId . "'";
$SQL2 .= ")";
} else {
$SQL1 = "INSERT INTO rib_sub (`RowCode`,`rib_id`,`RowNo`,`FeeDate`,`FeeTypeId`,`WriteOffType`,
`BizOrgId`,`WriteOffId`,`FeeOrgId`,`FeeDeptId`,`FeeCompanyId`,`UnitId`,`Quantity`,
`Price`,`OAmount`,`FeeNoteShow`,`CurrId`,`SupplyOrgId`,`CurrOAmount`,`FromSourceTag`,`TaxId`,`IsCounteract`,`InvoiceId`,`TaxRate`,`CreatorId`,`TaxNo`";
$SQL1 .= empty($ProjectId) ? "" : ",`ProjectId`";
$SQL1 .= isset($FeeTypeGen) ? ",`FeeTypeGen`" : "";
$SQL1 .= empty($CU_MaterialId) ? "" : ",`CU_MaterialId`";
$SQL1 .= empty($VoucherCount) ? "" : ",`VoucherCount`";
$SQL1 .= isset($VoucherType) ? ",`VoucherType`" : "";
$SQL1 .= empty($InvoiceNo) ? "" : ",`InvoiceNo`";
$SQL1 .= empty($comSupplierName) ? "" : ",`comSupplierName`";
$SQL1 .= empty($comSupplierId) ? ",`comSupplierId`" : ",`comSupplierId`";
$SQL1 .= empty($ProjectId) ? "" : ",`ProjectId`";
$SQL1 .= isset($FeeTypeGen) ? ",`FeeTypeGen`" : "";
$SQL1 .= empty($CU_MaterialId) ? "" : ",`CU_MaterialId`";
$SQL1 .= empty($VoucherCount) ? "" : ",`VoucherCount`";
$SQL1 .= isset($VoucherType) ? ",`VoucherType`" : "";
$SQL1 .= empty($InvoiceNo) ? "" : ",`InvoiceNo`";
$SQL1 .= empty($comSupplierName) ? "" : ",`comSupplierName`";
$SQL1 .= empty($comSupplierId) ? ",`comSupplierId`" : ",`comSupplierId`";
$SQL2 = ") VALUES ($RowCode, $rib_id, $RowCode,$FeeDate,'$FeeTypeId',2,
$SQL2 = ") VALUES ($RowCode, $rib_id, $RowCode,$FeeDate,'$FeeTypeId',2,
'1000','$WriteOffId','1000','$FeeDeptId','1000','$UnitId',$Quantity,
$Price,$OAmount,'$FeeNoteShow','$CurrId','1000',1,0,'$TaxId',$IsCounteract,'$InvoiceId',$TaxRate,'$user_id','$TaxNo'";
$SQL2 .= empty($ProjectId) ? "" : ",'" . $ProjectId . "'";
$SQL2 .= isset($FeeTypeGen) ? "," . $FeeTypeGen : "";
$SQL2 .= empty($CU_MaterialId) ? "" : ",'" . $CU_MaterialId . "'";
$SQL2 .= empty($VoucherCount) ? "" : "," . $VoucherCount;
$SQL2 .= isset($VoucherType) ? "," . $VoucherType : "";
$SQL2 .= empty($InvoiceNo) ? "" : ",'" . $InvoiceNo . "'";
$SQL2 .= empty($comSupplierName) ? "" : ",'" . $comSupplierName . "'";
$SQL2 .= empty($comSupplierId) ? ",' '" : ",'" . $comSupplierId . "'";
$SQL2 .= ")";
$SQL2 .= empty($ProjectId) ? "" : ",'" . $ProjectId . "'";
$SQL2 .= isset($FeeTypeGen) ? "," . $FeeTypeGen : "";
$SQL2 .= empty($CU_MaterialId) ? "" : ",'" . $CU_MaterialId . "'";
$SQL2 .= empty($VoucherCount) ? "" : "," . $VoucherCount;
$SQL2 .= isset($VoucherType) ? "," . $VoucherType : "";
$SQL2 .= empty($InvoiceNo) ? "" : ",'" . $InvoiceNo . "'";
$SQL2 .= empty($comSupplierName) ? "" : ",'" . $comSupplierName . "'";
$SQL2 .= empty($comSupplierId) ? ",' '" : ",'" . $comSupplierId . "'";
$SQL2 .= ")";
}
$SQL1 .= $SQL2;
//上傳資料庫
mysqli_query($link, $SQL1);
@ -107,6 +136,7 @@ if ($submit == "add") {
$SQL1 = str_replace("'", '', $SQL1);
$sql_rib = "UPDATE rib SET LastOperatorId = '$user_id', LastOperation='$SQL1' WHERE rib_id=$rib_id";
mysqli_query($link, $sql_rib);
?>
<script>
window.location.href = "rib01-check.php?id=<?php echo $rib_id ?>&state=0&<?= $token_link ?>";

6
wms/rib03-submit.php

@ -125,7 +125,7 @@ if ($state == 1) {
// 更新表頭資料
$BillDate = intval(date('Ymd'));
$sql_rib = "UPDATE rib SET BillDate=$BillDate,CurrentState=1,PermitState=1, OAmountWithTax=$OAmountWithTax, LAmountWithTax= $LAmountWithTax, LAmount=$LAmount,
$sql_rib = "UPDATE rib SET BillDate=$BillDate,CurrentState=1,PermitState=0, OAmountWithTax=$OAmountWithTax, LAmountWithTax= $LAmountWithTax, LAmount=$LAmount,
OAmount =$OAmount, UnPayOAmount=$UnPayOAmount, Balance = $OAmountWithTax, LBalance= $UnPayLAmount ,UnPaymentLAmt=$UnPayLAmount,
UnPayLAmount=$UnPayLAmount, OTax=$OTax, LTax=$LTax, WriteOffAmount=$WriteOffAmount, CreatorId='$user_id' WHERE rib_id = $rib_id";
@ -269,7 +269,7 @@ OAmount =$OAmount, UnPayOAmount=$UnPayOAmount, Balance = $OAmountWithTax, LBalan
$HadPayOAmount,$HadPayLAmount,$UnPayOAmount,$UnPayLAmount,$PaymentState,$Balance,$LBalance,
0,'1000','$GatheringPersonId',$IsTaxBill,$OAmount,$LAmount,$OTax,$LTax,$LAmountWithTax,$OAmountWithTax,
$IsContainTax,$AdvanceOAmount,$AdvanceLAmount,$PrePayWriteOffAmount,$WriteOffAmount,
'1001',$WriteOffAmount,$UnPaymentLAmt,0,2,2";
'1001',$WriteOffAmount,$UnPaymentLAmt,0,2,0";
$sql .= empty($CostCenterId) ? "" : ",CostCenterId";
$sql2 .= empty($CostCenterId) ? "" : ",'" . $CostCenterId . "'";
@ -290,7 +290,7 @@ OAmount =$OAmount, UnPayOAmount=$UnPayOAmount, Balance = $OAmountWithTax, LBalan
$sql .= ")";
$result = $conn->query($sql);
// 更改WMS RIB狀態
$rib_sql = "UPDATE rib SET BillNo='$BillNo',CurrentState=2, PermitState=2 WHERE rib_id =$rib_id";
$rib_sql = "UPDATE rib SET BillNo='$BillNo',CurrentState=2, PermitState=0 WHERE rib_id =$rib_id";
mysqli_query($link, $rib_sql);
//取得表身資料

Loading…
Cancel
Save