示例#1
0
        private decimal PurQty(string txType, string type)
        {
            decimal result = 0, totalREC = 0, totalREJ = 0;

            if (type == "M")
            {
                type = "AND YEAR(TxDate) = " + DateTime.Now.Year.ToString() + " AND MONTH(TxDate) = " + DateTime.Now.Month.ToString();
            }
            else
            {
                type = "AND YEAR(TxDate) = " + DateTime.Now.Year.ToString();
            }

            string sql = "ProductId = '" + this.ProductId.ToString() + "' AND TxType IN (" + txType + ")" + type;
            InvtLedgerDetailsCollection oDetails = InvtLedgerDetails.LoadCollection(sql);

            for (int i = 0; i < oDetails.Count; i++)
            {
                switch (oDetails[i].TxType)
                {
                case "REJ":
                    totalREJ += oDetails[i].Qty;
                    break;

                case "REC":
                case "CAP":
                    totalREC += oDetails[i].Qty;
                    break;
                }
            }

            result = totalREC - totalREJ;

            return(result);
        }
示例#2
0
        /// <summary>
        /// Loads a collection of InvtLedgerDetails objects from the database.
        /// </summary>
        /// <returns>A collection containing all of the InvtLedgerDetails objects in the database.</returns>
        public static InvtLedgerDetailsCollection LoadCollection(string spName, SqlParameter[] parms)
        {
            InvtLedgerDetailsCollection result = new InvtLedgerDetailsCollection();

            using (SqlDataReader reader = SqlHelper.Default.ExecuteReader(spName, parms))
            {
                while (reader.Read())
                {
                    InvtLedgerDetails tmp = new InvtLedgerDetails();
                    tmp.LoadFromReader(reader);
                    result.Add(tmp);
                }
            }
            return(result);
        }