//Controller
class Product_PackageController extends Zend_Controller_Action {
//指定包材数据明细列表
public function packagingMaterialsDetailListAction() {
$warehouseId = $this->_request->getParam('userWarehouse', '');
$productSku = $this->_request->getParam('product_sku', '');
$startDate = $this->_request->getParam('start_date', '');
$endDate = $this->_request->getParam('end_date', '');
$combinat = array(
'warehouse_id' => $warehouseId,
'product_sku' => $productSku,
'start_date' => $startDate . ' 00:00:00',
'end_date' => $endDate . ' 23:59:59',
);
$pmIds = Product_Service_PackagingMaterials::getCombination($combinat, '*');
$data[0] = array(
'pm_create_date' => date('Y-m-t', strtotime('-1 months', strtotime($startDate))),
'pm_type' => 10,
'pm_end_semester_quantity' => empty($pmIds[0]['pm_beginning_quantity']) ? 0 : $pmIds[0]['pm_beginning_quantity'],
'pm_end_semester_price' => empty($pmIds[0]['pm_beginning_price']) ? 0 : $pmIds[0]['pm_beginning_price'],
'pm_end_semester_gold' => empty($pmIds[0]['pm_beginning_gold']) ? 0 : $pmIds[0]['pm_beginning_gold'],
);
$this->view->data = array_merge($data, $pmIds);
$this->view->product_sku = $productSku;
echo $this->view->render('product/package/packaging-materials-detail-list.tpl');
}
}
js
//包材数据明细列表
function loadData() {
loading();
$.ajax({
url: "/product/package/packaging-materials-list",
async: false,
dataType: "json",
type: "post",
data: $("#sForm").serializeArray(),
success: function (json) {
var Html = "";
if (json.ask) {
$.each(json.data, function (key, value) {
$.each(value, function (ke, valu) {
Html += "<tr>";
Html += "<td>" + key + "</td>";
Html += "<td onclick='packagingMaterialsDetailList(\"" + ke + "\", \"" + valu.start_date + "\", \"" + valu.end_date + "\")' style='cursor: pointer'>" + ke + "</td>";
Html += "<td>" + valu.beginning_inventory_quantity + "</td>";
Html += "<td>" + valu.beginning_inventory_gold + "</td>";
Html += "<td>" + valu.into_quantity_count + "</td>";
Html += "<td>" + valu.into_gold_count + "</td>";
Html += "<td>" + valu.outbound_quantity_count + "</td>";
Html += "<td>" + valu.outbound_gold_count + "</td>";
Html += "<td>" + valu.end_semester_inventory_quantity + "</td>";
Html += "<td>" + valu.end_semester_inventory_gold + "</td>";
Html += "</tr>";
});
});
} else {
alertTip(json.msg);
Html += "<tr><td colspan='100%'>" + json.msg + "</td></tr>";
}
$("#loadData").html(Html);
}
});
closeLoading();
}
//该包材的数据明细列表
function packagingMaterialsDetailList(product_sku, start_date, end_date) {
var warehouse_id = $("#userWarehouse").find("option:selected").val();
window.open("/product/package/packaging-materials-detail-list/product_sku/" + product_sku + "/userWarehouse/" + warehouse_id + "/start_date/" + start_date + "/end_date/" + end_date);
}
Html
<!DOCTYPE html>
<html>
<head>
<title><{$product_sku}> 包材数据明细列表</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style type="text/css">
#customers{
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
width: 50%;
border-collapse: collapse;
}
#customers th{
font-size: 1.1em;
background-color: #B8CCE4;
text-align: center;
}
#customers td, #customers th{
font-size: 1em;
border: 1px solid #000;
}
.right{
text-align: right;
}
</style>
</head>
<body>
<table id="customers">
<tr>
<th>SKU</th>
<th colspan="2" style="color: #ffffff"><{$product_sku}></th>
<th colspan="3">本月入库</th>
<th colspan="3">本月出库</th>
<th colspan="3">期末结存</th>
<th rowspan="2">备注</th>
</tr>
<tr>
<th>序号</th>
<th style="width: 3.5cm">日期</th>
<th>摘要</th>
<th>数量</th>
<th>单价</th>
<th>金额</th>
<th>数量</th>
<th>单价</th>
<th>金额</th>
<th>数量</th>
<th>单价</th>
<th>金额</th>
</tr>
<{foreach from=$data key="key" item="value"}>
<tr>
<td><{if $key > 0}><{$key}><{/if}></td>
<td><{$value.pm_create_date}></td>
<td><{if $value.pm_type == 0}>采购入库<{elseif $value.pm_type == 1}>领用出库<{elseif $value.pm_type == 2 || $value.pm_type == 3}>CFF 盘点<{else}>结存<{/if}></td>
<{if $value.pm_type == 0 || $value.pm_type == 2}>
<td class='right'><{$value.pm_quantity}></td>
<td class='right'><{$value.pm_price}></td>
<td class='right'><{$value.pm_gold}></td>
<td></td>
<td></td>
<td></td>
<{elseif $value.pm_type == 1 || $value.pm_type == 3}>
<td></td>
<td></td>
<td></td>
<{if $value.pm_quantity > 0}>
<td style="color: red" class='right'>-<{$value.pm_quantity}></td>
<td class='right'><{$value.pm_price}></td>
<td style="color: red" class='right'>-<{$value.pm_gold}></td>
<{else}>
<td style="color: red" class='right'><{$value.pm_quantity}></td>
<td class='right'><{$value.pm_price}></td>
<td style="color: red" class='right'><{$value.pm_gold}></td>
<{/if}>
<{else}>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<{/if}>
<{if $value.pm_end_semester_quantity < 0}>
<td style="color: red" class='right'><{$value.pm_end_semester_quantity}></td>
<td class='right'><{$value.pm_end_semester_price}></td>
<td style="color: red" class='right'><{$value.pm_end_semester_gold}></td>
<{else}>
<td class='right'><{$value.pm_end_semester_quantity}></td>
<td class='right'><{$value.pm_end_semester_price}></td>
<td class='right'><{$value.pm_end_semester_gold}></td>
<{/if}>
<td><{if $key > 0}><{$value.pm_code}><{/if}></td>
</tr>
<{/foreach}>
</table>
</body>
</html>
SKU 指定包材数据明细列表
最新推荐文章于 2024-01-15 10:09:25 发布