diff --git a/wms/mkt/pricereview-check.php b/wms/mkt/pricereview-check.php index 8c7f4d6a..23dad8e4 100644 --- a/wms/mkt/pricereview-check.php +++ b/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])+"
"; - //mihtml += "±1停材料費:"+commafy(data.content[k][2])+"
"; - //mihtml += "設計費:"+commafy(data.content[k][3])+"
"; - //mihtml += "出口費用:"+commafy(data.content[k][4])+"
"; - //mihtml += "利潤:"+commafy(data.content[k][5])+"
"; - //mihtml += "報價:"+commafy(data.content[k][6])+"
"; mihtml += "
電梯設備
"; mihtml += "
  • 設備"+data.content[k][8]+":"+commafy(data.content[k][1])+"
  • "; mihtml += "
  • 報關+運輸費:"+commafy(data.content[k][2])+"
  • "; @@ -284,7 +278,7 @@ function getMI(id) { mihtml += "
  • 安裝成本:"+commafy(data.content[k][5])+"
  • "; mihtml += "
  • 一年免保:"+commafy(data.content[k][6])+"
  • "; mihtml += "
  • 起吊+木箱+耗材:"+commafy(data.content[k][7])+"
  • "; - mihtml += "
  • 加價:"+commafy(data.content[k][9])+"
  • "; + //mihtml += "
  • 加價:"+commafy(data.content[k][9])+"
  • "; mihtml += "以上合計:"+commafy(data.content[k][12])+"/台"; mihtml += "
    "; mihtml += "
    OPTION
    "; @@ -297,6 +291,7 @@ function getMI(id) { Object.keys(data.content[k][18]).forEach(function(m){ mihtml += "
  • "+data.content[k][18][m][0]+":"+commafy(data.content[k][18][m][1])+"
  • "; }); + mihtml += "
  • "+data.content[k][19][0]+":"+commafy(data.content[k][19][1])+"
  • "; mihtml += "以上合計:"+commafy(data.content[k][13])+"
    "; $("#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 { "> -
    - - "> -
    "> @@ -862,6 +853,10 @@ hr { ">
    +
    + + "> +
    "> diff --git a/wms/mkt/pricereview_mi-api.php b/wms/mkt/pricereview_mi-api.php index 931f22e4..32253e3e 100644 --- a/wms/mkt/pricereview_mi-api.php +++ b/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++; } } diff --git a/wms/mkt/pricereview_renovate-check.php b/wms/mkt/pricereview_renovate-check.php index c28dac8b..79e51e12 100644 --- a/wms/mkt/pricereview_renovate-check.php +++ b/wms/mkt/pricereview_renovate-check.php @@ -284,7 +284,7 @@ function getMI(id) { mihtml += "
  • 安裝成本:"+commafy(data.content[k][5])+"
  • "; mihtml += "
  • 一年免保:"+commafy(data.content[k][6])+"
  • "; mihtml += "
  • 起吊+木箱+耗材:"+commafy(data.content[k][7])+"
  • "; - mihtml += "
  • 加價:"+commafy(data.content[k][9])+"
  • "; + //mihtml += "
  • 加價:"+commafy(data.content[k][9])+"
  • "; mihtml += "
  • 拆除電梯:"+commafy(data.content[k][10])+"
  • "; mihtml += "
  • 美容抛光:"+commafy(data.content[k][11])+"
  • "; mihtml += "以上合計:"+commafy(data.content[k][12])+"/台"; @@ -299,6 +299,7 @@ function getMI(id) { Object.keys(data.content[k][18]).forEach(function(m){ mihtml += "
  • "+data.content[k][18][m][0]+":"+commafy(data.content[k][18][m][1])+"
  • "; }); + mihtml += "
  • "+data.content[k][19][0]+":"+commafy(data.content[k][19][1])+"
  • "; mihtml += "以上合計:"+commafy(data.content[k][13])+"
    "; $("#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); diff --git a/wms/rib01-check.php b/wms/rib01-check.php index c95ea203..c27b5e32 100644 --- a/wms/rib01-check.php +++ b/wms/rib01-check.php @@ -383,6 +383,9 @@ $feetype = mysqli_fetch_all($feetype_query, MYSQLI_ASSOC); + + + diff --git a/wms/rib02-create.php b/wms/rib02-create.php index 7eca2d8e..3a77e4d9 100644 --- a/wms/rib02-create.php +++ b/wms/rib02-create.php @@ -258,7 +258,7 @@ $materials = $conn->query($sql_Material);
    - @@ -266,7 +266,7 @@ $materials = $conn->query($sql_Material);
    - @@ -276,7 +276,7 @@ $materials = $conn->query($sql_Material);
    - $value) { ?> @@ -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); diff --git a/wms/rib02-submit.php b/wms/rib02-submit.php index 21061f47..dcf669ce 100644 --- a/wms/rib02-submit.php +++ b/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); + ?>