예제 #1
0
        /// <summary>
        /// Add receipt item details
        /// </summary>
        /// <param name="streamWriter"></param>
        /// <param name="stockReceipt"></param>
        public void AddDetails(StreamWriter streamWriter, DataSet dataSet)
        {
            int i = 0;
            //Add header values
            int count  = dataSet.Tables[0].Columns.Count;
            int length = (count * 20) + count + 18;

            streamWriter.WriteLine("-" + report.AddLine(length));
            streamWriter.Write(" ");
            foreach (DataColumn dataColumn in dataSet.Tables[0].Columns)
            {
                streamWriter.Write(report.StringFormat(dataColumn.ColumnName, i == 0 ? 20 : 20, i <= 1 ? 2 : 1));
                i++;
            }
            streamWriter.Write("         Total    |");
            streamWriter.WriteLine(" ");
            streamWriter.WriteLine("-" + report.AddLine(length));
            foreach (DataRow item in dataSet.Tables[0].Rows)
            {
                i = 0;
                decimal Total  = 0;
                decimal dTotal = 0;
                streamWriter.Write(" ");
                for (int k = 0; k < count; k++)
                {
                    var result = report.StringFormatWithEmpty(Convert.ToString(item[k]));
                    if (i <= 1)
                    {
                        streamWriter.Write(report.StringFormat(result.Item1, i == 0 ? 20 : 20, i <= 1 ? 2 : 1));
                    }
                    else
                    {
                        dTotal = result.Item2 == true?Convert.ToDecimal(result.Item1) : 0;

                        Total = Total + dTotal;
                        streamWriter.Write(report.StringFormat(report.DecimalformatForWeight(Convert.ToString(dTotal)), i == 0 ? 20 : 20, i <= 1 ? 2 : 1));
                    }
                    i++;
                }
                //Total
                streamWriter.Write(report.StringFormat(report.DecimalformatForWeight(Convert.ToString(Total)), 18, 1));
                streamWriter.WriteLine(" ");
            }
            streamWriter.WriteLine("-" + report.AddLine(length));
            streamWriter.WriteLine((char)12);
        }
예제 #2
0
        /// <summary>
        /// Add receipt item details
        /// </summary>
        /// <param name="streamWriter"></param>
        /// <param name="stockReceipt"></param>
        public void AddDetails(StreamWriter streamWriter, DataSet dataSet, int reportType)
        {
            int i = 0;
            //Add header values
            int count  = dataSet.Tables[0].Columns.Count;
            int length = 0;

            length = (count * 16) + count;
            streamWriter.WriteLine("---" + report.AddLine(length));
            streamWriter.Write(" ");
            int vad = (reportType == 0 && i < 2) || ((reportType == 1 && i < 3)) ? 2 : 1;

            foreach (DataColumn dataColumn in dataSet.Tables[0].Columns)
            {
                streamWriter.Write(report.StringFormat(dataColumn.ColumnName, 16, (reportType == 0 && i < 2) || ((reportType == 1 && i < 3)) ? 2 : 1));
                i++;
            }
            streamWriter.Write("       Total  |");
            streamWriter.WriteLine(" ");
            streamWriter.WriteLine("---" + report.AddLine(length));
            foreach (DataRow item in dataSet.Tables[0].Rows)
            {
                i = 0;
                decimal Total = 0;
                streamWriter.Write(" ");
                for (int k = 0; k < count; k++)
                {
                    var result = report.StringFormatWithEmpty(Convert.ToString(item[k]));
                    streamWriter.Write(report.StringFormat(result.Item1, 16, (reportType == 0 && i < 2) || ((reportType == 1 && i < 3)) ? 2 : 1));
                    if (i > 0)
                    {
                        Total = Total + (result.Item2 == true ? Convert.ToDecimal(result.Item1) : 0);
                    }
                    i++;
                }
                //Total
                streamWriter.Write(report.StringFormat(Convert.ToString(Total), 15, 1));
                streamWriter.WriteLine(" ");
            }
            streamWriter.WriteLine("---" + report.AddLine(length));
        }
예제 #3
0
        /// <summary>
        /// Add receipt item details
        /// </summary>
        /// <param name="streamWriter"></param>
        /// <param name="stockReceipt"></param>
        public void AddDetails(StreamWriter streamWriter, DataSet dataSet, int type)
        {
            int i = 0;
            //Add header values
            int count  = dataSet.Tables[0].Columns.Count;
            int length = (count * 12) + count + 20 + 6;

            streamWriter.WriteLine("-" + report.AddLine(length));
            streamWriter.Write(" ");
            foreach (DataColumn dataColumn in dataSet.Tables[0].Columns)
            {
                streamWriter.Write(report.StringFormat(dataColumn.ColumnName, i == 0 ? 20 : i > 0 && i <= 2 ? 15 : 12, i <= 2 ? 2 : 1));
                i++;
            }
            streamWriter.Write("    Total   |");
            streamWriter.WriteLine(" ");
            streamWriter.WriteLine("-" + report.AddLine(length));
            foreach (DataRow item in dataSet.Tables[0].Rows)
            {
                i = 0;
                decimal Total  = 0;
                decimal dTotal = 0;
                streamWriter.Write(" ");
                for (int k = 0; k < count; k++)
                {
                    var result = report.StringFormatWithEmpty(Convert.ToString(item[k]));
                    if (i <= 2 && type == 0)
                    {
                        streamWriter.Write(report.StringFormat(result.Item1, i == 0 ? 20 : i > 0 && i <= 2 ? 15 : 12, i <= 2 ? 2 : 1));
                    }
                    else if (i <= 3 && type == 1)
                    {
                        streamWriter.Write(report.StringFormat(result.Item1, i == 0 ? 20 : i > 0 && i <= 2 ? 15 : 12, i <= 3 ? 2 : 1));
                    }
                    else if (i <= 1 && type == 2)
                    {
                        streamWriter.Write(report.StringFormat(result.Item1, i == 0 ? 20 : i > 0 && i <= 1 ? 15 : 12, i <= 1 ? 2 : 1));
                    }

                    if (i > 2 && type == 0)
                    {
                        dTotal = (result.Item2 == true ? Convert.ToDecimal(result.Item1) : 0);
                        Total  = Total + dTotal;
                        streamWriter.Write(report.StringFormat(report.DecimalformatForWeight(Convert.ToString(dTotal)), i == 0 ? 20 : i > 0 && i <= 2 ? 15 : 12, i <= 2 ? 2 : 1));
                    }
                    else if (i > 3 && type == 1)
                    {
                        dTotal = (result.Item2 == true ? Convert.ToDecimal(result.Item1) : 0);
                        Total  = Total + dTotal;
                        streamWriter.Write(report.StringFormat(report.DecimalformatForWeight(Convert.ToString(dTotal)), i == 0 ? 20 : i > 0 && i <= 2 ? 15 : 12, i <= 3 ? 2 : 1));
                    }
                    else if (i > 1 && type == 2)
                    {
                        dTotal = (result.Item2 == true ? Convert.ToDecimal(result.Item1) : 0);
                        Total  = Total + dTotal;
                        streamWriter.Write(report.StringFormat(report.DecimalformatForWeight(Convert.ToString(dTotal)), i == 0 ? 20 : i > 0 && i <= 2 ? 15 : 12, i <= 1 ? 2 : 1));
                    }
                    i++;
                }
                //Total
                streamWriter.Write(report.StringFormat(report.DecimalformatForWeight(Convert.ToString(Total)), 12, 1));
                streamWriter.WriteLine(" ");
            }
            streamWriter.WriteLine("-" + report.AddLine(length));
        }
예제 #4
0
        /// <summary>
        /// Add receipt item details
        /// </summary>
        /// <param name="streamWriter"></param>
        /// <param name="stockIssuesEntity"></param>
        private void AddDetails(StreamWriter streamWriter, List <StackCardEntity> stackCardEntities)
        {
            int    i = 1;
            string Fromdate = string.Empty;
            string Todate = string.Empty;
            string TotalReceiptBags = string.Empty, TotalIssuesBags = string.Empty;
            string TotalReceiptQuantity = string.Empty, TotalIssuesQuantity = string.Empty;

            foreach (var item in stackCardEntities)
            {
                if (i == 1)
                {
                    Fromdate = item.AckDate;
                }

                if (item.AckDate == "Total")
                {
                    streamWriter.WriteLine("----|--------------------------------|-----------------------------------------|");
                    streamWriter.Write(report.StringFormatWithoutPipe(item.AckDate, 15, 1));
                    streamWriter.Write(report.StringFormatWithoutPipe(report.StringFormatWithEmpty(item.ReceiptBags).Item1, 5, 1));
                    streamWriter.Write(report.StringFormat(report.StringFormatWithEmpty(item.ReceiptQuantity).Item1, 15, 1));
                    streamWriter.Write(report.StringFormatWithoutPipe(report.StringFormatWithEmpty(item.IssuesBags).Item1, 5, 2));
                    streamWriter.Write(report.StringFormatWithoutPipe(report.StringFormatWithEmpty(item.IssuesQuantity).Item1, 15, 1));
                    streamWriter.Write(report.StringFormat(report.StringFormatWithEmpty(item.ClosingBalance).Item1, 19, 1));
                    streamWriter.WriteLine(" ");
                    streamWriter.WriteLine("-------------------------------------------------------------------------------|");
                    TotalReceiptBags     = item.ReceiptBags;
                    TotalIssuesBags      = item.IssuesBags;
                    TotalReceiptQuantity = item.ReceiptQuantity;
                    TotalIssuesQuantity  = item.IssuesQuantity;
                    break;
                }
                Todate = item.AckDate;
                streamWriter.Write(report.StringFormat(i.ToString(), 4, 1));
                streamWriter.Write(report.StringFormatWithoutPipe(report.FormatDirectDate(item.AckDate), 10, 1));
                streamWriter.Write(report.StringFormatWithoutPipe(report.StringFormatWithEmpty(item.ReceiptBags).Item1, 5, 1));
                streamWriter.Write(report.StringFormat(report.StringFormatWithEmpty(item.ReceiptQuantity).Item1, 15, 1));
                streamWriter.Write(report.StringFormatWithoutPipe(report.StringFormatWithEmpty(item.IssuesBags).Item1, 5, 1));
                streamWriter.Write(report.StringFormatWithoutPipe(report.StringFormatWithEmpty(item.IssuesQuantity).Item1, 15, 1));
                streamWriter.Write(report.StringFormat(report.StringFormatWithEmpty(item.ClosingBalance).Item1, 19, 1));
                streamWriter.WriteLine(" ");

                i = i + 1;
            }
            streamWriter.WriteLine(" ");
            streamWriter.WriteLine("                                                Bags     Quantity");
            streamWriter.WriteLine("-------------------------------------------------------------------------------|");
            streamWriter.Write("                                  Total Receipt   ");
            streamWriter.Write(report.StringFormatWithoutPipe(TotalReceiptBags, 8, 2));
            streamWriter.Write(report.StringFormatWithoutPipe(TotalReceiptQuantity, 13, 2));
            streamWriter.WriteLine("");
            streamWriter.Write("                                  Total Issues    ");
            streamWriter.Write(report.StringFormatWithoutPipe(TotalIssuesBags, 8, 2));
            streamWriter.Write(report.StringFormatWithoutPipe(TotalIssuesQuantity, 13, 2));
            streamWriter.WriteLine("");
            streamWriter.WriteLine("-------------------------------------------------------------------------------|");
            streamWriter.Write("                                       Balance    ");
            streamWriter.Write(report.StringFormatWithoutPipe(GetDifference(TotalReceiptBags, TotalIssuesBags, 1), 8, 2));
            streamWriter.Write(report.StringFormatWithoutPipe(GetDifference(TotalReceiptQuantity, TotalIssuesQuantity, 2), 13, 2));
            streamWriter.WriteLine("");
            streamWriter.WriteLine("-------------------------------------------------------------------------------|");
            streamWriter.WriteLine("-------------------------------------------------------------------------------|");
            streamWriter.WriteLine("                                  FROM DATE    TODATE     TOTAL DAYS");
            streamWriter.Write("                Period of Storage ");
            streamWriter.Write(report.StringFormatWithoutPipe(report.FormatDirectDate(Fromdate), 12, 2));
            streamWriter.Write(report.StringFormatWithoutPipe(report.FormatDirectDate(Todate), 12, 2));
            streamWriter.Write(report.StringFormatWithoutPipe(report.GetDays(Fromdate, Todate), 12, 2));
            streamWriter.WriteLine("");
            streamWriter.WriteLine("-------------------------------------------------------------------------------|");
            streamWriter.WriteLine((char)12);
        }