Commit 8cbfe738 authored by wxl's avatar wxl

总入库存 总出库存

parent a9535ec9
...@@ -15,8 +15,35 @@ ...@@ -15,8 +15,35 @@
namespace Stock\Repository; namespace Stock\Repository;
use Doctrine\ORM\EntityRepository; use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\QueryBuilder;
use Stock\Entity\ExWarehouseOrderGoods;
class ExWarehouseOrderGoodsRepository extends EntityRepository class ExWarehouseOrderGoodsRepository extends EntityRepository
{ {
/**
* 获取出库总数
* @param array $search
* @return \Doctrine\ORM\Query
*/
public function ExWarehouseOrderGoodsAmount($search = [])
{
$query = $this->getEntityManager()->createQueryBuilder()
->select('SUM(e.warehouseGoodsExNum)')
->from(ExWarehouseOrderGoods::class, 'e');
$this->querySearchData($search, $query);
$ExWarehouseAmount= $query->getQuery()->getSingleScalarResult();
return $ExWarehouseAmount ? $ExWarehouseAmount : 0;
}
private function querySearchData($search, QueryBuilder $queryBuilder)
{
if(isset($search['ex_warehouse_order_goods_id']) && !empty($search['ex_warehouse_order_goods_id'])) $queryBuilder->andWhere($queryBuilder->expr()->eq('e.exWarehouseOrderGoodsId', $search['ex_warehouse_order_goods_id']));
if(isset($search['ex_warehouse_order_id']) && !empty($search['ex_warehouse_order_id'])) $queryBuilder->andWhere($queryBuilder->expr()->eq('e.exWarehouseOrderId', $search['ex_warehouse_order_id']));
if(isset($search['goods_id']) && !empty($search['goods_id'])) $queryBuilder->andWhere($queryBuilder->expr()->eq('e.goodsId', $search['goods_id']));
if(isset($search['goods_name']) && !empty($search['goods_name'])) $queryBuilder->andWhere($queryBuilder->expr()->like('e.goodsName', "'%".$search['goods_name']."%'"));
if(isset($search['goods_number']) && !empty($search['goods_number'])) $queryBuilder->andWhere($queryBuilder->expr()->like('e.goodsNumber', "'%".$search['goods_number']."%'"));
if(isset($search['goods_spec']) && !empty($search['goods_spec'])) $queryBuilder->andWhere($queryBuilder->expr()->like('e.goodsSpec', "'%".$search['goods_spec']."%'"));
return $queryBuilder;
}
} }
\ No newline at end of file
...@@ -15,8 +15,36 @@ ...@@ -15,8 +15,36 @@
namespace Stock\Repository; namespace Stock\Repository;
use Doctrine\ORM\EntityRepository; use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\QueryBuilder;
use Stock\Entity\OtherWarehouseOrderGoods;
class OtherWarehouseOrderGoodsRepository extends EntityRepository class OtherWarehouseOrderGoodsRepository extends EntityRepository
{ {
/**
* 获取入库总数
* @param array $search
* @return \Doctrine\ORM\Query
*/
public function OtherWarehouseOrderGoodsAmount($search = [])
{
$query = $this->getEntityManager()->createQueryBuilder()
->select('SUM(o.warehouseGoodsBuyNum)')
->from(OtherWarehouseOrderGoods::class, 'o');
$this->querySearchData($search, $query);
$OtherWarehouseAmount= $query->getQuery()->getSingleScalarResult();
return $OtherWarehouseAmount ? $OtherWarehouseAmount : 0;
}
private function querySearchData($search, QueryBuilder $queryBuilder)
{
if(isset($search['warehouse_order_goods_id']) && !empty($search['warehouse_order_goods_id'])) $queryBuilder->andWhere($queryBuilder->expr()->eq('o.warehouseOrderGoodsId', $search['warehouse_order_goods_id']));
if(isset($search['other_warehouse_order_id']) && !empty($search['other_warehouse_order_id'])) $queryBuilder->andWhere($queryBuilder->expr()->eq('o.otherWarehouseOrderId', $search['other_warehouse_order_id']));
if(isset($search['goods_id']) && !empty($search['goods_id'])) $queryBuilder->andWhere($queryBuilder->expr()->eq('o.goodsId', $search['goods_id']));
if(isset($search['goods_name']) && !empty($search['goods_name'])) $queryBuilder->andWhere($queryBuilder->expr()->like('o.goodsName', "'%".$search['goods_name']."%'"));
if(isset($search['goods_number']) && !empty($search['goods_number'])) $queryBuilder->andWhere($queryBuilder->expr()->like('o.goodsNumber', "'%".$search['goods_number']."%'"));
if(isset($search['goods_spec']) && !empty($search['goods_spec'])) $queryBuilder->andWhere($queryBuilder->expr()->like('o.goodsSpec', "'%".$search['goods_spec']."%'"));
return $queryBuilder;
}
} }
\ No newline at end of file
...@@ -83,7 +83,12 @@ class GoodsController extends AbstractActionController ...@@ -83,7 +83,12 @@ class GoodsController extends AbstractActionController
$query = $this->entityManager->getRepository(Goods::class)->findAllGoods($search); $query = $this->entityManager->getRepository(Goods::class)->findAllGoods($search);
$goodsList = $this->adminCommon()->erpPaginator($query, $page); $goodsList = $this->adminCommon()->erpPaginator($query, $page);
if(!empty($goodsList)) {
foreach ($goodsList as $key => $value) {
$value->OtherWarehouseOrderGoodsAmount = $this->entityManager->getRepository(OtherWarehouseOrderGoods::class)->OtherWarehouseOrderGoodsAmount(['goods_id' => $value->getGoodsId()]);
$value->ExWarehouseOrderGoodsAmount = $this->entityManager->getRepository(ExWarehouseOrderGoods::class)->ExWarehouseOrderGoodsAmount(['goods_id' => $value->getGoodsId()]);
}
}
return ['goodsList' => $goodsList, 'searchForm' => $searchForm]; return ['goodsList' => $goodsList, 'searchForm' => $searchForm];
} }
...@@ -506,6 +511,7 @@ class GoodsController extends AbstractActionController ...@@ -506,6 +511,7 @@ class GoodsController extends AbstractActionController
$value->WarehouseOrderSn = $otherWarehouseOrderInfo->getWarehouseOrderSn(); $value->WarehouseOrderSn = $otherWarehouseOrderInfo->getWarehouseOrderSn();
$value->WarehouseName = $otherWarehouseOrderInfo->getOneWarehouse()->getWarehouseName(); $value->WarehouseName = $otherWarehouseOrderInfo->getOneWarehouse()->getWarehouseName();
$value->WarehouseOrderInfo = $otherWarehouseOrderInfo->getWarehouseOrderInfo(); $value->WarehouseOrderInfo = $otherWarehouseOrderInfo->getWarehouseOrderInfo();
$otherWarehouseOrderInfo->OtherWarehouseOrderGoodsAmount = $this->entityManager->getRepository(OtherWarehouseOrderGoods::class)->OtherWarehouseOrderGoodsAmount(['goods_id' => $value->getGoodsId()]);
} }
} }
return ['goodsInfo' => $goodsInfo, 'otherWarehouseOrder' => $otherWarehouseOrderInfo, 'orderGoods'=>$orderGoods]; return ['goodsInfo' => $goodsInfo, 'otherWarehouseOrder' => $otherWarehouseOrderInfo, 'orderGoods'=>$orderGoods];
...@@ -536,6 +542,7 @@ class GoodsController extends AbstractActionController ...@@ -536,6 +542,7 @@ class GoodsController extends AbstractActionController
$value->ExWarehouseOrderSn = $exWarehouseOrderInfo->getExWarehouseOrderSn(); $value->ExWarehouseOrderSn = $exWarehouseOrderInfo->getExWarehouseOrderSn();
$value->WarehouseName = $exWarehouseOrderInfo->getOneWarehouse()->getWarehouseName(); $value->WarehouseName = $exWarehouseOrderInfo->getOneWarehouse()->getWarehouseName();
$value->ExWarehouseOrderInfo = $exWarehouseOrderInfo->getExWarehouseOrderInfo(); $value->ExWarehouseOrderInfo = $exWarehouseOrderInfo->getExWarehouseOrderInfo();
$exWarehouseOrderInfo->ExWarehouseOrderGoodsAmount = $this->entityManager->getRepository(ExWarehouseOrderGoods::class)->ExWarehouseOrderGoodsAmount(['goods_id' => $value->getGoodsId()]);
} }
} }
return ['goodsInfo' => $goodsInfo, 'exWarehouseOrder' => $exWarehouseOrderInfo, 'orderGoods' => $orderGoods]; return ['goodsInfo' => $goodsInfo, 'exWarehouseOrder' => $exWarehouseOrderInfo, 'orderGoods' => $orderGoods];
...@@ -568,10 +575,12 @@ class GoodsController extends AbstractActionController ...@@ -568,10 +575,12 @@ class GoodsController extends AbstractActionController
$arr['goodsSpec']=$val->getGoodsSpec(); $arr['goodsSpec']=$val->getGoodsSpec();
$arr['goodsCategoryName']=$val->getGoodsCategory()?$val->getGoodsCategory()->getGoodsCategoryName():''; $arr['goodsCategoryName']=$val->getGoodsCategory()?$val->getGoodsCategory()->getGoodsCategoryName():'';
$arr['brandName']=$val->getBrand()?$val->getBrand()->getBrandName():''; $arr['brandName']=$val->getBrand()?$val->getBrand()->getBrandName():'';
$arr['OtherWarehouseOrderGoodsAmount'] = $this->entityManager->getRepository(OtherWarehouseOrderGoods::class)->OtherWarehouseOrderGoodsAmount(['goods_id' => $val->getGoodsId()]);
$arr['ExWarehouseOrderGoodsAmount'] = $this->entityManager->getRepository(ExWarehouseOrderGoods::class)->ExWarehouseOrderGoodsAmount(['goods_id' => $val->getGoodsId()]);
array_push($list,$arr); array_push($list,$arr);
} }
$columns=['goodsId','goodsName','goodsStock','goodsPrice','goodsRecommendPrice','goodsSpec','goodsCategoryName','brandName']; $columns=['goodsId','goodsName','goodsStock','goodsPrice','goodsRecommendPrice','goodsSpec','goodsCategoryName','brandName','OtherWarehouseOrderGoodsAmount','ExWarehouseOrderGoodsAmount'];
$columns_CH="ID,商品名称,库存,采购价格,建议售价,商品规格,商品分类,商品品牌"; $columns_CH="ID,商品名称,库存,采购价格,建议售价,商品规格,商品分类,商品品牌,总入库存,总出库存";
$this->goodsManager->export_excel($list,$columns,'商品导出',explode(",", $columns_CH)); $this->goodsManager->export_excel($list,$columns,'商品导出',explode(",", $columns_CH));
exit; exit;
return; return;
......
...@@ -59,7 +59,8 @@ ...@@ -59,7 +59,8 @@
<tfoot> <tfoot>
<tr> <tr>
<td colspan="8"></td> <td colspan="6"></td>
<td colspan="2" class="text-right"><b><?php echo $this->translate('总出库数'); ?></b><span id="order-amount"><?php echo (isset($this->exWarehouseOrder) ? $this->exWarehouseOrder->ExWarehouseOrderGoodsAmount : 0); ?></span></td>
<td colspan="2" class="text-right"><b><?php echo $this->translate('金额合计'); ?></b><span id="order-amount"><?php echo (isset($this->exWarehouseOrder) ? $this->erpCurrencyFormat($this->exWarehouseOrder->getExWarehouseOrderAmount()) : 0); ?></span></td> <td colspan="2" class="text-right"><b><?php echo $this->translate('金额合计'); ?></b><span id="order-amount"><?php echo (isset($this->exWarehouseOrder) ? $this->erpCurrencyFormat($this->exWarehouseOrder->getExWarehouseOrderAmount()) : 0); ?></span></td>
</tr> </tr>
</tfoot> </tfoot>
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
<thead> <thead>
<tr class="erp-bg-thead"> <tr class="erp-bg-thead">
<th width="6%">ID</th> <th width="6%">ID</th>
<th width="20%"><?php echo $this->translate('商品名称'); ?></th> <th width="10%"><?php echo $this->translate('商品名称'); ?></th>
<th width="10%"><?php echo $this->translate('商品编号'); ?></th> <th width="10%"><?php echo $this->translate('商品编号'); ?></th>
<th width="12%"><?php echo $this->translate('商品规格'); ?></th> <th width="12%"><?php echo $this->translate('商品规格'); ?></th>
<th width="10%"><?php echo $this->translate('采购价格'); ?></th> <th width="10%"><?php echo $this->translate('采购价格'); ?></th>
...@@ -33,6 +33,8 @@ ...@@ -33,6 +33,8 @@
<th width="10%"><?php echo $this->translate('商品分类'); ?></th> <th width="10%"><?php echo $this->translate('商品分类'); ?></th>
<th width="8%"><?php echo $this->translate('商品品牌'); ?></th> <th width="8%"><?php echo $this->translate('商品品牌'); ?></th>
<th width="6%"><?php echo $this->translate('库存'); ?></th> <th width="6%"><?php echo $this->translate('库存'); ?></th>
<th width="6%"><?php echo $this->translate('总入库存'); ?></th>
<th width="6%"><?php echo $this->translate('总出库存'); ?></th>
<th width="12%"><?php echo $this->translate('操作'); ?></th> <th width="12%"><?php echo $this->translate('操作'); ?></th>
</tr> </tr>
<?php <?php
...@@ -101,6 +103,8 @@ ...@@ -101,6 +103,8 @@
<?php echo $this->formElementErrors($sForm->get('start_stock'), ['class'=>'error-message']);?> <?php echo $this->formElementErrors($sForm->get('start_stock'), ['class'=>'error-message']);?>
<?php echo $this->formElementErrors($sForm->get('end_stock'), ['class'=>'error-message']);?> <?php echo $this->formElementErrors($sForm->get('end_stock'), ['class'=>'error-message']);?>
</td> </td>
<td></td>
<td></td>
<td> <td>
<button type="submit" class="btn btn-info btn-sm"><i class="fa fa-search"></i></button> <button type="submit" class="btn btn-info btn-sm"><i class="fa fa-search"></i></button>
<?php if(!empty(array_filter($sForm->getData()))) { ?> <?php if(!empty(array_filter($sForm->getData()))) { ?>
...@@ -134,6 +138,8 @@ ...@@ -134,6 +138,8 @@
<?php echo $this->translate('无'); ?> <?php echo $this->translate('无'); ?>
<?php } ?> <?php } ?>
</td> </td>
<td><?php echo empty($goods->OtherWarehouseOrderGoodsAmount) ? $this->translate('无') : $this->escapeHtml($goods->OtherWarehouseOrderGoodsAmount); ?></td>
<td><?php echo empty($goods->ExWarehouseOrderGoodsAmount) ? $this->translate('无') : $this->escapeHtml($goods->ExWarehouseOrderGoodsAmount); ?></td>
<td> <td>
<a href="<?php echo $this->url('goods', <a href="<?php echo $this->url('goods',
['action'=>'edit', 'id'=>$goods->getGoodsId()]); ?>" ['action'=>'edit', 'id'=>$goods->getGoodsId()]); ?>"
...@@ -146,12 +152,12 @@ ...@@ -146,12 +152,12 @@
<a href="<?php echo $this->url('goods', <a href="<?php echo $this->url('goods',
['action'=>'otherwarehousegoods', 'id'=>$goods->getGoodsId()]); ?>" ['action'=>'otherwarehousegoods', 'id'=>$goods->getGoodsId()]); ?>"
class="btn btn-xs btn-success"> <?php echo $this->translate('入库'); ?> class="btn btn-xs btn-success"> <?php echo $this->translate('入库记录'); ?>
</a> </a>
<a href="<?php echo $this->url('goods', <a href="<?php echo $this->url('goods',
['action'=>'exwarehousegoods', 'id'=>$goods->getGoodsId()]); ?>" ['action'=>'exwarehousegoods', 'id'=>$goods->getGoodsId()]); ?>"
class="btn btn-xs btn-success"> <?php echo $this->translate('出库'); ?> class="btn btn-xs btn-success"> <?php echo $this->translate('出库记录'); ?>
</a> </a>
</td> </td>
</tr> </tr>
......
...@@ -58,7 +58,8 @@ ...@@ -58,7 +58,8 @@
<tfoot> <tfoot>
<tr> <tr>
<td colspan="8"></td> <td colspan="6"></td>
<td colspan="2" class="text-right"><b><?php echo $this->translate('总入库数'); ?></b><span id="order-amount"><?php echo (isset($this->otherWarehouseOrder) ? $this->otherWarehouseOrder->OtherWarehouseOrderGoodsAmount : 0); ?></span></td>
<td colspan="2" class="text-right"><b><?php echo $this->translate('金额合计'); ?></b><span id="order-amount"><?php echo (isset($this->otherWarehouseOrder) ? $this->erpCurrencyFormat($this->otherWarehouseOrder->getWarehouseOrderAmount()) : 0); ?></span></td> <td colspan="2" class="text-right"><b><?php echo $this->translate('金额合计'); ?></b><span id="order-amount"><?php echo (isset($this->otherWarehouseOrder) ? $this->erpCurrencyFormat($this->otherWarehouseOrder->getWarehouseOrderAmount()) : 0); ?></span></td>
</tr> </tr>
</tfoot> </tfoot>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment