public string QueryPSSAdjCostAmt(string V_CLOSE_YN) { try { DBO.PSS051_DBO dbo = new PSS051_DBO(ref USEDB); return dbo.doQueryPSSAdjCostAmt(V_CLOSE_YN); } catch (Exception ex) { throw ex; } }
//【功能說明】:查詢進銷存通路彙總表 BY利潤中心查詢 //【傳入值】: //〔@結算年月〕//YYYMM找出當月的第一天(@FIRST_DAY)與(@LAST_DAY) //【回傳值】: //類別 //門市成本合計 //門市補帳成本合計 //門市調撥成本合計 //門市牌價合計 //門市補帳牌價合計 //門市調撥牌價合計 //入倉調整金額 //出倉調整金額 //期末存貨 //【主要TABLE】: //J=VDS_ALO_ST_ACCEPT_MAIN 門市進貨主檔 //K=VDS_ALO_ST_ACCEPT_ITEM門市進貨商品檔 //D=VDS_CGR_BACKWARD_MAIN門市退貨單主檔 //E=VDS_CGR_BACKWARD_DETL門市退貨單明細檔 //F=VDS_CAM_PATCH_MAIN 補帳單主檔 //G=VDS_CAM_PATCH_ITEM補帳單明細檔 //H=VDS_CAM_CUN_TRAN_MAIN門市調撥主檔 //I=VDS_CAM_CUN_TRAN_ITEM門市調撥明細檔 //M=VDS_PSS_MonthLedger 進銷存月結明細檔 //【關聯】: //1.門市進貨資料 //找出欄位: //SUM(NVL(K.ST_ACCEPT_QTY,0)*NVL(K.COST,0)) COST_SUM, //成本 //SUM(NVL(K.ST_ACCEPT_QTY,0)*NVL(K.COST_DIS,0)) COST_DIS_SUM//牌價 //關聯: //J.ST_ACCEPT_DATE BETWEEN (@FIRST_DAY) AND (@LAST_DAY) //J.ST_ACCEPT_NO = K.ST_ACCEPT_NO //2.門市退貨資料 //找出欄位: //SUM(NVL(E.BACKWARD_QTY,0)*NVL(E.COST,0)) COST_SUM, //成本SUM(NVL(E.BACKWARD_QTY,0)*NVL(E.COST_DIS,0)) COST_DIS_SUM //牌價 //關聯: //D.BACKWARD_DATE BETWEEN (@FIRST_DAY) AND (@LAST_DAY) // AND D.BACKWARD_NO = E.BACKWARD_NO //3.補帳進貨資料 //找出欄位: //SUM(NVL(G.PATCH_QTY,0)*NVL(G.COST,0)) PATCH_COST_SUM,//成本SUM(NVL(G.PATCH_QTY,0)*NVL(G.COST_DIS,0)) PATCH_COST_DIS_SUM//牌價 //關聯: //F.PATCH_DATE BETWEEN(@FIRST_DAY) AND (@LAST_DAY) AND F.PATCH_NO = G.PATCH_NO AND G.PATCH_QTY > 0 //4.補帳退貨資料 //找出欄位: //SUM(NVL(G.PATCH_QTY,0)*NVL(G.COST,0)*-1) PATCH_COST_SUM,//成本SUM(NVL(G.PATCH_QTY,0)*NVL(G.COST_DIS,0)*-1) PATCH_COST_DIS_SUM//牌價 //關聯: //F.PATCH_DATE BETWEEN(@FIRST_DAY) AND (@LAST_DAY) AND F.PATCH_NO = G.PATCH_NO AND G.PATCH_QTY < 0 //5.調撥資料//(24:進貨/25:退貨) //找出欄位: //ABS(SUM(NVL(I.ADJ_QTY,0)*NVL(I.COST,0))) TRAN_COST_SUM,//成本ABS(SUM(NVL(I.ADJ_QTY,0)*NVL(I.COST_DIS,0))) TRAN_COST_DIS_SUM//牌價 //關聯: //H.IN_ACCT_DATE BETWEEN (@FIRST_DAY) AND (@LAST_DAY) AND H.IN_ACCT_NO = I.IN_ACCT_NO //AND I.TRAN_SOURCE IN ('24','25') //GROUP BY I.TRAN_SOURCE; //6.從TABLE M=VDS_PSS_MonthLedger 進銷存月結明細檔,找出入倉調整金額、出倉調整金額、期末存貨 //找出欄位: //入倉調整金額=SUM(ADJ_IN_COST_AMT) //出倉調整金額=SUM(ADJ_OUT_COST_AMT) //期末存貨=SUM(END_COST_AMT) //關聯: //SUBSTR(START_DATE,1,6)=〔@結算年月〕 //【說明】: //1.傳入〔@結算年月〕於各交易檔查詢時以日期查詢,為〔@結算年月〕的第一天與〔@結算年月〕的最後一天作為查詢條件。 //2.皆group by profit_no(利潤中心)。 //3.調撥資料TRAN_SOURCE=24表示進貨資料,資料庫調撥數量存正值。TRAN_SOURCE=25表示退貨資料,資料庫調撥數量存負值。 //4.欄位說明 //區分=進貨、退貨、進貨-退貨 //類別= profit_no(利潤中心) //門市成本合計=門市進貨成本-門市退貨成本 //門市補帳成本合計=門市進貨補帳成本-門市退貨補帳成本 //門市調撥成本合計=門市調入成本-門市調出成本 //門市牌價合計=門市進貨牌價-門市退貨牌價 //門市補帳牌價合計=門市進貨補帳牌價-門市退貨補帳牌價 //門市調撥牌價合計=門市調入牌價-門市調出牌價 public DataTable QueryPSSRouteProfitRpt(string V_CLOSE_YN) { try { DBO.PSS051_DBO dbo = new PSS051_DBO(ref USEDB); return dbo.doQueryPSSRouteProfitRpt(V_CLOSE_YN); } catch (Exception ex) { throw ex; } }