コード例 #1
0
ファイル: YearEnd.cs プロジェクト: tomanye/facility
        public Int64 GetBBalanceAll(int year, int itemId)
        {
            this.FlushData();
            Int64 bb = 0;

            this.LoadFromRawSql(String.Format("Select * from YearEnd where ItemID = {0} AND Year = {1}", itemId, year));
            if (this.DataTable.Rows.Count > 0)
            {
                bb = Convert.ToInt64(this.DataTable.Rows[0]["PhysicalInventory"]);
            }
            else
            {
                this.LoadFromRawSql(String.Format("Select * from YearEnd where ItemID = {0} AND Year = {1}", itemId,
                                                  year - 1));
                if (this.DataTable.Rows.Count > 0)
                {
                    bb = Convert.ToInt64(this.DataTable.Rows[0]["PhysicalInventory"]);
                }
                else if (((year + 8) > DateTime.Now.Year)) // to check if it is different year from current
                {
                    Int64      cons = 0;
                    IssueDoc   iss  = new IssueDoc();
                    ReceiveDoc rec  = new ReceiveDoc();
                    Disposal   dis  = new Disposal();

                    if ((year + 8) > DateTime.Now.Year) // to check if it is hamle and Nehase
                    {
                        year = year - 1;
                    }
                    int month = 10;
                    cons = (rec.GetReceivedQuantityTillMonthAll(itemId, month, year) +
                            dis.GetAdjustedQuantityTillMonthAll(itemId, month, year) -
                            iss.GetIssuedQuantityTillMonthAll(itemId, month, year) -
                            dis.GetLossesQuantityTillMonthAll(itemId, month, year));
                    bb = cons;
                }
            }
            return(bb);
        }
コード例 #2
0
 public Int64 GetSOHAll(int itemId, int month, int year)
 {
     //ask by normal u get soh on normal month
     IssueDoc iss = new IssueDoc();
     ReceiveDoc rec = new ReceiveDoc();
     Disposal dis = new Disposal();
     YearEnd yEnd = new YearEnd();
     Int64 cons = 0;
     cons = (yEnd.GetBBalanceAll(year, itemId) + rec.GetReceivedQuantityTillMonthAll(itemId, month, year) + dis.GetAdjustedQuantityTillMonthAll(itemId, month, year) - iss.GetIssuedQuantityTillMonthAll(itemId, month, year) - dis.GetLossesQuantityTillMonthAll(itemId, month, year));
     this.FlushData();
     return cons;
 }
コード例 #3
0
        public Int64 GetBBalanceAll(int year, int itemId)
        {
            this.FlushData();
            Int64 bb = 0;
            this.LoadFromRawSql(String.Format("Select * from YearEnd where ItemID = {0} AND Year = {1}", itemId, year));
            if (this.DataTable.Rows.Count > 0)
            {
                bb = Convert.ToInt64(this.DataTable.Rows[0]["PhysicalInventory"]);
            }
            else
            {
                this.LoadFromRawSql(String.Format("Select * from YearEnd where ItemID = {0} AND Year = {1}", itemId,
                                                  year - 1));
                if (this.DataTable.Rows.Count > 0)
                {
                    bb = Convert.ToInt64(this.DataTable.Rows[0]["PhysicalInventory"]);
                }
                else if (((year + 8) > DateTime.Now.Year)) // to check if it is different year from current
                {
                    Int64 cons = 0;
                    IssueDoc iss = new IssueDoc();
                    ReceiveDoc rec = new ReceiveDoc();
                    Disposal dis = new Disposal();

                    if ((year + 8) > DateTime.Now.Year) // to check if it is hamle and Nehase
                        year = year - 1;
                    int month = 10;
                    cons = (rec.GetReceivedQuantityTillMonthAll(itemId, month, year) +
                            dis.GetAdjustedQuantityTillMonthAll(itemId, month, year) -
                            iss.GetIssuedQuantityTillMonthAll(itemId, month, year) -
                            dis.GetLossesQuantityTillMonthAll(itemId, month, year));
                    bb = cons;
                }
            }
            return bb;
        }