/* Decoded by unphp.net */ session_start(); header("Content-Type:text/plain;Charset=TIS-620"); $path = '../../'; $dir = "pos"; include($path .'include/config.inc.php'); include($path .'include/class_db.php'); include($path .'include/class_display.php'); include($path .'include/class_application.php'); include($path .'include/class_lang.php'); $CLASS['db'] = new db(); $CLASS['db']->connect(); $CLASS['disp'] = new display(); $CLASS['app'] = new application(); $CLASS['lang'] = new lang(); $db = $CLASS['db']; $disp = $CLASS['disp']; $app = $CLASS['app']; $lang = $CLASS['lang']; $ic_session_id = $_SESSION['USERID']; $use_cow = $db->clsSQLSelectField("cad_inventory_organization","use_cow","branch_num = '$BRANCH_NUM'"); ;echo '
 » ÃÒ¡ÒÃÊÔ¹¤éÒ
  ÃËÑÊ    ª×èÍ       

'; $sql = "SELECT sale_zero FROM cad_inventory_organization WHERE branch_num = '$BRANCH_NUM' AND sale_zero > 0"; $allow_sale_zero = $db->get_data_field($sql,"sale_zero"); #****** äÁèà»ç¹¤èÒÇèÒ§áÊ´§ÇèÒŧ·ÐàºÕ¹¢ÒµԴź äÁèµéͧÁÕà§×è͹ä¢àËÅ×ÍÁÒ¡¡ÇèÒ 0 if (empty($allow_sale_zero)) { $sql_cond = " AND inv_stock.qty > 0"; }else { $sql_cond = ""; }; $sql_union = 'ORDER BY goods_ref'; if($use_cow == 1) { if($ware_house_id == $BRANCH_NUM.'18205') { $SELECT_GOODS = 'IF(inv_cattle_trimming_detail.cattle_trimming_id, inv_cattle_trimming_detail.cattle_trimming_id, inv_use_goods.goods_ref) AS goods_ref,'; $SELECT_QTY = 'IF(inv_cattle_trimming_detail.cattle_trimming_id, inv_cattle_trimming_detail.weight, inv_stock.qty) AS qty'; $JOIN = 'LEFT JOIN inv_cattle_trimming_detail ON inv_use_goods.goods_ref = inv_cattle_trimming_detail.goods_ref'; $WHERE_STATUS = ' AND inv_cattle_trimming_detail.status = 1'; }else if($ware_house_id == $BRANCH_NUM.'18204') { $SELECT_GOODS = 'IF(inv_cattle_thoroughly.cattle_thoroughly_id, inv_cattle_thoroughly.cattle_thoroughly_id, inv_use_goods.goods_ref) AS goods_ref,'; $SELECT_QTY = 'IF(inv_cattle_thoroughly.cattle_thoroughly_id, inv_cattle_thoroughly.weight, inv_stock.qty) AS qty'; $JOIN = 'LEFT JOIN inv_cattle_thoroughly ON inv_use_goods.goods_ref = inv_cattle_thoroughly.goods_ref'; $WHERE_STATUS = ' AND inv_cattle_thoroughly.status = 1'; }else if ($ware_house_id == $BRANCH_NUM.'18203') { $SELECT_GOODS = 'IF(inv_cattle_four.cattle_four_id, inv_cattle_four.cattle_four_id, inv_use_goods.goods_ref) AS goods_ref,'; $SELECT_QTY = 'IF(inv_cattle_four.cattle_four_id, inv_cattle_four.weight, inv_stock.qty) AS qty'; $JOIN = 'LEFT JOIN inv_cattle_four ON inv_use_goods.goods_ref = inv_cattle_four.cattle_four_goods_ref'; $WHERE_STATUS = ' AND inv_cattle_four.status = 1'; }else if ($ware_house_id == $BRANCH_NUM.'18202') { $sql_union="UNION SELECT cad_inventory_goods.productcost_type, inv_use_goods.goods_code, inv_use_goods.goods_ref AS goods, inv_unit.unit_name, inv_unit.unit_id, cad_inventory_goods.goods_name, cad_inventory_goods.type_id, inv_use_goods.goods_ref, inv_stock.qty FROM cad_inventory_goods INNER JOIN inv_use_goods ON inv_use_goods.goods_code = cad_inventory_goods.goods_code INNER JOIN inv_unit ON inv_unit.unit_id = inv_use_goods.unit_id INNER JOIN inv_stock ON inv_stock.goods_ref = inv_use_goods.goods_ref WHERE cad_inventory_goods.branch_num LIKE '$BRANCH_NUM' AND inv_stock.ware_house_id = '$ware_house_id' AND inv_stock.qty > 0 AND inv_stock.branch_num = '$BRANCH_NUM' AND SUBSTR(inv_use_goods.goods_ref, 7, 1) = 5 GROUP BY goods_ref ORDER BY goods"; $SELECT_GOODS = 'IF(inv_cattle_resection.hemisphere_id, inv_cattle_resection.hemisphere_id, inv_use_goods.goods_ref) AS goods_ref,'; $SELECT_QTY = '1 AS qty'; $JOIN = 'LEFT JOIN inv_cattle_resection ON inv_use_goods.goods_ref = inv_cattle_resection.goods_ref INNER JOIN inv_cattle_resection_head ON inv_cattle_resection.resection_bill_no = inv_cattle_resection_head.resection_bill_no'; $WHERE_STATUS = 'AND inv_cattle_resection.hemisphere_status = 1 AND inv_cattle_resection.use_status = 2 AND inv_cattle_resection_head.confirm_status = 2 AND inv_cattle_resection_head.fat_score_status = 2 AND SUBSTR(inv_use_goods.goods_ref, 7, 1) = 2'; }else if ($ware_house_id == $BRANCH_NUM.'18201') { $SELECT_GOODS = 'IF(inv_cattle_registration.cattle_id, inv_cattle_registration.cattle_id, inv_use_goods.goods_ref) AS goods_ref,'; $SELECT_QTY = 'IF(inv_cattle_registration.cattle_id, 1, inv_stock.qty) AS qty'; $JOIN = 'LEFT JOIN inv_cattle_registration ON inv_use_goods.goods_ref = inv_cattle_registration.goods_ref'; $WHERE_STATUS = ' AND inv_cattle_registration.cattle_status = 1'; }else{ $SELECT_GOODS = 'inv_use_goods.goods_ref,'; $SELECT_QTY = 'inv_stock.qty'; $JOIN = ''; $WHERE_STATUS = ''; } }else{ $SELECT_GOODS = 'inv_use_goods.goods_ref,'; $SELECT_QTY = 'inv_stock.qty'; $JOIN = ''; $WHERE_STATUS = ''; } $Sql = "SELECT cad_inventory_goods.productcost_type, inv_use_goods.goods_code, inv_use_goods.goods_ref AS goods, inv_unit.unit_name, inv_unit.unit_id, cad_inventory_goods.goods_name, cad_inventory_goods.type_id, $SELECT_GOODS $SELECT_QTY FROM cad_inventory_goods INNER JOIN inv_use_goods ON inv_use_goods.goods_code = cad_inventory_goods.goods_code INNER JOIN inv_unit ON inv_unit.unit_id = inv_use_goods.unit_id INNER JOIN inv_stock ON inv_stock.goods_ref = inv_use_goods.goods_ref $JOIN WHERE cad_inventory_goods.branch_num='$BRANCH_NUM' AND inv_use_goods.goods_ref = inv_stock.goods_ref AND inv_stock.ware_house_id = '$ware_house_id' AND inv_stock.branch_num = '$BRANCH_NUM' $WHERE_STATUS $sql_cond GROUP BY goods_ref $sql_union"; $ConPOST = "BRANCH_NUM=".$BRANCH_NUM ."&ware_house_id=".$ware_house_id; list($pagination,$exc,$total_pages) = $db->pagesplitJoinTable($PageShow,$Sql,$page,"page",$ConPOST,"intercode","targetpage"); $num_goods = $db->num_rows($exc); for ($j = 1;$j <= $num_goods;$j++) { $sty = $disp->chk_sty($sty); $res = $db->fetch_array($exc); unset($R); $R = $app->Fnc_Get_PT($res['goods'],$member_code); $Qty = number_format($res['qty'],2); $price = $app->FncGetPrice($res['goods'],1); if ($res['productcost_type'] == 2) { $close = "close_me();"; $open = "open_me_showdata('".$res['goods'] ."');"; }else { $close = ""; $open = ""; } $Qty_weight = ''; $goods_ref = $res['goods_ref']; if($use_cow == 1 &&$res['type_id'] == '182') { if ($ware_house_id == $BRANCH_NUM.'18202') { if (substr($res['goods'],6,1) == '2') { $resection = $db->get_data_rec("SELECT IF(fat_score_status = 2, fat_cold_weight, hemisphere) AS weight, hemisphere_id FROM inv_cattle_resection INNER JOIN inv_cattle_resection_head ON inv_cattle_resection.order_of_dissected = inv_cattle_resection_head.order_of_dissected WHERE hemisphere_id = '$res[goods_ref]' AND hemisphere_status = '1'"); $Qty = number_format($resection['weight'],2); $goods_ref = $resection['hemisphere_id']; if(empty($qty_resection)) { $Qty_weight = ''; }else{ $Qty_weight = $Qty; } } }else if ($ware_house_id == $BRANCH_NUM.'18203') { $cattle_four = $db->get_data_rec("SELECT weight, cattle_four_id FROM inv_cattle_four WHERE cattle_four_id = '$res[goods_ref]' AND status = '1'"); $Qty = number_format($cattle_four['weight'],2); $goods_ref = $cattle_four['cattle_four_id']; $Qty_weight = $Qty; }else if ($ware_house_id == $BRANCH_NUM.'18204') { $cattle_thoroughly = $db->get_data_rec("SELECT weight, cattle_thoroughly_id FROM inv_cattle_thoroughly WHERE cattle_thoroughly_id = '$res[goods_ref]' AND status = '1'"); $Qty = number_format($cattle_thoroughly['weight'],2); $goods_ref = $cattle_thoroughly['cattle_thoroughly_id']; $Qty_weight = $Qty; }else if ($ware_house_id == $BRANCH_NUM.'18205') { $cattle_trimming = $db->get_data_rec("SELECT weight, cattle_trimming_id FROM inv_cattle_trimming_detail WHERE cattle_trimming_id = '$res[goods_ref]' AND status = '1'"); $Qty = number_format($cattle_trimming['weight'],2); $goods_ref = $cattle_trimming['cattle_trimming_id']; $Qty_weight = $Qty; } } $productcost_id = $db->get_data_field("SELECT productcost_id FROM cad_inventory_organization WHERE branch_num = '$BRANCH_NUM' ","productcost_id"); if($productcost_id == 2){ $sql_lot = "SELECT lot_no FROM inv_fifo_lot_order WHERE goods_ref = '$res[goods_ref]' AND lot_order = (SELECT MIN(A.lot_order) FROM inv_fifo_lot_order A WHERE A.goods_ref = inv_fifo_lot_order.goods_ref) GROUP BY lot_order"; $fifo_lot = $db->get_data_rec($sql_lot); $sql_sum = "SELECT MIN(ware_house_id) AS ware_house, SUM(qty_cost) AS sum_qty FROM inv_fifo_lot_order WHERE goods_ref = '$res[goods_ref]' AND lot_no = '$fifo_lot[lot_no]' AND ware_house_id != '$ware_house_id' GROUP BY lot_no"; $fifo_sum = $db->get_data_rec($sql_sum); $sql_sum_lot = "SELECT SUM(qty_cost) AS sum_qty FROM inv_fifo_lot_order WHERE goods_ref = '$res[goods_ref]' AND ware_house_id = '$ware_house_id' -- AND lot_no = '$fifo_lot[lot_no]' AND lot_order <= (SELECT MIN(A.lot_order) FROM inv_fifo_lot_order A WHERE A.goods_ref = inv_fifo_lot_order.goods_ref AND A.ware_house_id != '$ware_house_id') -- GROUP BY lot_no GROUP BY goods_ref"; $fifo_sum_lot = $db->get_data_rec($sql_sum_lot); $sql_sell = "SELECT qty FROM temp_inv_sell_detail WHERE goods_ref LIKE '$res[goods_ref]' AND ic_session_id LIKE '$ic_session_id'"; $sell_qty = $db->get_data_rec($sql_sell); } ;echo ' '; }#end for ;echo '
ÃËÑÊÊÔ¹¤éÒ ª×èÍÊÔ¹¤éÒ Ë¹èǹѺ ÃÒ¤ÒµèÍ˹èÇ ¨Ó¹Ç¹¤§àËÅ×Í
';echo $goods_ref;;echo ' ';echo $res['goods_name'] ;echo ' ';echo $res['unit_name'];;echo ' ';echo number_format($price,2);;echo ' ';echo $Qty;;echo '
  ';echo $pagination;;echo '
';$db->close_db();