Ejemplo n.º 1
0
 /// <summary>
 /// Add header for date wise report
 /// </summary>
 /// <param name="sw"></param>
 /// <param name="date"></param>
 public void AddHeaderForDateWise(StreamWriter sw, string date)
 {
     sw.WriteLine("                                  TAMILNADU CIVIL SUPPLIES CORPORATION                      Report Date :   " + ManageReport.GetCurrentDate());
     sw.WriteLine(" ");
     sw.WriteLine("                                          Stock Issue Register");
     sw.WriteLine(" ");
     sw.WriteLine("Issue Date:" + report.FormatDirectDate(date) + "  (Net Wt in kgs\\Klts\\Nos)     Godown : " + GName + "          Region :" + RName);
     sw.WriteLine("---------------------------------------------------------------------------------------------------------------------------------------------");
     sw.WriteLine("S.No Issue Memo  D.No        Lorry No   To Whom Issued                    Scheme       StackNo      No bags  Commodity               Net wt  ");
     sw.WriteLine("---------------------------------------------------------------------------------------------------------------------------------------------");
     sw.WriteLine("");
 }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sw"></param>
        /// <param name="entity"></param>
        public void DateWiseCommodityIssueMemoReport(StreamWriter sw, CommonEntity entity)
        {
            try
            {
                int count = 8;
                int i     = 1;
                AddHeader(sw, entity);
                decimal TotalAmount = 0;
                foreach (DataRow row in entity.dataSet.Tables[0].Rows)
                {
                    if (count >= 50)
                    {
                        //Add header again
                        count = 8;
                        sw.WriteLine("------------------------------------------------------------------------------------------------------------------------------------------------------------");
                        sw.WriteLine((char)12);
                        AddHeader(sw, entity);
                    }
                    sw.Write(report.StringFormatWithoutPipe(row["GodownName"].ToString(), 25, 2));

                    sw.Write(report.StringFormatWithoutPipe(row["Coop"].ToString(), 33, 2));
                    sw.Write(report.StringFormatWithoutPipe(row["Dono"].ToString(), 10, 2));
                    sw.Write(report.StringFormatWithoutPipe(report.FormatDirectDate(row["Dodate"].ToString()), 10, 2));
                    sw.Write(report.StringFormatWithoutPipe(row["Comodity"].ToString(), 26, 2));
                    sw.Write(report.StringFormatWithoutPipe(row["Scheme"].ToString(), 12, 2));
                    sw.Write(report.StringFormatWithoutPipe(report.DecimalformatForWeight(row["Quantity"].ToString()), 12, 1) + "    ");
                    sw.Write(report.StringFormatWithoutPipe(report.Decimalformat(row["Rate"].ToString()), 6, 1) + " ");
                    sw.Write(report.StringFormatWithoutPipe(report.Decimalformat(row["Amount"].ToString()), 10, 1));
                    sw.WriteLine("");
                    TotalAmount += Convert.ToDecimal(report.Decimalformat(row["Amount"].ToString()));
                    i            = i + 1;
                    count        = count + 1;
                }
                sw.WriteLine("------------------------------------------------------------------------------------------------------------------------------------------------------------");
                sw.Write(report.StringFormatWithoutPipe(" ", 33, 2));
                sw.Write(report.StringFormatWithoutPipe(" ", 35, 2));
                sw.Write(report.StringFormatWithoutPipe(" ", 10, 2));
                sw.Write(report.StringFormatWithoutPipe(" ", 26, 2));
                sw.Write(report.StringFormatWithoutPipe(" ", 12, 2));
                sw.Write(report.StringFormatWithoutPipe(" ", 12, 1) + "    ");
                sw.Write(report.StringFormatWithoutPipe(report.Decimalformat(TotalAmount.ToString()), 18, 1));
                sw.WriteLine("");
                sw.WriteLine("------------------------------------------------------------------------------------------------------------------------------------------------------------");
                sw.WriteLine((char)12);
            }
            catch (Exception ex)
            {
                AuditLog.WriteError(ex.Message);
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sw"></param>
 /// <param name="entity"></param>
 public void DateWiseCommodityIssueMemoReport(StreamWriter sw, CommonEntity entity)
 {
     try
     {
         int count = 10;
         int i     = 1;
         AddHeader(sw, entity);
         decimal TotalAmount = 0;
         foreach (DataRow row in entity.dataSet.Tables[0].Rows)
         {
             if (count >= 50)
             {
                 //Add header again
                 count = 11;
                 sw.WriteLine("-----------------------------------------------------------------------------------------------------------------------------------------------------");
                 sw.WriteLine((char)12);
                 AddHeader(sw, entity);
             }
             sw.Write(" ");
             sw.Write(report.StringFormatWithoutPipe(i.ToString(), 4, 2));
             sw.Write(report.StringFormatWithoutPipe(row["ReceivedFrom"].ToString(), 40, 2));
             sw.Write(report.StringFormatWithoutPipe(row["ReceiptNo"].ToString(), 11, 2));
             sw.Write(report.StringFormatWithoutPipe(report.FormatDirectDate(row["Date"].ToString()), 10, 2));
             sw.Write(report.StringFormatWithoutPipe(row["PaymentType"].ToString(), 3, 2));
             sw.Write(report.StringFormatWithoutPipe(row["DDNo"].ToString(), 15, 2));
             sw.Write(report.StringFormatWithoutPipe(row["DDDate"].ToString(), 10, 1));
             sw.Write(report.StringFormatWithoutPipe(report.Decimalformat(row["Amount"].ToString()), 15, 1));
             sw.Write(report.StringFormatWithoutPipe(row["Bank"].ToString(), 32, 2));
             sw.WriteLine("");
             TotalAmount += Convert.ToDecimal(report.Decimalformat(row["Amount"].ToString()));
             i            = i + 1;
             count        = count + 1;
         }
         sw.WriteLine("-----------------------------------------------------------------------------------------------------------------------------------------------------");
         sw.Write("                                                                TOTAL AMOUNT                       ");
         sw.Write(report.StringFormatWithoutPipe(report.Decimalformat(TotalAmount.ToString()), 15, 1));
         sw.WriteLine("");
         sw.WriteLine("-----------------------------------------------------------------------------------------------------------------------------------------------------");
         sw.WriteLine((char)12);
     }
     catch (Exception ex)
     {
         AuditLog.WriteError(ex.Message);
     }
 }
Ejemplo n.º 4
0
        ///</summary>
        ///
        /// <param name="sw"></param>
        /// <param name="entity"></param>
        public void DateWiseHullingDetails(StreamWriter sw, CommonEntity entity)
        {
            int    iCount          = 11;
            int    i               = 1;
            string SRNO            = string.Empty;
            bool   isDataAvailable = false;

            // foreach (DataRow dateValue in distinctDate.Rows)
            //{
            isDataAvailable = true;
            AddHeader(sw, entity);
            // DataRow[] datas = entity.dataSet.Tables[0].Select("HullingReportDate='" + dateValue["HullingReportDate"] + "'");
            foreach (DataRow dr in entity.dataSet.Tables[0].Rows)
            {
                if (iCount >= 50)
                {
                    iCount = 11;
                    sw.WriteLine("------------------------------------------------------------------------------------------------------------------------------------------|");
                    sw.WriteLine((char)12);
                    AddHeader(sw, entity);
                }
                //sIssuer = Convert.ToString(dr["DepositorName"]).Trim();
                sw.Write(report.StringFormatWithoutPipe(i.ToString(), 4, 2));
                sw.Write(report.StringFormatWithoutPipe(dr["SRNo"].ToString(), 18, 2));
                sw.Write(report.StringFormatWithoutPipe(report.FormatDirectDate(dr["SRDate"].ToString()), 16, 2));
                sw.Write(report.StringFormatWithoutPipe(Convert.ToString(dr["DepositorName"]).Trim(), 37, 2));
                sw.Write(report.StringFormatWithoutPipe(dr["ITDescription"].ToString(), 26, 2));
                sw.Write(report.StringFormatWithoutPipe(dr["NoPacking"].ToString(), 12, 1));
                sw.Write(report.StringFormatWithoutPipe(dr["Nkgs"].ToString(), 19, 1));
                sw.WriteLine("");
                sw.WriteLine(" ");
                i = i + 1;
                iCount++;
            }
            sw.WriteLine("------------------------------------------------------------------------------------------------------------------------------------------|");
            sw.WriteLine((char)12);
            if (!isDataAvailable)
            {
                sw.WriteLine("---------------------------------------------------------------------------------------------------------------------------------------|");
                sw.WriteLine((char)12);
            }
        }
Ejemplo n.º 5
0
        public List <StackCardRegisterEntity> ManageStackCardRegister(DataSet dataSet, StackEntity stackEntity)
        {
            try
            {
                ManageReport report = new ManageReport();
                List <StackCardRegisterEntity> stackCardEntities = new List <StackCardRegisterEntity>();
                DataTable dtIssues   = new DataTable();
                DataTable dtReceipt  = new DataTable();
                DataTable dtObStack  = new DataTable();
                DataTable dtWriteOFF = new DataTable();
                //DateTime fDate = default(DateTime);
                //DateTime SDate = default(DateTime);
                ManageSQLConnection manageSQLConnection = new ManageSQLConnection();
                if (dataSet.Tables.Count > 1)
                {
                    dtIssues   = dataSet.Tables[0];
                    dtReceipt  = dataSet.Tables[1];
                    dtObStack  = dataSet.Tables[2];
                    dtWriteOFF = dataSet.Tables[3];
                    string sStackCard = string.Empty;
                    string sCommodity = string.Empty;
                    foreach (DataRow item in dtObStack.Rows)
                    {
                        StackCardRegisterEntity stackCardRegister = new StackCardRegisterEntity();
                        sStackCard = Convert.ToString(item["StockNo"]);
                        sCommodity = Convert.ToString(item["Commodity"]);
                        //Filter particular stack card only
                        DataRow[] dataRowsIssues   = dtIssues.Select("StockNo = '" + sStackCard + "' and Commodity='" + sCommodity + "'");
                        DataRow[] dataRowsReceipt  = dtReceipt.Select("StockNo = '" + sStackCard + "' and Commodity='" + sCommodity + "'");
                        DataRow[] dataRowsWriteOff = dtWriteOFF.Select("StockNo = '" + sStackCard + "' and Commodity='" + sCommodity + "'");

                        List <KeyValuePair <string, string> > sqlParameters = new List <KeyValuePair <string, string> >();
                        sqlParameters.Add(new KeyValuePair <string, string>("@GodownCode", stackEntity.GCode));
                        sqlParameters.Add(new KeyValuePair <string, string>("@StacKNo", sStackCard));
                        sqlParameters.Add(new KeyValuePair <string, string>("@ShortYear", stackEntity.StackDate));
                        DataSet dsGUGR = manageSQLConnection.GetDataSetValues("GetGUGRbyStackNo", sqlParameters);

                        stackCardRegister.StackCard  = sStackCard;
                        stackCardRegister.Commodity  = sCommodity;
                        stackCardRegister.OpeningBag = Convert.ToString(item["NoPacking"]);
                        stackCardRegister.OpeningQty = Convert.ToString(item["TOTAL"]);

                        if (dsGUGR.Tables.Count > 1)
                        {
                            if (dsGUGR.Tables[0].Rows.Count > 0) //GU
                            {
                                stackCardRegister.GU = Convert.ToString(dsGUGR.Tables[0].Rows[0]["NoPacking"]);
                            }
                            else
                            {
                                stackCardRegister.GU = "0";
                            }
                            if (dsGUGR.Tables[1].Rows.Count > 0) //GR
                            {
                                stackCardRegister.GR = Convert.ToString(dsGUGR.Tables[1].Rows[0]["NoPacking"]);
                            }
                            else
                            {
                                stackCardRegister.GR = "0";
                            }
                            if (dsGUGR.Tables[2].Rows.Count > 0) //StackDate and Status
                            {
                                stackCardRegister.FromDate    = report.FormatDirectDate(Convert.ToString(dsGUGR.Tables[2].Rows[0]["ObStackDate"]));
                                stackCardRegister.ToDate      = report.FormatDirectDate(Convert.ToString(dsGUGR.Tables[2].Rows[0]["ClsStackDate"]));
                                stackCardRegister.StackStatus = Convert.ToString(dsGUGR.Tables[2].Rows[0]["Status"]);
                            }
                        }

                        if (dataRowsReceipt != null && dataRowsReceipt.Count() > 0)
                        {
                            stackCardRegister.ReceiptBag = Convert.ToString(dataRowsReceipt[0]["NoPacking"]);
                            stackCardRegister.ReceiptQty = Convert.ToString(dataRowsReceipt[0]["TOTAL"]);
                        }
                        else
                        {
                            stackCardRegister.ReceiptBag = "0";
                            stackCardRegister.ReceiptQty = "0";
                        }

                        if (dataRowsIssues != null && dataRowsIssues.Count() > 0)
                        {
                            stackCardRegister.IssuesBag = Convert.ToString(dataRowsIssues[0]["NoPacking"]);
                            stackCardRegister.IssuesQty = Convert.ToString(dataRowsIssues[0]["TOTAL"]);
                        }
                        else
                        {
                            stackCardRegister.IssuesBag = "0";
                            stackCardRegister.IssuesQty = "0";
                        }

                        if (dataRowsWriteOff != null && dataRowsWriteOff.Count() > 0)
                        {
                            stackCardRegister.WriteOff = Convert.ToString(dataRowsWriteOff[0]["TOTAL"]);
                        }
                        else
                        {
                            stackCardRegister.WriteOff = "0";
                        }

                        //Balance
                        int totalReceiptBag = Convert.ToInt32(stackCardRegister.OpeningBag) + Convert.ToInt32(stackCardRegister.ReceiptBag) + Convert.ToInt32(stackCardRegister.GU);
                        int totalIssuesBag  = Convert.ToInt32(stackCardRegister.IssuesBag) + Convert.ToInt32(stackCardRegister.GR);

                        decimal totalReceiptQty = Convert.ToDecimal(stackCardRegister.OpeningQty) + Convert.ToDecimal(stackCardRegister.ReceiptQty);
                        decimal totalIssuesQty  = Convert.ToDecimal(stackCardRegister.IssuesQty);

                        stackCardRegister.BalanceBag = Convert.ToString(totalReceiptBag - totalIssuesBag);
                        stackCardRegister.BalanceQty = Convert.ToString(totalReceiptQty - totalIssuesQty);
                        stackCardEntities.Add(stackCardRegister);
                    }
                }
                // AuditLog.WriteError("Print start");
                StackCardRegisterPrint stackCardRegisterPrint = new StackCardRegisterPrint();
                Task.Run(() => stackCardRegisterPrint.GenerateStackCardRegister(stackCardEntities, stackEntity));
                //AuditLog.WriteError("Print End");
                return(stackCardEntities);
            }
            catch (Exception ex)
            {
                AuditLog.WriteError("ManageStackBalance : " + ex.Message + " " + ex.StackTrace);
                return(null);
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Write the Sales Customer Details
        /// </summary>
        /// <param name="sw"></param>
        /// <param name="entity"></param>
        public void WriteHoPurchase(StreamWriter sw, CommonEntity entity)
        {
            int iCount            = 10;
            var distinctCoop      = entity.dataSet.Tables[0].DefaultView.ToTable(true, "Depositor");
            var distinctCommodity = entity.dataSet.Tables[0].DefaultView.ToTable(true, "Commodity");
            //var distinctCommodity = entity.dataSet.Tables[0].DefaultView.ToTable(true, "Commodity");
            int     i          = 1;
            string  sAckno     = string.Empty;
            string  sDepositor = string.Empty;
            string  sCommodity = string.Empty;
            decimal dTotal     = 0;
            decimal gTotal     = 0;
            bool    dAvailable = false;

            AddHeaderForHoPurchase(sw, entity);

            foreach (DataRow CommodityValue in distinctCommodity.Rows)
            {
                gTotal = 0;
                foreach (DataRow dateValue in distinctCoop.Rows)
                {
                    dAvailable = false;
                    iCount     = 11;
                    bool CheckRepeatValue = false;
                    sAckno     = string.Empty;
                    sDepositor = string.Empty;
                    DataRow[] datas = entity.dataSet.Tables[0].Select("Depositor='" + dateValue["Depositor"] + "' and Commodity='" + CommodityValue["Commodity"] + "'");

                    foreach (var item in datas)
                    {
                        dAvailable = true;
                        if (iCount >= 50)
                        {
                            //Add header again
                            iCount = 11;
                            sw.WriteLine("-------------------------------------------------------------------------------------------------------------------------------------------------------------|");
                            sw.WriteLine((char)12);
                            AddHeaderForHoPurchase(sw, entity);
                        }
                        sDepositor = Convert.ToString(item["Depositor"]);
                        if (sAckno == sDepositor)
                        {
                            CheckRepeatValue = true;
                        }
                        else
                        {
                            CheckRepeatValue = false;
                            sAckno           = sDepositor;
                        }
                        sw.Write(report.StringFormatWithoutPipe(i.ToString(), 4, 2));
                        sw.Write(report.StringFormatWithoutPipe(item["Ackno"].ToString(), 11, 2));
                        sw.Write(report.StringFormatWithoutPipe(report.FormatDirectDate(item["Date"].ToString()), 10, 2));
                        sw.Write(report.StringFormatWithoutPipe(CheckRepeatValue == false ? sDepositor : " ", 35, 2));
                        sw.Write(report.StringFormatWithoutPipe(item["Commodity"].ToString(), 27, 2));
                        sw.Write(report.StringFormatWithoutPipe(item["Bags"].ToString(), 6, 1));
                        sw.Write(report.StringFormatWithoutPipe(report.DecimalformatForWeight(item["Quantity"].ToString()), 14, 1));
                        sw.Write(report.StringFormatWithoutPipe((item["TruckMen"].ToString()), 16, 2));
                        sw.Write(report.StringFormatWithoutPipe((item["orderno"].ToString()), 14, 2));
                        sw.Write(report.StringFormatWithoutPipe((item["Lorryno"].ToString()), 13, 2));
                        sw.WriteLine("");
                        iCount  = iCount + 1;
                        dTotal += Convert.ToDecimal(item["Quantity"].ToString());
                        // gTotal += Convert.ToDecimal(item["Quantity"].ToString());

                        i = i + 1;
                    }
                    if (dAvailable)
                    {
                        sw.Write(" ");
                        sw.Write(report.StringFormatWithoutPipe(" ", 34, 2));
                        sw.Write(report.StringFormatWithoutPipe("", 27, 2));
                        sw.Write(report.StringFormatWithoutPipe("Total".ToString(), 11, 2));
                        sw.Write(report.StringFormatWithoutPipe(report.DecimalformatForWeight(dTotal.ToString()), 37, 1));
                        gTotal += dTotal;
                        dTotal  = 0;
                        sw.WriteLine("");
                    }
                }
                sw.Write(" ");
                sw.Write(report.StringFormatWithoutPipe(" ", 34, 2));
                sw.Write(report.StringFormatWithoutPipe("", 27, 2));
                sw.Write(report.StringFormatWithoutPipe("Grand Total".ToString(), 11, 2));
                sw.Write(report.StringFormatWithoutPipe(report.DecimalformatForWeight(gTotal.ToString()), 37, 1));
                dTotal = 0;
                sw.WriteLine("");
                sw.WriteLine("---------------------------------------------------------------------------------------------------------------------------------------------------------------|");
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sw"></param>
        /// <param name="entity"></param>
        public void SocietyWiseDOAllSchemeReport(StreamWriter sw, CommonEntity entity)
        {
            int count = 10;

            int     i               = 1;
            string  doNo            = string.Empty;
            string  fromWhomRcd     = string.Empty;
            bool    isDataAvailable = false;
            decimal Qty             = 0;
            decimal Rate            = 0;
            decimal C_Amount        = 0;
            decimal NC_Amount       = 0;
            decimal Toatal_C_Amount = 0;
            decimal Total_NC_Amount = 0;
            decimal Amount          = 0;

            decimal GrandTotal_C  = 0;
            decimal GrandTotal_NC = 0;
            decimal GrandTotal    = 0;

            count = 11;
            try
            {
                // dateList = entity.dataSet.Tables[0].DefaultView.ToTable(true, new string[] { "Coop", "Comodity" });
                var dateList = entity.dataSet.Tables[0].DefaultView.ToTable(true, "Coop");

                foreach (DataRow date in dateList.Rows)
                {
                    Qty       = 0;
                    Rate      = 0;
                    C_Amount  = 0;
                    NC_Amount = 0;
                    Amount    = 0;

                    Toatal_C_Amount = 0;
                    Total_NC_Amount = 0;

                    GrandTotal_C    = 0;
                    GrandTotal_NC   = 0;
                    GrandTotal      = 0;
                    isDataAvailable = true;

                    string doNoNext = string.Empty;
                    string coop     = string.Empty;
                    AddHeader(sw, entity);
                    coop = Convert.ToString(date["Coop"]);
                    DataRow[] data = entity.dataSet.Tables[0].Select("Coop='" + coop + "'");
                    var       distinctCommodity = report.ConvertDataRowToTable(data, entity.dataSet.Tables[0]).DefaultView.ToTable(true, "Comodity");
                    sw.WriteLine(report.StringFormatWithoutPipe(coop, 50, 2));

                    foreach (DataRow item in distinctCommodity.Rows)
                    {
                        Qty             = 0;
                        Rate            = 0;
                        C_Amount        = 0;
                        NC_Amount       = 0;
                        Amount          = 0;
                        Toatal_C_Amount = 0;
                        Total_NC_Amount = 0;
                        DataRow[] ndata = entity.dataSet.Tables[0].Select("Coop='" + coop + "' and Comodity='" + Convert.ToString(item["Comodity"]) + "'");
                        foreach (DataRow row in ndata)
                        {
                            C_Amount  = 0;
                            NC_Amount = 0;
                            if (count >= 50)
                            {
                                //Add header again
                                count = 11;
                                sw.WriteLine("---------------------------------------------------------------------------------------------------------------------------------");
                                sw.WriteLine((char)12);
                                AddHeader(sw, entity);
                            }
                            doNoNext  = row["Dono"].ToString();
                            C_Amount  = (row["C_Nc"].ToString() == "C") ? Convert.ToDecimal(row["Amount"]) : 0;
                            NC_Amount = (row["C_Nc"].ToString() == "NC") ? Convert.ToDecimal(row["Amount"]) : 0;
                            sw.Write(report.StringFormatWithoutPipe(row["GodownName"].ToString(), 25, 2));

                            sw.Write(report.StringFormatWithoutPipe(doNoNext, 11, 1));
                            sw.Write(report.StringFormatWithoutPipe(report.FormatDirectDate(row["Dodate"].ToString()), 10, 2));
                            sw.Write(report.StringFormatWithoutPipe(row["Comodity"].ToString(), 15, 2));
                            sw.Write(report.StringFormatWithoutPipe(row["Scheme"].ToString(), 11, 2));
                            sw.Write(report.StringFormatWithoutPipe(report.DecimalformatForWeight(row["Quantity"].ToString()), 11, 1));
                            sw.Write(report.StringFormatWithoutPipe(report.Decimalformat(row["Rate"].ToString()), 10, 1));
                            sw.Write(report.StringFormatWithoutPipe(report.Decimalformat(Convert.ToString(C_Amount)), 11, 1));
                            sw.Write(report.StringFormatWithoutPipe(report.Decimalformat(Convert.ToString(NC_Amount)), 11, 1));
                            sw.Write(report.StringFormatWithoutPipe(report.Decimalformat(row["Amount"].ToString()), 11, 1));
                            sw.WriteLine("");
                            Rate            += !string.IsNullOrEmpty(Convert.ToString(row["Rate"])) ? Convert.ToDecimal(row["Rate"].ToString()) : 0;
                            Toatal_C_Amount += !string.IsNullOrEmpty(Convert.ToString(C_Amount)) ? C_Amount : 0;
                            Total_NC_Amount += !string.IsNullOrEmpty(Convert.ToString(NC_Amount)) ? NC_Amount : 0;
                            Amount          += !string.IsNullOrEmpty(Convert.ToString(row["Amount"])) ? Convert.ToDecimal(row["Amount"].ToString()) : 0;
                            Qty             += !string.IsNullOrEmpty(Convert.ToString(row["Quantity"])) ? Convert.ToDecimal(row["Quantity"].ToString()) : 0;
                            i = i + 1;
                            count++;
                        }
                        sw.WriteLine("---------------------------------------------------------------------------------------------------------------------------------");
                        sw.Write(report.StringFormatWithoutPipe("", 36, 2));
                        sw.Write(report.StringFormatWithoutPipe("", 10, 2));
                        sw.Write(report.StringFormatWithoutPipe("", 15, 2));
                        sw.Write(report.StringFormatWithoutPipe("  Total ", 11, 1));
                        sw.Write(report.StringFormatWithoutPipe(Qty.ToString(), 11, 1));
                        sw.Write(report.StringFormatWithoutPipe(report.Decimalformat(Rate.ToString()), 10, 1));
                        sw.Write(report.StringFormatWithoutPipe(report.Decimalformat(Toatal_C_Amount.ToString()), 11, 1));
                        sw.Write(report.StringFormatWithoutPipe(report.Decimalformat(Total_NC_Amount.ToString()), 11, 1));
                        sw.Write(report.StringFormatWithoutPipe(report.Decimalformat(Amount.ToString()), 11, 1));
                        GrandTotal_C  += Toatal_C_Amount;
                        GrandTotal_NC += Total_NC_Amount;
                        GrandTotal    += Amount;
                        sw.WriteLine("");
                        sw.WriteLine("---------------------------------------------------------------------------------------------------------------------------------");
                    }
                    sw.WriteLine("---------------------------------------------------------------------------------------------------------------------------------");
                    sw.Write(report.StringFormatWithoutPipe("", 36, 2));
                    sw.Write(report.StringFormatWithoutPipe("", 10, 2));
                    sw.Write(report.StringFormatWithoutPipe("", 15, 2));
                    sw.Write(report.StringFormatWithoutPipe("  Demand ", 11, 1));
                    sw.Write(report.StringFormatWithoutPipe(" ", 11, 1));
                    sw.Write(report.StringFormatWithoutPipe(" ", 10, 1));
                    sw.Write(report.StringFormatWithoutPipe(report.Decimalformat(GrandTotal_C.ToString()), 11, 1));
                    sw.Write(report.StringFormatWithoutPipe(report.Decimalformat(GrandTotal_NC.ToString()), 11, 1));
                    sw.Write(report.StringFormatWithoutPipe(report.Decimalformat(GrandTotal.ToString()), 11, 1));
                    sw.WriteLine("");
                    sw.WriteLine("---------------------------------------------------------------------------------------------------------------------------------");

                    //Check Collections
                    sw.WriteLine((char)12);
                }
                if (!isDataAvailable)
                {
                    sw.WriteLine("---------------------------------------------------------------------------------------------------------------");
                    sw.WriteLine((char)12);
                }
            }
            catch (Exception ex)
            {
                AuditLog.WriteError(ex.Message);
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sw"></param>
        /// <param name="entity"></param>
        public void TruckToRegionWiseReport(StreamWriter sw, CommonEntity entity)
        {
            int count = 10;

            int     i               = 1;
            string  doNo            = string.Empty;
            string  fromWhomRcd     = string.Empty;
            bool    isDataAvailable = false;
            decimal Total           = 0;
            decimal GrandTotal      = 0;
            int     pageno          = 1;

            count = 8;
            bool isfirst = true;

            try
            {
                // dateList = entity.dataSet.Tables[0].DefaultView.ToTable(true, new string[] { "Coop", "Comodity" });
                var dateList = entity.dataSet.Tables[0].DefaultView.ToTable(true, "DepositorName");
                AddHeader(sw, entity, pageno);
                foreach (DataRow depdata in dateList.Rows)
                {
                    Total           = 0;
                    GrandTotal      = 0;
                    isDataAvailable = true;
                    isfirst         = true;
                    string PackingType = string.Empty;
                    string depositor   = string.Empty;
                    depositor = Convert.ToString(depdata["DepositorName"]);
                    DataRow[] data = entity.dataSet.Tables[0].Select("DepositorName='" + depositor + "'");
                    var       distinctCommodity = report.ConvertDataRowToTable(data, entity.dataSet.Tables[0]).DefaultView.ToTable(true, "ITDescription");

                    foreach (DataRow item in distinctCommodity.Rows)
                    {
                        Total = 0;
                        DataRow[] ndata = entity.dataSet.Tables[0].Select("DepositorName='" + depositor + "' and ITDescription='" + Convert.ToString(item["ITDescription"]) + "'");
                        foreach (DataRow row in ndata)
                        {
                            if (count >= 50)
                            {
                                //Add header again
                                pageno++;
                                count = 8;
                                sw.WriteLine("-------------------------------------------------------------------------------------------------------------------------------------------");
                                sw.WriteLine((char)12);
                                AddHeader(sw, entity, pageno);
                            }
                            PackingType = row["PBWeight"].ToString(); //PBWeight
                            sw.Write(report.StringFormatWithoutPipe(i.ToString(), 4, 2));
                            sw.Write(report.StringFormatWithoutPipe(row["STNo"].ToString(), 11, 2));
                            sw.Write(report.StringFormatWithoutPipe(report.FormatDirectDate(row["STDate"].ToString()), 10, 2) + "  ");
                            sw.Write(report.StringFormatWithoutPipe(isfirst == true ? row["DepositorName"].ToString() : " ", 20, 2));
                            sw.Write(report.StringFormatWithoutPipe(isfirst == true ? row["RGNAME"].ToString() : " ", 15, 2));
                            sw.Write(report.StringFormatWithoutPipe(row["ITDescription"].ToString(), 15, 1));
                            sw.Write(report.StringFormatWithoutPipe(row["SCName"].ToString(), 11, 2));
                            sw.Write(report.StringFormatWithoutPipe(row["NoPacking"].ToString(), 6, 1));
                            sw.Write(report.StringFormatWithoutPipe(PackingType.ToUpper() == "NOS" ? row["Nkgs"].ToString() : report.DecimalformatForWeight(row["Nkgs"].ToString()), 15, 1));
                            sw.Write(report.StringFormatWithoutPipe(row["LNo"].ToString(), 21, 2));
                            sw.WriteLine("");
                            Total += !string.IsNullOrEmpty(Convert.ToString(row["Nkgs"])) ? Convert.ToDecimal(row["Nkgs"].ToString()) : 0;
                            i      = i + 1;
                            count++;
                            isfirst = false;
                        }
                        sw.Write(report.StringFormatWithoutPipe("", 4, 1));
                        sw.Write(report.StringFormatWithoutPipe("", 11, 2));
                        sw.Write(report.StringFormatWithoutPipe("", 10, 2) + "  ");
                        sw.Write(report.StringFormatWithoutPipe(" ", 20, 2));
                        sw.Write(report.StringFormatWithoutPipe(" ", 15, 2));
                        sw.Write(report.StringFormatWithoutPipe("", 10, 1));
                        sw.Write(report.StringFormatWithoutPipe("Total", 16, 1));
                        sw.Write(report.StringFormatWithoutPipe("", 6, 2));
                        sw.Write(report.StringFormatWithoutPipe(report.DecimalformatForWeight(Total.ToString()), 15, 1));
                        sw.WriteLine("");
                        count++;
                        GrandTotal += Total;
                    }

                    sw.Write(report.StringFormatWithoutPipe("", 4, 1));
                    sw.Write(report.StringFormatWithoutPipe("", 11, 2));
                    sw.Write(report.StringFormatWithoutPipe("", 10, 2) + "  ");
                    sw.Write(report.StringFormatWithoutPipe(" ", 20, 2));
                    sw.Write(report.StringFormatWithoutPipe(" ", 15, 2));
                    sw.Write(report.StringFormatWithoutPipe("", 10, 1));
                    sw.Write(report.StringFormatWithoutPipe("Grand Total", 16, 1));
                    sw.Write(report.StringFormatWithoutPipe("", 6, 2));
                    sw.Write(report.StringFormatWithoutPipe(report.DecimalformatForWeight(GrandTotal.ToString()), 15, 1));
                    sw.WriteLine("");
                    count++;
                }
                if (!isDataAvailable)
                {
                    sw.WriteLine("-------------------------------------------------------------------------------------------------------------------------------------------");
                    sw.WriteLine((char)12);
                }
            }
            catch (Exception ex)
            {
                AuditLog.WriteError(ex.Message);
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sw"></param>
        /// <param name="entity"></param>
        public void SocietyWiseDOAllSchemeReport(StreamWriter sw, CommonEntity entity)
        {
            int count = 8;

            int     i                 = 1;
            string  doNo              = string.Empty;
            string  fromWhomRcd       = string.Empty;
            bool    isDataAvailable   = false;
            decimal Due               = 0;
            decimal Paid              = 0;
            decimal AdvanceCollection = 0;
            decimal Debit             = 0;

            decimal GrandTotal_Due   = 0;
            decimal GrandTotal_Paid  = 0;
            decimal GrandTotal_ADV   = 0;
            decimal GrandTotal_Debit = 0;

            try
            {
                // dateList = entity.dataSet.Tables[0].DefaultView.ToTable(true, new string[] { "Coop", "Comodity" });
                var dateList = entity.dataSet.Tables[0].DefaultView.ToTable(true, "issuername");
                AddHeader(sw, entity);
                foreach (DataRow date in dateList.Rows)
                {
                    Due  = 0;
                    Paid = 0;
                    AdvanceCollection = 0;
                    Debit             = 0;
                    isDataAvailable   = true;

                    string doNoNext = string.Empty;
                    string coop     = string.Empty;
                    coop = Convert.ToString(date["issuername"]);
                    DataRow[] data = entity.dataSet.Tables[0].Select("issuername='" + coop + "'");
                    i = 1;
                    foreach (DataRow row in data)
                    {
                        if (count >= 50)
                        {
                            //Add header again
                            count = 8;
                            sw.WriteLine("----------------------------------------------------------------------------------------------------------------------------------");
                            sw.WriteLine((char)12);
                            AddHeader(sw, entity);
                        }
                        sw.Write(report.StringFormatWithoutPipe(row["GodownName"].ToString(), 25, 2));

                        sw.Write(report.StringFormatWithoutPipe(row["Dono"].ToString(), 10, 2));
                        sw.Write(report.StringFormatWithoutPipe(i == 1 ? row["issuername"].ToString() : " ", 30, 2));
                        sw.Write(report.StringFormatWithoutPipe(report.FormatDirectDate(row["DoDate"].ToString()), 10, 2));
                        sw.Write(report.StringFormatWithoutPipe(report.Decimalformat(row["Due"].ToString()), 13, 1));
                        sw.Write(report.StringFormatWithoutPipe(report.Decimalformat(row["Paid"].ToString()), 12, 1));
                        sw.Write(report.StringFormatWithoutPipe(report.Decimalformat(row["AdvanceCollection"].ToString()), 13, 1));
                        sw.Write(report.StringFormatWithoutPipe(report.Decimalformat(row["Debit"].ToString()), 12, 1));
                        sw.WriteLine("");
                        Due  += !string.IsNullOrEmpty(Convert.ToString(row["Due"])) ? Convert.ToDecimal(row["Due"].ToString()) : 0;
                        Paid += !string.IsNullOrEmpty(Convert.ToString(row["Paid"])) ? Convert.ToDecimal(row["Paid"].ToString()) : 0;
                        AdvanceCollection += !string.IsNullOrEmpty(Convert.ToString(row["AdvanceCollection"])) ? Convert.ToDecimal(row["AdvanceCollection"].ToString()) : 0;
                        Debit             += !string.IsNullOrEmpty(Convert.ToString(row["Debit"])) ? Convert.ToDecimal(row["Debit"].ToString()) : 0;
                        i = 2;
                        count++;
                    }
                    sw.WriteLine("----------------------------------------------------------------------------------------------------------------------------------");
                    sw.Write(report.StringFormatWithoutPipe(" ", 35, 2));
                    sw.Write(report.StringFormatWithoutPipe(" ", 30, 2));
                    sw.Write(report.StringFormatWithoutPipe("Total", 10, 2));
                    sw.Write(report.StringFormatWithoutPipe(report.Decimalformat(Due.ToString()), 13, 1));
                    sw.Write(report.StringFormatWithoutPipe(report.Decimalformat(Paid.ToString()), 12, 1));
                    sw.Write(report.StringFormatWithoutPipe(report.Decimalformat(AdvanceCollection.ToString()), 13, 1));
                    sw.Write(report.StringFormatWithoutPipe(report.Decimalformat(Debit.ToString()), 12, 1));
                    sw.WriteLine("");
                    GrandTotal_Due   += Due;
                    GrandTotal_Paid  += Paid;
                    GrandTotal_ADV   += AdvanceCollection;
                    GrandTotal_Debit += Debit;
                    sw.WriteLine("----------------------------------------------------------------------------------------------------------------------------------");
                }
                sw.WriteLine("----------------------------------------------------------------------------------------------------------------------------------");
                sw.Write(report.StringFormatWithoutPipe(" ", 35, 2));
                sw.Write(report.StringFormatWithoutPipe(" ", 20, 2));
                sw.Write(report.StringFormatWithoutPipe("Grand Total", 20, 2));
                sw.Write(report.StringFormatWithoutPipe(report.Decimalformat(GrandTotal_Due.ToString()), 13, 1));
                sw.Write(report.StringFormatWithoutPipe(report.Decimalformat(GrandTotal_Paid.ToString()), 12, 1));
                sw.Write(report.StringFormatWithoutPipe(report.Decimalformat(GrandTotal_ADV.ToString()), 13, 1));
                sw.Write(report.StringFormatWithoutPipe(report.Decimalformat(GrandTotal_Debit.ToString()), 12, 1));
                sw.WriteLine("");
                sw.WriteLine("----------------------------------------------------------------------------------------------------------------------------------");
                //Check Collections
                sw.WriteLine((char)12);
                if (!isDataAvailable)
                {
                    sw.WriteLine("----------------------------------------------------------------------------------------------------------------------------------");
                    sw.WriteLine((char)12);
                }
            }
            catch (Exception ex)
            {
                AuditLog.WriteError(ex.Message);
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Write the Sales Customer Details
        /// </summary>
        /// <param name="sw"></param>
        /// <param name="entity"></param>
        public void WriteSalesIssueMemo(StreamWriter sw, CommonEntity entity)
        {
            int iCount       = 11;
            int i            = 1;
            var distinctCoop = entity.dataSet.Tables[0].DefaultView.ToTable(true, "Coop");
            //var distinctCommodity = entity.dataSet.Tables[0].DefaultView.ToTable(true, "Commodity");
            string  sAckno     = string.Empty;
            string  sCoop      = string.Empty;
            string  sCommodity = string.Empty;
            decimal dTotal     = 0;
            decimal gTotal     = 0;

            AddHeaderForCustomerDetail(sw, entity);
            foreach (DataRow dateValue in distinctCoop.Rows)
            {
                bool CheckRepeatValue = false;
                sCoop      = string.Empty;
                sAckno     = string.Empty;
                sCommodity = string.Empty;
                DataRow[] datas = entity.dataSet.Tables[0].Select("Coop='" + dateValue["Coop"] + "'");
                //DataRow[] datac = entity.dataSet.Tables[0].Select("Commodity='" + dateValue["Commodity"] + "'");

                foreach (var item in datas)
                {
                    if (iCount >= 50)
                    {
                        //Add header again
                        iCount = 11;
                        sw.WriteLine("----------------------------------------------------------------------------------------------------------------------------------------------|");
                        sw.WriteLine((char)12);
                        AddHeaderForCustomerDetail(sw, entity);
                    }
                    sCoop = Convert.ToString(item["Coop"]);
                    if (sAckno == sCoop)
                    {
                        CheckRepeatValue = true;
                    }
                    else
                    {
                        CheckRepeatValue = false;
                        sAckno           = sCoop;
                    }
                    sw.Write(report.StringFormatWithoutPipe(i.ToString(), 4, 2));
                    sw.Write(report.StringFormatWithoutPipe(item["Ackno"].ToString(), 12, 2));
                    //sw.Write(report.StringFormatWithoutPipe(report.FormatDirectDate(dateValue["Date"].ToString()), 16, 2));
                    sw.Write(report.StringFormatWithoutPipe(report.FormatDirectDate(item["Date"].ToString()), 10, 2));
                    sw.Write(report.StringFormatWithoutPipe(CheckRepeatValue == false ? sCoop : " ", 35, 2));
                    sw.Write(report.StringFormatWithoutPipe(item["Scheme"].ToString(), 13, 2));
                    sw.Write(report.StringFormatWithoutPipe(item["Commodity"].ToString(), 27, 2));
                    sw.Write(report.StringFormatWithoutPipe(report.DecimalformatForWeight(item["Quantity"].ToString()), 11, 1));
                    sw.Write(report.StringFormatWithoutPipe((item["Rate"].ToString()), 10, 1));
                    sw.Write(report.StringFormatWithoutPipe((item["Value"].ToString()), 11, 1));
                    sw.WriteLine("");
                    iCount  = iCount + 1;
                    dTotal += Convert.ToDecimal(item["Quantity"].ToString());
                    gTotal += Convert.ToDecimal(item["Quantity"].ToString());
                    i       = i + 1;
                    iCount++;
                }
                //sw.WriteLine("-------------------------------------------------------------------------------------------------------------------------------------|");
                sw.Write(" ");
                sw.Write(report.StringFormatWithoutPipe(" ", 34, 2));
                sw.Write(report.StringFormatWithoutPipe("", 28, 2));
                sw.Write(report.StringFormatWithoutPipe("Total".ToString(), 11, 2));
                sw.Write(report.StringFormatWithoutPipe(report.DecimalformatForWeight(dTotal.ToString()), 41, 1));
                dTotal = 0;
                sw.WriteLine("");
                //sw.WriteLine("-------------------------------------------------------------------------------------------------------------------------------------|");
            }

            sw.WriteLine("----------------------------------------------------------------------------------------------------------------------------------------------|");
            sw.Write(" ");
            sw.Write(report.StringFormatWithoutPipe(" ", 34, 2));
            sw.Write(report.StringFormatWithoutPipe("", 28, 2));
            sw.Write(report.StringFormatWithoutPipe("Grand Total".ToString(), 12, 2));
            sw.Write(report.StringFormatWithoutPipe(report.DecimalformatForWeight(gTotal.ToString()), 40, 1));
            sw.WriteLine("");
            sw.WriteLine("----------------------------------------------------------------------------------------------------------------------------------------------|");
            sw.WriteLine((char)12);
        }
Ejemplo n.º 11
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);
        }