예제 #1
0
        public bool QueryItemData(string ItemBarCode, string PeriodBarCode, string PurchaseNo, out string Item, out string Period,
                                  out string Cost, out string Price, out string TaxType, out string PURCHASE_QTY,
                                  out string PLAN_ACCEPT_DATE, out string accept_qty, out string Qty,
                                  out string DIS_Qty)
        {
            //1.取得ITEM PERIOD商品基本資料
            Item = string.Empty;
            Period = string.Empty;
            Cost = string.Empty;
            Price = string.Empty;
            TaxType = string.Empty;
            PURCHASE_QTY = string.Empty;
            PLAN_ACCEPT_DATE = string.Empty;
            accept_qty = string.Empty;
            Qty = string.Empty;
            DIS_Qty = string.Empty;

            DataTable dtResult = new DataTable();
            try
            {
                DBO.MaintainAcceptDBO dbo = new DBO.MaintainAcceptDBO(ref USEDB);
                ArrayList QueryParameter = new ArrayList();
                QueryParameter.Clear();
                QueryParameter.Add(ItemBarCode);
                QueryParameter.Add(PeriodBarCode);
                QueryParameter.Add(PurchaseNo);
                dtResult = dbo.GetItemPeriod(QueryParameter);

                if (dtResult.Rows.Count > 0)
                {
                    Item = dtResult.Rows[0]["Item"].ToString();
                    Period = dtResult.Rows[0]["Period"].ToString();
                    Cost = dtResult.Rows[0]["Cost"].ToString();
                    Price = dtResult.Rows[0]["Price"].ToString();
                    TaxType = dtResult.Rows[0]["Tax_Type"].ToString();
                }
                else
                {
                    return false;
                }

                QueryParameter.Clear();
                QueryParameter.Add(Item);
                QueryParameter.Add(Period);
                QueryParameter.Add(PurchaseNo);
                dtResult = dbo.GetPurQtyDate(QueryParameter);

                if (dtResult.Rows.Count > 0)
                {
                    PURCHASE_QTY = dtResult.Rows[0]["PURCHASE_QTY"].ToString();
                    PLAN_ACCEPT_DATE = dtResult.Rows[0]["PLAN_ACCEPT_DATE"].ToString();
                }
                else
                {
                    return false;
                }

                dtResult = dbo.GetTotalPurQty(QueryParameter);

                if (dtResult.Rows.Count > 0)
                {
                    accept_qty = dtResult.Rows[0]["accept_qty"].ToString();
                }
                else
                {
                    //return false;
                    accept_qty = "0";
                }

                QueryParameter.Clear();
                QueryParameter.Add(Item);
                QueryParameter.Add(Period);
                dtResult = dbo.GetTotalDisQty(QueryParameter);

                if (dtResult.Rows.Count > 0)
                {
                    if (dtResult.Rows[0]["Qty"].ToString() == "")
                    {
                        Qty = "0";
                    }
                    else
                    {
                        Qty = dtResult.Rows[0]["Qty"].ToString();
                    }
                    if (dtResult.Rows[0]["DIS_Qty"].ToString() == "")
                    {
                        DIS_Qty = "0";
                    }
                    else
                    {
                        DIS_Qty = dtResult.Rows[0]["DIS_Qty"].ToString();
                    }
                }
                else
                {
                    //return false;
                    Qty = "0";
                    DIS_Qty = "0";
                }

                return true;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }