Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sw"></param>
        /// <param name="entity"></param>
        public void DateWiseStockReceiptRegister(StreamWriter sw, CommonEntity entity)
        {
            int    count            = 10;
            var    dateList         = entity.dataSet.Tables[0].DefaultView.ToTable(true, "Date");
            int    i                = 1;
            string ackNo            = string.Empty;
            string fromWhomRcd      = string.Empty;
            bool   CheckRepeatValue = false;
            bool   isDataAvailable  = false;

            foreach (DataRow date in dateList.Rows)
            {
                isDataAvailable = true;
                count           = 11;
                string    ackNoNext = string.Empty;
                DataRow[] data      = entity.dataSet.Tables[0].Select("Date='" + date["Date"] + "'");
                AddHeader(sw, Convert.ToString(date["Date"]));
                foreach (DataRow row in data)
                {
                    if (count >= 50)
                    {
                        //Add header again
                        count = 11;
                        sw.WriteLine("------------------------------------------------------------------------------------------------------------------------------------------------|");
                        sw.WriteLine((char)12);
                        AddHeader(sw, Convert.ToString(date["Date"]));
                    }
                    ackNoNext   = row["Ackno"].ToString();
                    fromWhomRcd = Convert.ToString(row["From_Whom_Received"]).Trim();
                    if (ackNo == ackNoNext)
                    {
                        CheckRepeatValue = true;
                    }
                    else
                    {
                        CheckRepeatValue = false;
                        ackNo            = ackNoNext;
                    }
                    sw.Write(report.StringFormat(CheckRepeatValue == false ? i.ToString() : " ", 4, 2));
                    sw.Write(report.StringFormat(CheckRepeatValue == false ? ackNoNext : " ", 11, 2));
                    sw.Write(report.StringFormat(CheckRepeatValue == false ? row["TruckMemoNo"].ToString() : " ", 19, 2));
                    sw.Write(report.StringFormat(CheckRepeatValue == false ? row["Lorryno"].ToString() : " ", 11, 2));
                    sw.Write(report.StringFormat(CheckRepeatValue == false ? fromWhomRcd : " ", 33, 2));
                    sw.Write(report.StringFormat(row["Scheme"].ToString(), 12, 2));
                    sw.Write(report.StringFormat(row["Stackno"].ToString(), 12, 2));
                    sw.Write(report.StringFormat(row["NoPacking"].ToString(), 8, 1));
                    sw.Write(report.StringFormat(row["Commodity"].ToString(), 15, 2));
                    sw.Write(report.StringFormat(report.DecimalformatForWeight(row["NetWt"].ToString()), 10, 1));
                    sw.WriteLine("");
                    i = CheckRepeatValue == false ? i + 1 : i;
                }
                sw.WriteLine("------------------------------------------------------------------------------------------------------------------------------------------------|");
                sw.WriteLine((char)12);
            }
            if (!isDataAvailable)
            {
                sw.WriteLine("------------------------------------------------------------------------------------------------------------------------------------------------|");
                sw.WriteLine((char)12);
            }
        }
        /// <summary>
        /// Add receipt item details
        /// </summary>
        /// <param name="streamWriter"></param>
        /// <param name="stockReceipt"></param>
        public void AddItemsDetails(StreamWriter streamWriter, DocumentDeliveryOrderEntity deliveryOrderList)
        {
            int    i      = 0;
            double dTotal = 0;

            streamWriter.WriteLine("| Commodity Details                                                                                        |");
            streamWriter.WriteLine("||------|-------------------------|-------------------|---------------------|-----------|-------------|    |");
            streamWriter.WriteLine("||S.NO. |   ITEM DESCRIPTION      |SCHEME             |QUANTITY TO BE ISSUED|RATE/UNIT  | TOTAL VALUE |    |");
            streamWriter.WriteLine("||      |                         |                   |    KGS.(Nett) GMS.  | RS.   P.  |   RS.    P. |    |");
            streamWriter.WriteLine("||------|-------------------------|-------------------|---------------------|-----------|-------------|    |");

            foreach (var item in deliveryOrderList.documentDeliveryItems)
            {
                i = i + 1;
                streamWriter.Write("||");
                streamWriter.Write(manageReport.StringFormat(i.ToString(), 6, 2));
                streamWriter.Write(manageReport.StringFormat(item.ITDescription, 25, 2));
                streamWriter.Write(manageReport.StringFormat(item.SchemeName, 19, 2));
                streamWriter.Write(manageReport.StringFormat(manageReport.DecimalformatForWeight(item.NetWeight.ToString()), 21, 2));
                streamWriter.Write(manageReport.StringFormat(item.Rate.ToString(), 11, 1));
                streamWriter.Write(manageReport.StringFormat(item.Total.ToString(), 13, 1));
                streamWriter.Write("    |");
                streamWriter.WriteLine(" ");
                dTotal = dTotal + Convert.ToDouble(item.Total);
            }
            streamWriter.WriteLine("||------|-------------------------|-------------------|---------------------|-----------|-------------|    |");
            streamWriter.Write("|                                                                            TOTAL      |");
            streamWriter.Write(manageReport.StringFormat(dTotal.ToString(), 13, 1));
            streamWriter.Write("    |");
            streamWriter.WriteLine(" ");
            streamWriter.WriteLine("|==========================================================================================================|");
        }
Exemplo n.º 3
0
        /// <summary>
        /// Write the Transaction Abstract data
        /// </summary>
        /// <param name="sw"></param>
        /// <param name="entity"></param>
        public void WriteTransactionForAbstract(StreamWriter sw, CommonEntity entity)
        {
            int iCount            = 10;
            var distinctCommodity = entity.dataSet.Tables[0].DefaultView.ToTable(true, "Commodity");
            //Date wise DO report
            string  sDoNo      = string.Empty;
            string  sCommodity = string.Empty;
            decimal dTotal     = 0;

            AddHeaderForTransactionReceipt(sw, entity);
            foreach (DataRow dateValue in distinctCommodity.Rows)
            {
                iCount = 11;
                bool CheckRepeatValue = false;
                sCommodity = string.Empty;
                sDoNo      = string.Empty;
                DataRow[] datas = 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);
                        AddHeaderForTransactionReceipt(sw, entity);
                    }
                    sCommodity = Convert.ToString(item["Commodity"]);
                    if (sDoNo == sCommodity)
                    {
                        CheckRepeatValue = true;
                    }
                    else
                    {
                        CheckRepeatValue = false;
                        sDoNo            = sCommodity;
                    }
                    sw.Write(" ");
                    sw.Write(report.StringFormatWithoutPipe(CheckRepeatValue == false ? sCommodity : " ", 34, 2));
                    sw.Write(report.StringFormatWithoutPipe(item["Date"].ToString(), 10, 2));
                    sw.Write(report.StringFormatWithoutPipe(item["Trans_action"].ToString(), 21, 2));
                    sw.Write(report.StringFormatWithoutPipe(report.DecimalformatForWeight(item["Quantity"].ToString()), 15, 1));
                    sw.WriteLine("");
                    iCount  = iCount + 1;
                    dTotal += Convert.ToDecimal(item["Quantity"].ToString());
                }
                sw.WriteLine("------------------------------------------------------------------------------------");
                sw.Write(" ");
                sw.Write(report.StringFormatWithoutPipe(" ", 34, 2));
                sw.Write(report.StringFormatWithoutPipe("", 10, 2));
                sw.Write(report.StringFormatWithoutPipe("", 21, 2));
                sw.Write(report.StringFormatWithoutPipe(report.DecimalformatForWeight(dTotal.ToString()), 15, 1));
                sw.WriteLine("");
                sw.WriteLine("------------------------------------------------------------------------------------");
            }
            sw.WriteLine("------------------------------------------------------------------------------------");
            sw.WriteLine((char)12);
        }
Exemplo n.º 4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sw"></param>
 /// <param name="entity"></param>
 public void CommodityWiseIssueMemoReport(StreamWriter sw, CommonEntity entity)
 {
     try
     {
         int     count     = 8;
         var     dateList  = entity.dataSet.Tables[0].DefaultView.ToTable(true, "Commodity");
         int     pageNo    = 1;
         decimal netweight = 0;
         AddHeader(sw, entity, pageNo);
         int i = 1;
         foreach (DataRow nrow in dateList.Rows)
         {
             netweight = 0;
             DataRow[] drdata = entity.dataSet.Tables[0].Select("Commodity='" + Convert.ToString(nrow["Commodity"]) + "'");
             foreach (DataRow row in drdata)
             {
                 if (count >= 50)
                 {
                     //Add header again
                     pageNo++;
                     count = 8;
                     sw.WriteLine("-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------");
                     sw.WriteLine((char)12);
                     AddHeader(sw, entity, pageNo);
                 }
                 sw.Write("");
                 sw.Write(report.StringFormatWithoutPipe(i.ToString(), 4, 2));
                 sw.Write(report.StringFormatWithoutPipe(row["Issue_Date"].ToString(), 10, 2));
                 sw.Write(report.StringFormatWithoutPipe(row["Issueno"].ToString(), 11, 1) + " ");
                 sw.Write(report.StringFormatWithoutPipe(row["Commodity"].ToString(), 16, 2));
                 sw.Write(report.StringFormatWithoutPipe(report.DecimalformatForWeight(row["NetWt"].ToString()), 11, 1) + "  ");
                 sw.Write(report.StringFormatWithoutPipe(row["Stackno"].ToString(), 14, 2));
                 sw.Write(report.StringFormatWithoutPipe(row["remarks"].ToString(), 101, 2));
                 sw.WriteLine("");
                 count      = count + 1;
                 netweight += !string.IsNullOrEmpty(row["NetWt"].ToString()) ? Convert.ToDecimal(row["NetWt"]) : 0;
                 i++;
             }
             sw.WriteLine("-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------");
             sw.Write("");
             sw.Write(report.StringFormatWithoutPipe("", 4, 2));
             sw.Write(report.StringFormatWithoutPipe("Total", 10, 2));
             sw.Write(report.StringFormatWithoutPipe("-", 11, 1) + " ");
             sw.Write(report.StringFormatWithoutPipe("-", 16, 2));
             sw.Write(report.StringFormatWithoutPipe(report.DecimalformatForWeight(Convert.ToString(netweight)), 11, 1) + "  ");
             sw.Write(report.StringFormatWithoutPipe("-", 14, 2));
             sw.Write(report.StringFormatWithoutPipe("-", 101, 2));
             sw.WriteLine("");
             sw.WriteLine("-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------");
             count = count + 1;
         }
         sw.WriteLine((char)12);
     }
     catch (Exception ex)
     {
         AuditLog.WriteError(ex.Message + " " + ex.StackTrace);
     }
 }
Exemplo n.º 5
0
        public void WriteTruckMemoForDateWise(StreamWriter sw, CommonEntity entity)
        {
            int iCount       = 10;
            var distinctDate = entity.dataSet.Tables[0].DefaultView.ToTable(true, "Issue_Date");
            //Date wise DO report
            int    i       = 1;
            string sIssuer = string.Empty;
            string sDoNo   = string.Empty;

            foreach (DataRow dateValue in distinctDate.Rows)
            {
                iCount = 11;
                bool      CheckRepeatValue = false;
                string    sDoNo1           = string.Empty;
                DataRow[] datas            = entity.dataSet.Tables[0].Select("Issue_Date='" + dateValue["Issue_Date"] + "'");
                AddHeader(sw, Convert.ToString(dateValue["Issue_Date"]));
                foreach (DataRow dr in datas)
                {
                    if (iCount >= 50)
                    {
                        //Add header again
                        iCount = 11;
                        sw.WriteLine("------------------------------------------------------------------------------------------------------------------------------------------------");
                        sw.WriteLine((char)12);
                        AddHeader(sw, Convert.ToString(dateValue["Issue_Date"]));
                    }
                    sDoNo1 = dr["Truck_Memono"].ToString();
                    if (sDoNo == sDoNo1)
                    {
                        CheckRepeatValue = true;
                    }
                    else
                    {
                        CheckRepeatValue = false;
                        sDoNo            = sDoNo1;
                    }

                    sIssuer = Convert.ToString(dr["To_Whom_Issued"]).Trim();
                    sw.Write(report.StringFormatWithoutPipe(CheckRepeatValue == false ? i.ToString() : " ", 4, 2));
                    sw.Write(report.StringFormatWithoutPipe(CheckRepeatValue == false ? dr["Truck_Memono"].ToString() : " ", 12, 2));
                    sw.Write(report.StringFormatWithoutPipe(CheckRepeatValue == false ? dr["Mono"].ToString() : " ", 15, 2));
                    sw.Write(report.StringFormatWithoutPipe(CheckRepeatValue == false ? dr["RoNo"].ToString() : " ", 11, 2));
                    sw.Write(report.StringFormatWithoutPipe(CheckRepeatValue == false ? sIssuer : " ", 31, 2));
                    sw.Write(report.StringFormatWithoutPipe(dr["Scheme"].ToString(), 10, 2));
                    sw.Write(report.StringFormatWithoutPipe(dr["Stackno"].ToString(), 10, 2));
                    sw.Write(report.StringFormatWithoutPipe(dr["NoBags"].ToString(), 7, 1));
                    sw.Write(report.StringFormatWithoutPipe(dr["Commodity"].ToString(), 25, 2));
                    sw.Write(report.StringFormatWithoutPipe(report.DecimalformatForWeight(dr["NetWt"].ToString()), 9, 1));
                    sw.WriteLine("");
                    iCount = iCount + 1;
                    i      = CheckRepeatValue == false ? i + 1 : i;
                }
                sw.WriteLine("------------------------------------------------------------------------------------------------------------------------------------------------");
                sw.WriteLine((char)12);
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Add Commodity wise abstract details
        /// </summary>
        /// <param name="sw">Streamwriter</param>
        /// <param name="stockIssues">Stock issues entity</param>
        /// <param name="entity">Common entity</param>
        public void StockIssuesCommoditywiseAbstract(StreamWriter sw, List <SchemeIssueList> stockReceipt, CommonEntity entity)
        {
            int    count         = 11;
            string weighmentType = string.Empty;
            var    resultSet     = from d in stockReceipt
                                   group d by new { d.Commodity } into groupedData
                   select new
            {
                NetWt        = groupedData.Sum(s => s.Quantity),
                GroupByNames = groupedData.Key
            };

            AddAbstractHeader(sw, entity);
            foreach (var item in resultSet)
            {
                if (count >= 50)
                {
                    count = 11;
                    sw.WriteLine("--------------------------------------------------------");
                    sw.WriteLine((char)12);
                    AddAbstractHeader(sw, entity);
                }
                sw.Write(" ");
                sw.Write(report.StringFormatWithoutPipe(item.GroupByNames.Commodity, 31, 2));
                sw.Write(report.StringFormatWithoutPipe(report.DecimalformatForWeight(item.NetWt.ToString()), 18, 2));
                sw.WriteLine(" ");
                count = count + 2;
            }
            sw.WriteLine("--------------------------------------------------------");
            sw.WriteLine((char)12);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Add receipt item details
        /// </summary>
        /// <param name="streamWriter"></param>
        /// <param name="stockIssuesEntity"></param>
        private void AddDetails(StreamWriter streamWriter, DocumentStockIssuesEntity stockIssuesEntity)
        {
            int    i      = 0;
            int    units  = 0;
            double netKgs = 0;

            foreach (var item in stockIssuesEntity.IssueItemList)
            {
                i = i + 1;
                if (item.TStockNo.ToUpper() != "TOTAL")
                {
                    streamWriter.Write("||");
                    streamWriter.Write(report.StringFormat(i.ToString(), 3, 2));
                    streamWriter.Write(report.StringFormat(item.TStockNo, 12, 2));
                    streamWriter.Write(report.StringFormat(item.CommodityName, 31, 2));
                    streamWriter.Write(report.StringFormat(item.SchemeName, 14, 2));
                    streamWriter.Write(report.StringFormat(item.PackingName, 13, 2));
                    streamWriter.Write(report.StringFormat(item.NoPacking.ToString(), 10, 1));
                    streamWriter.Write(report.StringFormat(report.DecimalformatForWeight(item.Nkgs.ToString()), 13, 1));
                    streamWriter.Write(report.StringFormat(item.Moisture.ToString(), 5, 1));
                    streamWriter.WriteLine(" ");
                    units  = units + item.NoPacking;
                    netKgs = netKgs + Convert.ToDouble(item.Nkgs);
                }
            }
            streamWriter.WriteLine("||------------------------------------------------------------------------------------------------------|-----|");
            streamWriter.WriteLine("||                                                               |Total        |" + report.StringFormatWithoutPipe(units.ToString(), 9, 1) + "|" + report.StringFormatWithoutPipe(report.DecimalformatForWeight(netKgs.ToString()), 12, 1) + "|     |");
            streamWriter.WriteLine("||------------------------------------------------------------------------------------------------------|-----|");
        }
Exemplo n.º 8
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);
        }
Exemplo n.º 9
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sw"></param>
        /// <param name="entity"></param>
        public void DateWiseSchemeReceiptReport(StreamWriter sw, CommonEntity entity)
        {
            int count = 11;
            //  var dateList = entity.dataSet.Tables[0].DefaultView.ToTable(true, "Date");
            int    i               = 1;
            string SINO            = string.Empty;
            bool   isDataAvailable = false;

            //foreach (DataRow date in dateList.Rows)
            //{
            isDataAvailable = true;
            AddHeader(sw, entity);
            // DataRow[] data = entity.dataSet.Tables[0].Select("Date='" + date["Date"] + "'");
            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(report.StringFormatWithoutPipe(i.ToString(), 4, 2));
                sw.Write(report.StringFormatWithoutPipe(row["Ackno"].ToString(), 14, 2));
                sw.Write(report.StringFormatWithoutPipe(row["Date"].ToString(), 10, 2));
                sw.Write(report.StringFormatWithoutPipe(row["Commodity"].ToString(), 16, 2));
                sw.Write(report.StringFormatWithoutPipe(report.DecimalformatForWeight(row["Quantity"].ToString()), 20, 1));
                sw.Write(report.StringFormatWithoutPipe(Convert.ToString(row["RecdFrom"]).Trim(), 23, 2));
                sw.Write(report.StringFormatWithoutPipe(row["TruckMemoNo"].ToString(), 11, 2));
                sw.Write(report.StringFormatWithoutPipe(row["Lorryno"].ToString(), 10, 2));
                sw.WriteLine("");
                sw.WriteLine(" ");
                i = i + 1;
                count++;
            }
            sw.WriteLine("---------------------------------------------------------------------------------------------------");
            sw.WriteLine((char)12);
            //}
            if (!isDataAvailable)
            {
                sw.WriteLine("---------------------------------------------------------------------------------------------------");
                sw.WriteLine((char)12);
            }
        }
Exemplo n.º 10
0
        /// <summary>
        /// Add receipt item details
        /// </summary>
        /// <param name="streamWriter"></param>
        /// <param name="truckMemoList"></param>
        public void AddDetails(StreamWriter streamWriter, DocumentStockTransferDetails transferDetails)
        {
            int i = 0;

            foreach (var item in transferDetails.documentSTItemDetails)
            {
                i = i + 1;
                streamWriter.Write("||");
                streamWriter.Write(report.StringFormat(i.ToString(), 4, 2));
                streamWriter.Write(report.StringFormat(item.TStockNo, 11, 2));
                streamWriter.Write(report.StringFormat(item.ITDescription, 20, 2));
                streamWriter.Write(report.StringFormat(item.SchemeName, 14, 2));
                streamWriter.Write(report.StringFormat(item.PackingType, 13, 2));
                streamWriter.Write(report.StringFormat(item.NoPacking.ToString(), 6, 1));
                streamWriter.Write(report.StringFormat(report.DecimalformatForWeight(item.GKgs.ToString()), 10, 1));
                streamWriter.Write(report.StringFormat(report.DecimalformatForWeight(item.Nkgs.ToString()), 10, 1));
                streamWriter.Write(report.StringFormat(item.Moisture.ToString(), 8, 1) + "|");
                streamWriter.WriteLine(" ");
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// Add receipt item details
        /// </summary>
        /// <param name="streamWriter"></param>
        /// <param name="stockReceipt"></param>
        public void AddDetails(StreamWriter streamWriter, DocumentStockReceiptList stockReceipt)
        {
            int i = 0;

            foreach (var item in stockReceipt.ItemList)
            {
                i = i + 1;
                streamWriter.Write("||");
                streamWriter.Write(report.StringFormat(i.ToString(), 4, 2));
                streamWriter.Write(report.StringFormat(item.TStockNo, 11, 2));
                streamWriter.Write(report.StringFormat(item.CommodityName, 20, 2));
                streamWriter.Write(report.StringFormat(item.SchemeName, 14, 2));
                streamWriter.Write(report.StringFormat(item.PackingName, 13, 2));
                streamWriter.Write(report.StringFormat(item.NoPacking.ToString(), 6, 1));
                streamWriter.Write(report.StringFormat(report.DecimalformatForWeight(item.GKgs.ToString()), 10, 1));
                streamWriter.Write(report.StringFormat(report.DecimalformatForWeight(item.Nkgs.ToString()), 10, 1));
                streamWriter.Write(report.StringFormat(item.Moisture.ToString(), 8, 1) + "|");
                streamWriter.WriteLine(" ");
            }
        }
Exemplo n.º 12
0
 public decimal GetCBQty(decimal qty, int type)
 {
     try
     {
         ManageReport report = new ManageReport();
         decimal      svalue = Math.Round((type == 1 ? qty / 1000 : qty), 3);
         return(Convert.ToDecimal(report.DecimalformatForWeight(Convert.ToString(svalue))));
     }
     catch (Exception ex)
     {
         AuditLog.WriteError(ex.Message);
         return(0);
     }
 }
Exemplo n.º 13
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);
            }
        }
Exemplo n.º 14
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sw"></param>
 /// <param name="entity"></param>
 public void StockStatementReport(StreamWriter sw, List <DailyStockDetailsEntity> stockDetailsEntity, StockParameter entity)
 {
     try
     {
         int count  = 8;
         int pageNo = 1;
         AddHeader(sw, entity, pageNo);
         int i = 1;
         foreach (var data in stockDetailsEntity)
         {
             if (count >= 50)
             {
                 //Add header again
                 pageNo++;
                 count = 8;
                 sw.WriteLine("|------------------------------------------------------------------------------------------------------------------------------------------------|");
                 sw.WriteLine((char)12);
                 AddHeader(sw, entity, pageNo);
             }
             sw.Write("|");
             sw.Write(report.StringFormat(i.ToString(), 4, 2));
             sw.Write(report.StringFormat(data.ITDescription.ToString(), 16, 2));
             sw.Write(report.StringFormat(report.DecimalformatForWeight(data.OpeningBalance.ToString()), 13, 1));
             sw.Write(report.StringFormat(report.DecimalformatForWeight(data.TotalReceipt.ToString()), 13, 1));
             sw.Write(report.StringFormat((report.DecimalformatForWeight((data.TotalReceipt + data.OpeningBalance).ToString())), 17, 1));
             sw.Write(report.StringFormat((report.DecimalformatForWeight((data.IssueSales + data.IssueOthers).ToString())), 13, 1));
             sw.Write(report.StringFormat(report.DecimalformatForWeight(data.ClosingBalance.ToString()), 13, 1));
             sw.Write(report.StringFormat(report.DecimalformatForWeight(data.CSBalance.ToString()), 20, 1));
             sw.Write(report.StringFormat(report.DecimalformatForWeight(data.Shortage.ToString()), 13, 1));
             sw.Write(report.StringFormat(report.DecimalformatForWeight(data.PhycialBalance.ToString()), 13, 1));
             sw.WriteLine("");
             count = count + 1;
             i++;
         }
         sw.WriteLine("|------------------------------------------------------------------------------------------------------------------------------------------------|");
         sw.WriteLine((char)12);
     }
     catch (Exception ex)
     {
         AuditLog.WriteError(ex.Message + " " + ex.StackTrace);
     }
 }
Exemplo n.º 15
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sw"></param>
        /// <param name="entity"></param>
        public void WriteSalesIssueMemoAbstract(StreamWriter sw, CommonEntity entity)
        {
            try
            {
                int count             = 10;
                var distinctCommodity = entity.dataSet.Tables[0].DefaultView.ToTable(true, "Commodity");
                // var dateList = entity.dataSet.Tables[0].DefaultView.ToTable(true, "Issue_Date");
                int     i          = 1;
                string  society    = string.Empty;
                string  sCommodity = string.Empty;
                decimal dTotal     = 0;
                decimal gTotal     = 0;
                AddHeader(sw, entity);
                foreach (DataRow dateValue in distinctCommodity.Rows)
                {
                    sCommodity = string.Empty;
                    DataRow[] datas = entity.dataSet.Tables[0].Select("Commodity='" + dateValue["Commodity"] + "'");
                    //DataRow[] datac = entity.dataSet.Tables[0].Select("Commodity='" + dateValue["Commodity"] + "'");

                    foreach (var row in datas)
                    {
                        if (count >= 50)
                        {
                            //Add header again
                            count = 11;
                            sw.WriteLine("---------------------------------------------------------------------------------------------------------------------|");
                            sw.WriteLine((char)12);
                            AddHeader(sw, entity);
                        }
                        society = Convert.ToString(row["Society"]).Trim();
                        sw.Write(report.StringFormatWithoutPipe(i.ToString(), 4, 2));
                        sw.Write(report.StringFormatWithoutPipe(society, 30, 2));
                        sw.Write(report.StringFormatWithoutPipe(row["Scheme"].ToString(), 16, 2));
                        sw.Write(report.StringFormatWithoutPipe(row["Commodity"].ToString(), 27, 2) + "  ");
                        sw.Write(report.StringFormatWithoutPipe(report.DecimalformatForWeight(row["Quantity"].ToString()), 10, 1));
                        sw.Write(report.StringFormatWithoutPipe(row["Rate"].ToString(), 10, 1));
                        sw.Write(report.StringFormatWithoutPipe(row["Value"].ToString(), 10, 1));
                        //sw.WriteLine("");
                        sw.WriteLine(" ");
                        dTotal += Convert.ToDecimal(row["Quantity"].ToString());
                        gTotal += Convert.ToDecimal(row["Quantity"].ToString());
                        i       = i + 1;
                        count   = count + 2;
                    }
                    //sw.WriteLine("--------------------------------------------------------------------------------------------------------------------------------|");
                    sw.Write(" ");
                    sw.Write(report.StringFormatWithoutPipe(" ", 34, 2));
                    sw.Write(report.StringFormatWithoutPipe("Total".ToString(), 11, 2));
                    sw.Write(report.StringFormatWithoutPipe("", 16, 2));
                    sw.Write(report.StringFormatWithoutPipe(report.DecimalformatForWeight(dTotal.ToString()), 28, 1));
                    sw.WriteLine(" ");
                    //sw.WriteLine("");
                    dTotal = 0;
                    //sw.WriteLine("--------------------------------------------------------------------------------------------------------------------------------|");
                }
                sw.WriteLine("---------------------------------------------------------------------------------------------------------------------|");
                sw.Write(" ");
                sw.Write(report.StringFormatWithoutPipe(" ", 34, 2));
                sw.Write(report.StringFormatWithoutPipe("Grand Total".ToString(), 11, 2));
                sw.Write(report.StringFormatWithoutPipe("", 16, 2));
                sw.Write(report.StringFormatWithoutPipe(report.DecimalformatForWeight(gTotal.ToString()), 28, 1));
                sw.WriteLine("");
                sw.WriteLine("---------------------------------------------------------------------------------------------------------------------|");
                sw.WriteLine((char)12);
            }
            catch (Exception ex)
            {
                AuditLog.WriteError(ex.Message);
            }
        }
Exemplo n.º 16
0
        public List <DailyStockDetailsEntity> ProcessStockStatement(StockParameter stockParameter)
        {
            decimal _BookBalanceWeight = 0, _PhysicalBalanceWeight = 0, _CumulitiveShortage = 0, _Shortage = 0;
            decimal _receiptuptoYesterday = 0, _receipttotay = 0, _issuesuptoYesterday = 0,
                    _issuestoday = 0, _otherIssuesuptoYesterday = 0, _otherIssuestoday = 0, _writeOFFAll = 0,
                    _openingBookBalance = 0, _closingBookBalance = 0, _phycialbalance = 0;
            string _itemCode = string.Empty;
            string _ITDescription = string.Empty;
            List <DailyStockDetailsEntity> dailyStockDetailsEntities = new List <DailyStockDetailsEntity>();

            try
            {
                ManageSQLConnection manageSQLConnection = new ManageSQLConnection();
                DataSet             dataSetMaster       = new DataSet();
                List <KeyValuePair <string, string> > _mastersqlParameters = new List <KeyValuePair <string, string> >();
                _mastersqlParameters.Add(new KeyValuePair <string, string>("@GCode", stockParameter.GCode));
                _mastersqlParameters.Add(new KeyValuePair <string, string>("@RCode", stockParameter.RCode));
                _mastersqlParameters.Add(new KeyValuePair <string, string>("@Date", stockParameter.FDate));
                dataSetMaster = manageSQLConnection.GetDataSetValues("GetMasterDataToProcessCB", _mastersqlParameters);
                DataSet todayIssues          = new DataSet();
                DataSet todayReceipt         = new DataSet();
                DataSet issuesUptoYesterday  = new DataSet();
                DataSet receiptUptoYesterday = new DataSet();
                List <KeyValuePair <string, string> > sqlParameters = new List <KeyValuePair <string, string> >();


                sqlParameters.Add(new KeyValuePair <string, string>("@GodownCode", stockParameter.GCode));
                sqlParameters.Add(new KeyValuePair <string, string>("@FromDate", stockParameter.FDate));
                sqlParameters.Add(new KeyValuePair <string, string>("@ToDate", stockParameter.ToDate));
                sqlParameters.Add(new KeyValuePair <string, string>("@RCode", stockParameter.RCode));
                todayIssues          = manageSQLConnection.GetDataSetValues("GetTodayIssuesByDate", sqlParameters);
                todayReceipt         = manageSQLConnection.GetDataSetValues("GetTodayReceiptByDate", sqlParameters);
                issuesUptoYesterday  = manageSQLConnection.GetDataSetValues("GetIssuesUptoYesterdayByDate", sqlParameters);
                receiptUptoYesterday = manageSQLConnection.GetDataSetValues("GetReceiptUptoYesterdayByDate", sqlParameters);
                if (dataSetMaster.Tables.Count > 0)
                {
                    foreach (DataRow godown in dataSetMaster.Tables[2].Rows)   // godown details.
                    {
                        foreach (DataRow item in dataSetMaster.Tables[1].Rows) // item master details.
                        {
                            DailyStockDetailsEntity stockDetailsEntity = new DailyStockDetailsEntity();
                            _itemCode      = Convert.ToString(item["ITCode"]);
                            _ITDescription = Convert.ToString(item["ITDescription"]);

                            stockDetailsEntity.ItemCode      = _itemCode;
                            stockDetailsEntity.ITDescription = _ITDescription;
                            stockDetailsEntity.GodownCode    = Convert.ToString(godown["TNCSCode"]);
                            stockDetailsEntity.RegionCode    = Convert.ToString(godown["TNCSRegn"]);
                            stockDetailsEntity.RName         = Convert.ToString(godown["RGNAME"]);
                            stockDetailsEntity.GName         = Convert.ToString(godown["TNCSName"]);
                            stockDetailsEntity.TNCSCapacity  = Convert.ToDecimal(manageReport.DecimalformatForWeight(Convert.ToString(godown["TNCSCapacity"])));
                            // sqlParameters.Add(new KeyValuePair<string, string>("@ItemCode", _itemCode));



                            //get opening balance for particualr item.
                            DataRow[] openingBalance = dataSetMaster.Tables[0].Select("GodownCode='" + stockDetailsEntity.GodownCode + "' and CommodityCode='" + stockDetailsEntity.ItemCode + "'");

                            DataRow[] receiptuptoYesterday     = receiptUptoYesterday.Tables[0].Select("GCode='" + stockDetailsEntity.GodownCode + "' and ITCode='" + _itemCode + "'");
                            DataRow[] receipttotay             = todayReceipt.Tables[0].Select("GCode='" + stockDetailsEntity.GodownCode + "' and ITCode='" + _itemCode + "'");
                            DataRow[] issuesuptoYesterday      = issuesUptoYesterday.Tables[1].Select("GCode='" + stockDetailsEntity.GodownCode + "' and ITCode='" + _itemCode + "'");
                            DataRow[] issuestoday              = todayIssues.Tables[0].Select("GCode='" + stockDetailsEntity.GodownCode + "' and ITCode='" + _itemCode + "'");
                            DataRow[] otherIssuesuptoYesterday = issuesUptoYesterday.Tables[0].Select("GCode='" + stockDetailsEntity.GodownCode + "' and ITCode='" + _itemCode + "'");
                            DataRow[] otherIssuestoday         = todayIssues.Tables[1].Select("GCode='" + stockDetailsEntity.GodownCode + "' and ITCode='" + _itemCode + "'");

                            DataRow[] writeOFFuptoYesterday = issuesUptoYesterday.Tables[2].Select("GCode='" + stockDetailsEntity.GodownCode + "' and ITCode='" + _itemCode + "'");

                            _BookBalanceWeight     = 0;
                            _PhysicalBalanceWeight = 0;
                            _CumulitiveShortage    = 0;
                            _Shortage                 = 0;
                            _receiptuptoYesterday     = 0;
                            _receipttotay             = 0;
                            _issuesuptoYesterday      = 0;
                            _issuestoday              = 0;
                            _otherIssuesuptoYesterday = 0;
                            _otherIssuestoday         = 0;
                            _openingBookBalance       = 0;
                            _closingBookBalance       = 0;
                            _phycialbalance           = 0;
                            _writeOFFAll              = 0;
                            if (openingBalance != null && openingBalance.Count() > 0)
                            {
                                _BookBalanceWeight     = Convert.ToDecimal(manageReport.DecimalformatForWeight(Convert.ToString(openingBalance[0]["BookBalanceWeight"])));
                                _PhysicalBalanceWeight = Convert.ToDecimal(manageReport.DecimalformatForWeight(Convert.ToString(openingBalance[0]["PhysicalBalanceWeight"])));
                                _CumulitiveShortage    = Convert.ToDecimal(manageReport.DecimalformatForWeight(Convert.ToString(openingBalance[0]["CumulitiveShortage"])));
                                _Shortage = Convert.ToDecimal(manageReport.DecimalformatForWeight(Convert.ToString(openingBalance[0]["WriteOff"])));
                            }
                            if (receiptuptoYesterday != null && receiptuptoYesterday.Count() > 0)
                            {
                                _receiptuptoYesterday = Convert.ToDecimal(manageReport.DecimalformatForWeight(Convert.ToString(receiptuptoYesterday[0]["TOTAL"])));
                            }
                            if (receipttotay != null && receipttotay.Count() > 0)
                            {
                                _receipttotay = Convert.ToDecimal(manageReport.DecimalformatForWeight(Convert.ToString(receipttotay[0]["TOTAL"])));
                            }
                            if (issuesuptoYesterday != null && issuesuptoYesterday.Count() > 0)
                            {
                                _issuesuptoYesterday = Convert.ToDecimal(manageReport.DecimalformatForWeight(Convert.ToString(issuesuptoYesterday[0]["TOTAL"])));
                            }
                            if (issuestoday != null && issuestoday.Count() > 0)
                            {
                                _issuestoday = Convert.ToDecimal(manageReport.DecimalformatForWeight(Convert.ToString(issuestoday[0]["TOTAL"])));
                            }
                            if (otherIssuesuptoYesterday != null && otherIssuesuptoYesterday.Count() > 0)
                            {
                                _otherIssuesuptoYesterday = Convert.ToDecimal(manageReport.DecimalformatForWeight(Convert.ToString(otherIssuesuptoYesterday[0]["TOTAL"])));
                            }
                            if (otherIssuestoday != null && otherIssuestoday.Count() > 0)
                            {
                                _otherIssuestoday = Convert.ToDecimal(manageReport.DecimalformatForWeight(Convert.ToString(otherIssuestoday[0]["TOTAL"])));
                            }
                            if (writeOFFuptoYesterday.Count() > 0)
                            {
                                _writeOFFAll = Convert.ToDecimal(manageReport.DecimalformatForWeight(Convert.ToString(writeOFFuptoYesterday[0]["TOTAL"])));
                            }
                            _openingBookBalance = (_BookBalanceWeight + _receiptuptoYesterday) - (_issuesuptoYesterday + _otherIssuesuptoYesterday);
                            _closingBookBalance = (_openingBookBalance + _receipttotay) - (_issuestoday + _otherIssuestoday);
                            _CumulitiveShortage = _CumulitiveShortage - _writeOFFAll;
                            _phycialbalance     = _closingBookBalance - (_CumulitiveShortage + _Shortage);
                            _Shortage           = _CumulitiveShortage > 0 ? _Shortage : (_CumulitiveShortage + _Shortage);
                            _CumulitiveShortage = _CumulitiveShortage > 0 ? _CumulitiveShortage : 0;
                            stockDetailsEntity.OpeningBalance = _openingBookBalance;
                            stockDetailsEntity.ClosingBalance = _closingBookBalance;
                            stockDetailsEntity.PhycialBalance = _phycialbalance;
                            stockDetailsEntity.CSBalance      = _CumulitiveShortage;
                            stockDetailsEntity.Shortage       = _Shortage;
                            stockDetailsEntity.TotalReceipt   = _receipttotay;
                            stockDetailsEntity.IssueSales     = _issuestoday;
                            stockDetailsEntity.IssueOthers    = _otherIssuestoday;
                            stockDetailsEntity.LastUpdated    = DateTime.Now;
                            stockDetailsEntity.Remarks        = string.Empty;
                            stockDetailsEntity.Flag           = true;
                            // InsertData(stockDetailsEntity);
                            //}
                            // Data checking
                            decimal CheckData = stockDetailsEntity.OpeningBalance + stockDetailsEntity.ClosingBalance +
                                                stockDetailsEntity.TotalReceipt + stockDetailsEntity.IssueSales
                                                + stockDetailsEntity.IssueOthers;
                            if (CheckData > 0)
                            {
                                dailyStockDetailsEntities.Add(stockDetailsEntity);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                AuditLog.WriteError(" Process Daily Stock " + ex.Message);
            }
            ManageStockStatement manageStockStatement = new ManageStockStatement();

            Task.Run(() => manageStockStatement.GenerateStockStatementReport(dailyStockDetailsEntities, stockParameter)); //Generate the Report
            return(dailyStockDetailsEntities);
        }
Exemplo n.º 17
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("---------------------------------------------------------------------------------------------------------------------------------------------------------------|");
            }
        }
Exemplo n.º 18
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));
        }
Exemplo n.º 19
0
        /// <summary>
        ///  Write text file for Date wise record.
        /// </summary>
        /// <param name="sw">Text Streamwriter</param>
        /// <param name="entity">Common Entity</param>
        public void WriteDORegForDateWise(StreamWriter sw, CommonEntity entity)
        {
            int iCount       = 10;
            var distinctDate = entity.dataTable.DefaultView.ToTable(true, "DeliveryOrderDate");
            //Date wise DO report
            int    i                = 1;
            string sIssuer          = string.Empty;
            bool   CheckRepeatValue = false;
            string sDoNo            = string.Empty;

            foreach (DataRow dateValue in distinctDate.Rows)
            {
                iCount = 11;
                string    sDoNo1 = string.Empty;
                DataRow[] datas  = entity.dataTable.Select("DeliveryOrderDate='" + dateValue["DeliveryOrderDate"] + "'");
                AddHeader(sw, Convert.ToString(dateValue["DeliveryOrderDate"]));
                foreach (DataRow dr in datas)
                {
                    if (iCount >= 50)
                    {
                        //Add header again
                        iCount = 11;
                        sw.WriteLine("----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|");
                        sw.WriteLine((char)12);
                        AddHeader(sw, Convert.ToString(dateValue["DeliveryOrderDate"]));
                    }
                    sDoNo1 = dr["Dono"].ToString();
                    if (sDoNo == sDoNo1)
                    {
                        CheckRepeatValue = true;
                    }
                    else
                    {
                        CheckRepeatValue = false;
                        sDoNo            = sDoNo1;
                    }
                    sIssuer = Convert.ToString(dr["To_Whom_Issued"]).Trim();
                    sw.Write(report.StringFormat(CheckRepeatValue == false ? i.ToString() : " ", 4, 2));
                    sw.Write(report.StringFormat(CheckRepeatValue == false ? sDoNo1 : " ", 11, 1));
                    sw.Write(report.StringFormat(CheckRepeatValue == false ? report.Decimalformat(Convert.ToString(dr["Totals"])) : "-", 17, 1));
                    sw.Write(report.StringFormat(CheckRepeatValue == false ? sIssuer : " ", 15, 2));
                    sw.Write(report.StringFormat(dr["Cheque_DD"].ToString(), 11, 2));
                    sw.Write(report.StringFormat(report.Decimalformat(dr["PaymentAmount"].ToString()), 15, 1));
                    sw.Write(report.StringFormat(dr["Scheme"].ToString(), 13, 2));
                    sw.Write(report.StringFormat(dr["Commodity"].ToString(), 14, 2));
                    sw.Write(report.StringFormat(report.DecimalformatForWeight(dr["Netwt_Kgs"].ToString()), 11, 1));
                    sw.Write(report.StringFormat(report.Decimalformat(dr["Rate_Rs"].ToString()), 14, 1));
                    sw.Write(report.StringFormat(report.Decimalformat(dr["Itemamount"].ToString()), 15, 1));
                    sw.Write(report.StringFormat(report.Decimalformat(dr["PreviousAmount"].ToString()), 15, 1));
                    sw.Write(report.StringFormat(report.Decimalformat(dr["Adjusted"].ToString()), 13, 1));
                    sw.Write(report.StringFormat(report.Decimalformat(dr["Balance"].ToString()), 14, 1));
                    sw.Write(report.StringFormat(report.Decimalformat(dr["MarginAmount"].ToString()), 12, 1));
                    sw.WriteLine("");
                    int addedLines = 0;
                    if (!CheckRepeatValue)
                    {
                        addedLines = report.AddMoreContent(sw, sIssuer, 15, 35);
                    }

                    sw.WriteLine("    |           |                 |               |           |               |             |              |           |              |               |               |             |              |            |");
                    iCount = iCount + 2 + addedLines;
                    i      = CheckRepeatValue == false ? i + 1 : i;
                }
                sw.WriteLine("----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|");
                sw.WriteLine((char)12);
            }
        }
Exemplo n.º 20
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);
        }
Exemplo n.º 21
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);
            }
        }
        public List <QAObjectEntity> ProcessQAStatement(QuantityAccountEntity quantityAccountEntity)
        {
            string _itemCode      = string.Empty;
            string _ITDescription = string.Empty;

            List <QAObjectEntity> _qaObjectEntity = new List <QAObjectEntity>();

            try
            {
                ManageSQLConnection manageSQLConnection = new ManageSQLConnection();
                DataSet             dataSetMaster       = new DataSet();
                List <KeyValuePair <string, string> > sqlMasterParameters = new List <KeyValuePair <string, string> >();
                sqlMasterParameters.Add(new KeyValuePair <string, string>("@GCode", quantityAccountEntity.GCode));
                sqlMasterParameters.Add(new KeyValuePair <string, string>("@RCode", quantityAccountEntity.RCode));
                sqlMasterParameters.Add(new KeyValuePair <string, string>("@FromDate", quantityAccountEntity.FromDate));

                dataSetMaster = manageSQLConnection.GetDataSetValues("GetMasterDataForQuantityAccountCB", sqlMasterParameters);
                DataSet todayIssues          = new DataSet();
                DataSet todayReceipt         = new DataSet();
                DataSet issuesUptoYesterday  = new DataSet();
                DataSet receiptUptoYesterday = new DataSet();
                List <KeyValuePair <string, string> > sqlParameters = new List <KeyValuePair <string, string> >();
                sqlParameters.Add(new KeyValuePair <string, string>("@GCode", quantityAccountEntity.GCode));
                sqlParameters.Add(new KeyValuePair <string, string>("@RCode", quantityAccountEntity.RCode));
                sqlParameters.Add(new KeyValuePair <string, string>("@FromDate", quantityAccountEntity.FromDate));
                sqlParameters.Add(new KeyValuePair <string, string>("@ToDate", quantityAccountEntity.ToDate));
                todayIssues          = manageSQLConnection.GetDataSetValues("GetTodayIssuesForQuantityAccount", sqlParameters);
                todayReceipt         = manageSQLConnection.GetDataSetValues("GetTodayReceiptForQuantityAccount", sqlParameters);
                issuesUptoYesterday  = manageSQLConnection.GetDataSetValues("GetIssuesUptoYesterForQuantityAccount", sqlParameters);
                receiptUptoYesterday = manageSQLConnection.GetDataSetValues("GetReceiptUptoYesterForQuantityAccount", sqlParameters);
                if (dataSetMaster.Tables.Count > 0)
                {
                    foreach (DataRow item in dataSetMaster.Tables[1].Rows) // item master details.
                    {
                        _itemCode      = Convert.ToString(item["ITCode"]);
                        _ITDescription = Convert.ToString(item["ITDescription"]);
                        foreach (DataRow godown in dataSetMaster.Tables[2].Rows) // godown details.
                        {
                            QAObjectEntity objectEntity = new QAObjectEntity();
                            objectEntity.ItemCode  = _itemCode;
                            objectEntity.Commodity = _ITDescription;
                            objectEntity.GCode     = godown["TNCSCode"].ToString();
                            objectEntity.RCode     = godown["RGCODE"].ToString();
                            objectEntity.GName     = godown["TNCSName"].ToString();
                            objectEntity.RName     = godown["RGNAME"].ToString();
                            //get opening balance for particualr item.
                            DataRow[] openingBalance = dataSetMaster.Tables[0].Select("CommodityCode='" + _itemCode + "'");

                            DataRow[] receiptuptoYesterday = receiptUptoYesterday.Tables[0].Select("ITCode='" + _itemCode + "'");
                            // DataRow[] receipttotay = todayReceipt.Tables[0].Select("GCode='" + objectEntity.GCode + "' and ITCode='" + _itemCode + "'");
                            DataRow[] issuesuptoYesterday = issuesUptoYesterday.Tables[0].Select("ITCode='" + _itemCode + "'");
                            // DataRow[] issuestoday = todayIssues.Tables[0].Select("GCode='" + objectEntity.GCode + "' and ITCode='" + _itemCode + "'");
                            ClearVariable();

                            if (openingBalance != null && openingBalance.Count() > 0)
                            {
                                _BookBalanceWeight = Convert.ToDecimal(manageReport.DecimalformatForWeight(Convert.ToString(openingBalance[0]["BookBalanceWeight"])));
                                //_PhysicalBalanceWeight = Convert.ToDecimal(manageReport.DecimalformatForWeight(Convert.ToString(openingBalance[0]["PhysicalBalanceWeight"])));
                                //_CumulitiveShortage = Convert.ToDecimal(manageReport.DecimalformatForWeight(Convert.ToString(openingBalance[0]["CumulitiveShortage"])));
                                //_Shortage = Convert.ToDecimal(manageReport.DecimalformatForWeight(Convert.ToString(openingBalance[0]["WriteOff"])));
                            }
                            if (receiptuptoYesterday != null && receiptuptoYesterday.Count() > 0)
                            {
                                _receiptuptoYesterday = Convert.ToDecimal(manageReport.DecimalformatForWeight(Convert.ToString(receiptuptoYesterday[0]["TOTAL"])));
                            }

                            if (issuesuptoYesterday != null && issuesuptoYesterday.Count() > 0)
                            {
                                _issuesuptoYesterday = Convert.ToDecimal(manageReport.DecimalformatForWeight(Convert.ToString(issuesuptoYesterday[0]["TOTAL"])));
                            }

                            _OpeningBalance = (_BookBalanceWeight + _receiptuptoYesterday) - (_issuesuptoYesterday);

                            _RecPDS = GetValue(todayReceipt.Tables[0], dataSetMaster.Tables[3], objectEntity,
                                               EnumQAReceiptParameter.PDS.ToString());
                            _RecPRIORITY = GetValue(todayReceipt.Tables[0], dataSetMaster.Tables[3], objectEntity,
                                                    EnumQAReceiptParameter.PRIORITY.ToString());
                            _RecTIDEOVER = GetValue(todayReceipt.Tables[0], dataSetMaster.Tables[3], objectEntity,
                                                    EnumQAReceiptParameter.TIDEOVER.ToString());
                            _RecAAY = GetValue(todayReceipt.Tables[0], dataSetMaster.Tables[3], objectEntity,
                                               EnumQAReceiptParameter.AAY.ToString());
                            _RecSPLPDS = GetValue(todayReceipt.Tables[0], dataSetMaster.Tables[3], objectEntity,
                                                  EnumQAReceiptParameter.SPLPDS.ToString());
                            _RecCEMENT = GetValue(todayReceipt.Tables[0], dataSetMaster.Tables[3], objectEntity,
                                                  EnumQAReceiptParameter.CEMENT.ToString());
                            _RecHOPURCHASE = GetValue(todayReceipt.Tables[0], dataSetMaster.Tables[3], objectEntity,
                                                      EnumQAReceiptParameter.HOPURCHASE.ToString());
                            _RecSEIZUR = GetValue(todayReceipt.Tables[0], dataSetMaster.Tables[3], objectEntity,
                                                  EnumQAReceiptParameter.SEIZUR.ToString());

                            _RecPTMGRNMP = GetValue(todayReceipt.Tables[0], dataSetMaster.Tables[3], objectEntity,
                                                    EnumQAReceiptParameter.PTMGRNMP.ToString());
                            _RecSGRY = GetValue(todayReceipt.Tables[0], dataSetMaster.Tables[3], objectEntity,
                                                EnumQAReceiptParameter.SGRY.ToString());
                            _RecANNAPURNA = GetValue(todayReceipt.Tables[0], dataSetMaster.Tables[3], objectEntity,
                                                     EnumQAReceiptParameter.ANNAPURNA.ToString());

                            _RecRECEIVEDFROM = GetValue(todayReceipt.Tables[0], dataSetMaster.Tables[3], objectEntity,
                                                        EnumQAReceiptParameter.RECEIVEDFROM.ToString());
                            _RecTRANSFERWITHINREGION = GetValue(todayReceipt.Tables[0], dataSetMaster.Tables[3], objectEntity,
                                                                EnumQAReceiptParameter.TRANSFERWITHINREGION.ToString());
                            _RecTRANSFEROTHERREGION = GetValue(todayReceipt.Tables[0], dataSetMaster.Tables[3], objectEntity,
                                                               EnumQAReceiptParameter.TRANSFEROTHERREGION.ToString());
                            _RecEXCESS = GetValue(todayReceipt.Tables[0], dataSetMaster.Tables[3], objectEntity,
                                                  EnumQAReceiptParameter.EXCESS.ToString());
                            _RecCLEANINGANDPACKING = GetValue(todayReceipt.Tables[0], dataSetMaster.Tables[3], objectEntity,
                                                              EnumQAReceiptParameter.CLEANINGANDPACKING.ToString());
                            _RecVCFLOOD = GetValue(todayReceipt.Tables[0], dataSetMaster.Tables[3], objectEntity,
                                                   EnumQAReceiptParameter.VCFLOOD.ToString());
                            _RecSALESRETURN = GetValue(todayReceipt.Tables[0], dataSetMaster.Tables[3], objectEntity,
                                                       EnumQAReceiptParameter.SALESRETURN.ToString());

                            //issues details
                            _IsPDS = GetValue(todayIssues.Tables[0], dataSetMaster.Tables[4], objectEntity,
                                              EnumQAIssuesHeaderParameter.PDS.ToString());
                            _IsCOOP = GetValue(todayIssues.Tables[0], dataSetMaster.Tables[4], objectEntity,
                                               EnumQAIssuesHeaderParameter.COOP.ToString());
                            _IsPOLICE = GetValue(todayIssues.Tables[0], dataSetMaster.Tables[4], objectEntity,
                                                 EnumQAIssuesHeaderParameter.POLICE.ToString());
                            _IsNMP = GetValue(todayIssues.Tables[0], dataSetMaster.Tables[4], objectEntity,
                                              EnumQAIssuesHeaderParameter.NMP.ToString());
                            _IsBULK = GetValue(todayIssues.Tables[0], dataSetMaster.Tables[4], objectEntity,
                                               EnumQAIssuesHeaderParameter.BULK.ToString());
                            _IsCREDIT = GetValue(todayIssues.Tables[0], dataSetMaster.Tables[4], objectEntity,
                                                 EnumQAIssuesHeaderParameter.CREDIT.ToString());
                            _IsOAP = GetValue(todayIssues.Tables[0], dataSetMaster.Tables[4], objectEntity,
                                              EnumQAIssuesHeaderParameter.OAP.ToString());
                            _IsSRILANKA = GetValue(todayIssues.Tables[0], dataSetMaster.Tables[4], objectEntity,
                                                   EnumQAIssuesHeaderParameter.SRILANKA.ToString());
                            _IsAAY = GetValue(todayIssues.Tables[0], dataSetMaster.Tables[4], objectEntity,
                                              EnumQAIssuesHeaderParameter.AAY.ToString());
                            _IsSPLPDS = GetValue(todayIssues.Tables[0], dataSetMaster.Tables[4], objectEntity,
                                                 EnumQAIssuesHeaderParameter.SPLPDS.ToString());
                            _IsPDSCOOP = GetValue(todayIssues.Tables[0], dataSetMaster.Tables[4], objectEntity,
                                                  EnumQAIssuesHeaderParameter.PDSCOOP.ToString());
                            _IsCEMENTFLOOD = GetValue(todayIssues.Tables[0], dataSetMaster.Tables[4], objectEntity,
                                                      EnumQAIssuesHeaderParameter.CEMENTFLOOD.ToString());

                            _IsPTMGR = GetValue(todayIssues.Tables[0], dataSetMaster.Tables[4], objectEntity,
                                                EnumQAIssuesHeaderParameter.PTMGR.ToString());
                            _IsSGRY = GetValue(todayIssues.Tables[0], dataSetMaster.Tables[4], objectEntity,
                                               EnumQAIssuesHeaderParameter.SGRY.ToString());
                            _IsANNAPOORNA = GetValue(todayIssues.Tables[0], dataSetMaster.Tables[4], objectEntity,
                                                     EnumQAIssuesHeaderParameter.ANNAPOORNA.ToString());

                            _IsISSUESTOPROCESSING = GetValue(todayIssues.Tables[0], dataSetMaster.Tables[4], objectEntity,
                                                             EnumQAIssuesHeaderParameter.ISSUESTOPROCESSING.ToString());
                            _IsTRANSFERWITHINREGION = GetValue(todayIssues.Tables[0], dataSetMaster.Tables[4], objectEntity,
                                                               EnumQAIssuesHeaderParameter.TRANSFERWITHINREGION.ToString());
                            _IsTRANSFEROTHERREGION = GetValue(todayIssues.Tables[0], dataSetMaster.Tables[4], objectEntity,
                                                              EnumQAIssuesHeaderParameter.TRANSFEROTHERREGION.ToString());
                            _IsWRITEOFF = GetValue(todayIssues.Tables[0], dataSetMaster.Tables[4], objectEntity,
                                                   EnumQAIssuesHeaderParameter.WRITEOFF.ToString());
                            _IsCLEANING = GetValue(todayIssues.Tables[0], dataSetMaster.Tables[4], objectEntity,
                                                   EnumQAIssuesHeaderParameter.CLEANING.ToString());
                            _IsVCBLG = GetValue(todayIssues.Tables[0], dataSetMaster.Tables[4], objectEntity,
                                                EnumQAIssuesHeaderParameter.VCBLG.ToString());
                            _IsPURCHASERETURN = GetValue(todayIssues.Tables[0], dataSetMaster.Tables[4], objectEntity,
                                                         EnumQAIssuesHeaderParameter.PURCHASERETURN.ToString());


                            _Total = _RecPDS + _RecPRIORITY + _RecTIDEOVER + _RecAAY + _RecSPLPDS
                                     + _RecCEMENT + _RecHOPURCHASE + _RecSEIZUR;
                            objectEntity.OpeningBalance = _OpeningBalance;
                            objectEntity.RecPDS         = _RecPDS;
                            objectEntity.RecPRIORITY    = _RecPRIORITY;
                            objectEntity.RecTIDEOVER    = _RecTIDEOVER;
                            objectEntity.RecAAY         = _RecAAY;
                            objectEntity.RecSPLPDS      = _RecSPLPDS;
                            objectEntity.RecCEMENT      = _RecCEMENT;
                            objectEntity.RecHOPURCHASE  = _RecHOPURCHASE;
                            objectEntity.RecSEIZUR      = _RecSEIZUR;
                            objectEntity.Total          = _Total;
                            _TotalFreeRice                       = _RecPTMGRNMP + _RecSGRY + _RecANNAPURNA;
                            objectEntity.RecPTMGRNMP             = _RecPTMGRNMP;
                            objectEntity.RecSGRY                 = _RecSGRY;
                            objectEntity.RecANNAPURNA            = _RecANNAPURNA;
                            objectEntity.TotalFreeRice           = _TotalFreeRice;
                            objectEntity.RecRECEIVEDFROM         = _RecRECEIVEDFROM;
                            objectEntity.RecTRANSFERWITHINREGION = _RecTRANSFERWITHINREGION;
                            objectEntity.RecTRANSFEROTHERREGION  = _RecTRANSFEROTHERREGION;
                            objectEntity.RecEXCESS               = _RecEXCESS;
                            objectEntity.RecCLEANINGANDPACKING   = _RecCLEANINGANDPACKING;
                            objectEntity.RecVCFLOOD              = _RecVCFLOOD;
                            objectEntity.RecSALESRETURN          = _RecSALESRETURN;
                            _TotalOtherReceipt                   = _RecRECEIVEDFROM + _RecTRANSFERWITHINREGION + _RecTRANSFEROTHERREGION
                                                                   + _RecEXCESS + _RecCLEANINGANDPACKING + _RecSALESRETURN;
                            objectEntity.TotalOtherReceipt = _TotalOtherReceipt;
                            _TotalReceipt                  = _Total + _TotalFreeRice + _TotalOtherReceipt;
                            objectEntity.TotalReceipt      = _TotalReceipt;
                            _GrandTotalReceipt             = _TotalReceipt + _OpeningBalance;
                            objectEntity.GrandTotalReceipt = _GrandTotalReceipt;
                            //Issues Details.
                            objectEntity.IsPDS         = _IsPDS;
                            objectEntity.IsCOOP        = _IsCOOP;
                            objectEntity.IsPOLICE      = _IsPOLICE;
                            objectEntity.IsNMP         = _IsNMP;
                            objectEntity.IsBULK        = _IsBULK;
                            objectEntity.IsCREDIT      = _IsCREDIT;
                            objectEntity.IsOAP         = _IsOAP;
                            objectEntity.IsSRILANKA    = _IsSRILANKA;
                            objectEntity.IsAAY         = _IsAAY;
                            objectEntity.IsSPLPDS      = _IsSPLPDS;
                            objectEntity.IsPDSCOOP     = _IsPDSCOOP;
                            objectEntity.IsCEMENTFLOOD = _IsCEMENTFLOOD;
                            _IsTotalSales = _IsPDS + _IsCOOP + _IsPOLICE + _IsNMP + _IsBULK + _IsCREDIT
                                            + _IsOAP + _IsSRILANKA + _IsAAY + _IsSPLPDS + _IsPDSCOOP + _IsCEMENTFLOOD;
                            objectEntity.IsTotalSales           = _IsTotalSales;
                            objectEntity.IsPTMGR                = _IsPTMGR;
                            objectEntity.IsSGRY                 = _IsSGRY;
                            objectEntity.IsANNAPOORNA           = _IsANNAPOORNA;
                            _IsTotalFreeRiceIssues              = _IsPTMGR + _IsSGRY + _IsANNAPOORNA;
                            objectEntity.IsTotalFreeRiceIssues  = _IsTotalFreeRiceIssues;
                            objectEntity.IsISSUESTOPROCESSING   = _IsISSUESTOPROCESSING;
                            objectEntity.IsTRANSFERWITHINREGION = _IsTRANSFERWITHINREGION;
                            objectEntity.IsTRANSFEROTHERREGION  = _IsTRANSFEROTHERREGION;
                            objectEntity.IsWRITEOFF             = _IsWRITEOFF;
                            objectEntity.IsCLEANING             = _IsCLEANING;
                            objectEntity.IsVCBLG                = _IsVCBLG;
                            objectEntity.IsPURCHASERETURN       = _IsPURCHASERETURN;
                            _IsTotalOtherIssues                 = _IsISSUESTOPROCESSING + _IsTRANSFERWITHINREGION + _IsTRANSFEROTHERREGION
                                                                  + _IsWRITEOFF + _IsCLEANING + _IsVCBLG + _IsPURCHASERETURN;
                            objectEntity.IsTotalOtherIssues = _IsTotalOtherIssues;
                            _IsTotalIssues             = _IsTotalSales + _IsTotalFreeRiceIssues + _IsTotalOtherIssues;
                            objectEntity.IsTotalIssues = _IsTotalIssues;
                            _IsBalanceQty             = _GrandTotalReceipt - _IsTotalIssues;
                            objectEntity.IsBalanceQty = _IsBalanceQty;

                            if (_IsBalanceQty > 0 || _IsTotalOtherIssues > 0 || _IsTotalFreeRiceIssues > 0 || _IsTotalSales > 0 ||
                                _GrandTotalReceipt > 0 || _TotalReceipt > 0 || _TotalOtherReceipt > 0 || _Total > 0 || _TotalFreeRice > 0)
                            {
                                _qaObjectEntity.Add(objectEntity);
                            }
                            //decimal CheckData = stockDetailsEntity.OpeningBalance + stockDetailsEntity.ClosingBalance +
                            //               stockDetailsEntity.TotalReceipt + stockDetailsEntity.IssueSales
                            //               + stockDetailsEntity.IssueOthers;
                            //if (CheckData > 0)
                            //{
                            //    dailyStockDetailsEntities.Add(stockDetailsEntity);
                            //}
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                AuditLog.WriteError(" Process Daily Stock " + ex.Message);
            }
            //ManageStockStatement manageStockStatement = new ManageStockStatement();
            //Task.Run(() => manageStockStatement.GenerateStockStatementReport(dailyStockDetailsEntities, stockParameter)); //Generate the Report
            return(_qaObjectEntity);
        }
Exemplo n.º 23
0
        /// <summary>
        /// Add date wise stock issues
        /// </summary>
        /// <param name="sw">Stream writer</param>
        /// <param name="entity">Common eitity</param>
        public void DateWiseStockIssuesRegister(StreamWriter sw, CommonEntity entity)
        {
            int    count            = 10;
            var    dateList         = entity.dataSet.Tables[0].DefaultView.ToTable(true, "Issue_Date");
            int    i                = 1;
            string issueMemo        = string.Empty;
            string fromWhomRcd      = string.Empty;
            bool   CheckRepeatValue = false;
            string weighmentType    = string.Empty;

            foreach (DataRow date in dateList.Rows)
            {
                count = 11;
                string    issueMemoNext = string.Empty;
                DataRow[] data          = entity.dataSet.Tables[0].Select("Issue_Date='" + date["Issue_Date"] + "'");
                AddHeaderForDateWise(sw, Convert.ToString(date["Issue_Date"]));
                foreach (DataRow row in data)
                {
                    if (count >= 50)
                    {
                        //Add header again
                        count = 11;
                        sw.WriteLine("---------------------------------------------------------------------------------------------------------------------------------------------");
                        sw.WriteLine((char)12);
                        AddHeaderForDateWise(sw, Convert.ToString(date["Issue_Date"]));
                    }
                    weighmentType = row["ITBweighment"].ToString().ToUpper();
                    issueMemoNext = row["Issue_Memono"].ToString();
                    fromWhomRcd   = Convert.ToString(row["To_Whom_Issued"]).Trim();
                    if (issueMemo == issueMemoNext)
                    {
                        CheckRepeatValue = true;
                    }
                    else
                    {
                        CheckRepeatValue = false;
                        issueMemo        = issueMemoNext;
                    }
                    sw.Write(report.StringFormatWithoutPipe(CheckRepeatValue == false ? i.ToString() : " ", 4, 2));
                    sw.Write(report.StringFormatWithoutPipe(CheckRepeatValue == false ? issueMemoNext : " ", 11, 1));
                    sw.Write(report.StringFormatWithoutPipe(CheckRepeatValue == false ? row["DNo"].ToString() : " ", 11, 2));
                    sw.Write(report.StringFormatWithoutPipe(CheckRepeatValue == false ? row["Lorryno"].ToString() : " ", 11, 1));
                    sw.Write(report.StringFormatWithoutPipe(CheckRepeatValue == false ? fromWhomRcd : " ", 33, 2));
                    sw.Write(report.StringFormatWithoutPipe(row["Scheme"].ToString(), 12, 2));
                    sw.Write(report.StringFormatWithoutPipe(row["Stackno"].ToString(), 12, 1));
                    sw.Write(report.StringFormatWithoutPipe(row["NoPacking"].ToString(), 8, 1));
                    sw.Write(report.StringFormatWithoutPipe(row["Commodity"].ToString(), 17, 2));
                    sw.Write(report.StringFormatWithoutPipe(weighmentType == "NOS" ? row["NetWt"].ToString() : report.DecimalformatForWeight(row["NetWt"].ToString()), 14, 1));
                    sw.WriteLine("");
                    i = CheckRepeatValue == false ? i + 1 : i;
                    count++;
                }
                sw.WriteLine((char)12);
            }
            sw.WriteLine("---------------------------------------------------------------------------------------------------------------------------------------------");
            if (count == 11)
            {
                sw.WriteLine((char)12);
            }
        }
Exemplo n.º 24
0
        /// <summary>
        /// Add receipt item details
        /// </summary>
        /// <param name="streamWriter"></param>
        /// <param name="stockIssuesEntity"></param>
        private void AddDetails(StreamWriter streamWriter, List <StackCardRegisterEntity> stackCardRegisters, StackEntity stackEntity)
        {
            try
            {
                int     count       = 13;
                int     i           = 1;
                string  Fromdate    = string.Empty;
                string  Todate      = string.Empty;
                int     OpeningBag  = 0;
                int     ReceiptBag  = 0;
                int     IssuesBag   = 0;
                int     BalanceBag  = 0;
                int     GU          = 0;
                int     GR          = 0;
                decimal OpeningQty  = 0;
                decimal ReceiptQty  = 0;
                decimal IssuesQty   = 0;
                decimal BalanceQty  = 0;
                decimal WriteOffQty = 0;
                foreach (var item in stackCardRegisters)
                {
                    if (count > 50)
                    {
                        streamWriter.WriteLine("------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------");
                        count = 13;
                        streamWriter.WriteLine((char)12);
                        AddDocHeaderForIssues(streamWriter, stackEntity);
                    }
                    count++;
                    streamWriter.Write(report.StringFormatWithoutPipe(i.ToString(), 4, 1));
                    streamWriter.Write(report.StringFormatWithoutPipe(item.Commodity, 25, 2));
                    streamWriter.Write(report.StringFormatWithoutPipe(item.StackCard, 13, 2));
                    streamWriter.Write(report.StringFormatWithoutPipe(item.FromDate, 10, 2));
                    streamWriter.Write(report.StringFormatWithoutPipe(item.ToDate, 10, 2));
                    streamWriter.Write(report.StringFormatWithoutPipe(item.OpeningBag, 9, 1));
                    streamWriter.Write(report.StringFormatWithoutPipe(report.DecimalformatForWeight(item.OpeningQty), 11, 1));
                    streamWriter.Write(report.StringFormatWithoutPipe(item.ReceiptBag, 9, 1));
                    streamWriter.Write(report.StringFormatWithoutPipe(item.GU, 8, 1));
                    streamWriter.Write(report.StringFormatWithoutPipe(report.DecimalformatForWeight(item.ReceiptQty), 11, 1));
                    streamWriter.Write(report.StringFormatWithoutPipe(item.IssuesBag, 9, 1));
                    streamWriter.Write(report.StringFormatWithoutPipe(item.GR, 8, 1));
                    streamWriter.Write(report.StringFormatWithoutPipe(report.DecimalformatForWeight(item.IssuesQty), 11, 1));
                    streamWriter.Write(report.StringFormatWithoutPipe(item.BalanceBag, 9, 1));
                    streamWriter.Write(report.StringFormatWithoutPipe(report.DecimalformatForWeight(item.BalanceQty), 15, 1));
                    streamWriter.Write(report.StringFormatWithoutPipe(item.StackStatus, 5, 1));
                    streamWriter.Write(report.StringFormatWithoutPipe(report.DecimalformatForWeight(item.WriteOff), 9, 1));
                    streamWriter.WriteLine(" ");
                    streamWriter.WriteLine(" ");
                    OpeningBag += Convert.ToInt32(item.OpeningBag);
                    ReceiptBag += Convert.ToInt32(item.ReceiptBag);
                    IssuesBag  += Convert.ToInt32(item.IssuesBag);
                    BalanceBag += Convert.ToInt32(item.BalanceBag);
                    GU         += Convert.ToInt32(item.GU);
                    GR         += Convert.ToInt32(item.GR);

                    OpeningQty  += Convert.ToDecimal(item.OpeningQty);
                    ReceiptQty  += Convert.ToDecimal(item.ReceiptQty);
                    IssuesQty   += Convert.ToDecimal(item.IssuesQty);
                    BalanceQty  += Convert.ToDecimal(item.BalanceQty);
                    WriteOffQty += Convert.ToDecimal(item.WriteOff);
                    i            = i + 1;
                }
                streamWriter.WriteLine("------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------");

                streamWriter.Write(report.StringFormatWithoutPipe(" ", 4, 1));
                streamWriter.Write(report.StringFormatWithoutPipe("-", 13, 1));
                streamWriter.Write(report.StringFormatWithoutPipe("-", 10, 1));
                streamWriter.Write(report.StringFormatWithoutPipe("-", 10, 1));
                streamWriter.Write(report.StringFormatWithoutPipe(OpeningBag.ToString(), 9, 1));
                streamWriter.Write(report.StringFormatWithoutPipe(OpeningQty.ToString(), 11, 1));
                streamWriter.Write(report.StringFormatWithoutPipe(ReceiptBag.ToString(), 9, 1));
                streamWriter.Write(report.StringFormatWithoutPipe(GU.ToString(), 8, 1));
                streamWriter.Write(report.StringFormatWithoutPipe(ReceiptQty.ToString(), 11, 1));
                streamWriter.Write(report.StringFormatWithoutPipe(IssuesBag.ToString(), 9, 1));
                streamWriter.Write(report.StringFormatWithoutPipe(GR.ToString(), 8, 1));
                streamWriter.Write(report.StringFormatWithoutPipe(IssuesQty.ToString(), 11, 1));
                streamWriter.Write(report.StringFormatWithoutPipe(BalanceBag.ToString(), 9, 1));
                streamWriter.Write(report.StringFormatWithoutPipe(BalanceQty.ToString(), 15, 1));
                streamWriter.Write(report.StringFormatWithoutPipe("-", 5, 1));
                streamWriter.Write(report.StringFormatWithoutPipe(WriteOffQty.ToString(), 9, 1));
                streamWriter.WriteLine(" ");
                streamWriter.WriteLine("------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------");
                streamWriter.WriteLine((char)12);
            }
            catch (Exception ex)
            {
                AuditLog.WriteError(ex.Message + " " + ex.StackTrace);
            }
        }
Exemplo n.º 25
0
        public void AddDetails(iTextSharp.text.Document doc, DocumentStockReceiptList stockReceipt)
        {
            //streamWriter.WriteLine("||SNo |STACK NO   |COMMODITY           | SCHEME       |UNIT WEIGHT  |NO.OF UNIT |  Gross WEIGHT        NET   |% OF MOISTURE   ||");
            //streamWriter.WriteLine("||    |           |                    |              |             |  UNIT|   WEIGHT in Kgs/NOs |MOISTURE||");

            PdfPTable table = new PdfPTable(9);

            table.DefaultCell.Border = iTextSharp.text.Rectangle.NO_BORDER;
            //set overall width
            table.WidthPercentage = 100f;
            //set column widths
            int[] firstTablecellwidth = { 5, 8, 20, 12, 18, 7, 10, 10, 10 };
            table.SetWidths(firstTablecellwidth);

            PdfPCell cell = new PdfPCell(new Phrase("SNo", NormalFont));

            cell.HorizontalAlignment = Element.ALIGN_CENTER;
            table.AddCell(cell);

            cell = new PdfPCell(new Phrase("STACK NO", NormalFont));
            cell.HorizontalAlignment = Element.ALIGN_CENTER;
            table.AddCell(cell);

            cell = new PdfPCell(new Phrase("COMMODITY", NormalFont));
            cell.HorizontalAlignment = Element.ALIGN_CENTER;
            table.AddCell(cell);

            cell = new PdfPCell(new Phrase("SCHEME", NormalFont));
            cell.HorizontalAlignment = Element.ALIGN_CENTER;
            table.AddCell(cell);

            cell = new PdfPCell(new Phrase("UNIT WEIGHT", NormalFont));
            cell.HorizontalAlignment = Element.ALIGN_CENTER;
            table.AddCell(cell);

            cell = new PdfPCell(new Phrase("NO.OF UNIT", NormalFont));
            cell.HorizontalAlignment = Element.ALIGN_CENTER;
            table.AddCell(cell);

            cell = new PdfPCell(new Phrase("Gross WEIGHT", NormalFont));
            cell.HorizontalAlignment = Element.ALIGN_CENTER;
            table.AddCell(cell);

            cell = new PdfPCell(new Phrase("NET WEIGHT", NormalFont));
            cell.HorizontalAlignment = Element.ALIGN_CENTER;
            table.AddCell(cell);

            cell = new PdfPCell(new Phrase("% OF MOISTURE", NormalFont));
            cell.HorizontalAlignment = Element.ALIGN_CENTER;
            table.AddCell(cell);



            int i = 0;

            foreach (var item in stockReceipt.ItemList)
            {
                i++;
                cell = new PdfPCell(new Phrase(i.ToString(), NormalFont));
                cell.HorizontalAlignment = Element.ALIGN_CENTER;
                table.AddCell(cell);

                cell = new PdfPCell(new Phrase(item.TStockNo, NormalFont));
                cell.HorizontalAlignment = Element.ALIGN_LEFT;
                table.AddCell(cell);

                cell = new PdfPCell(new Phrase(item.CommodityName, NormalFont));
                cell.HorizontalAlignment = Element.ALIGN_LEFT;
                table.AddCell(cell);

                cell = new PdfPCell(new Phrase(item.SchemeName, NormalFont));
                cell.HorizontalAlignment = Element.ALIGN_LEFT;
                table.AddCell(cell);

                cell = new PdfPCell(new Phrase(item.PackingName, NormalFont));
                cell.HorizontalAlignment = Element.ALIGN_LEFT;
                table.AddCell(cell);

                cell = new PdfPCell(new Phrase(item.NoPacking.ToString(), NormalFont));
                cell.HorizontalAlignment = Element.ALIGN_RIGHT;
                table.AddCell(cell);

                cell = new PdfPCell(new Phrase(report.DecimalformatForWeight(item.GKgs.ToString()), NormalFont));
                cell.HorizontalAlignment = Element.ALIGN_RIGHT;
                table.AddCell(cell);

                cell = new PdfPCell(new Phrase(report.DecimalformatForWeight(item.Nkgs.ToString()), NormalFont));
                cell.HorizontalAlignment = Element.ALIGN_RIGHT;
                table.AddCell(cell);

                cell = new PdfPCell(new Phrase(item.Moisture.ToString(), NormalFont));
                cell.HorizontalAlignment = Element.ALIGN_RIGHT;
                table.AddCell(cell);
            }
            doc.Add(table);
        }
        public List <QAGunnyEntity> ProcessQAStatement(QuantityAccountEntity quantityAccountEntity)
        {
            string _itemCode      = string.Empty;
            string _ITDescription = string.Empty;

            List <QAGunnyEntity> _qaObjectEntity = new List <QAGunnyEntity>();

            try
            {
                ManageSQLConnection manageSQLConnection = new ManageSQLConnection();
                DataSet             dataSetMaster       = new DataSet();
                List <KeyValuePair <string, string> > sqlMasterParameters = new List <KeyValuePair <string, string> >();
                sqlMasterParameters.Add(new KeyValuePair <string, string>("@GCode", quantityAccountEntity.GCode));
                sqlMasterParameters.Add(new KeyValuePair <string, string>("@RCode", quantityAccountEntity.RCode));
                sqlMasterParameters.Add(new KeyValuePair <string, string>("@FromDate", quantityAccountEntity.FromDate));

                dataSetMaster = manageSQLConnection.GetDataSetValues("GetMasterDataForGunnyReceiptIssue", sqlMasterParameters);
                DataSet todayIssues          = new DataSet();
                DataSet todayReceipt         = new DataSet();
                DataSet issuesUptoYesterday  = new DataSet();
                DataSet receiptUptoYesterday = new DataSet();
                List <KeyValuePair <string, string> > sqlParameters = new List <KeyValuePair <string, string> >();
                sqlParameters.Add(new KeyValuePair <string, string>("@GCode", quantityAccountEntity.GCode));
                sqlParameters.Add(new KeyValuePair <string, string>("@RCode", quantityAccountEntity.RCode));
                sqlParameters.Add(new KeyValuePair <string, string>("@FromDate", quantityAccountEntity.FromDate));
                sqlParameters.Add(new KeyValuePair <string, string>("@ToDate", quantityAccountEntity.ToDate));
                todayIssues          = manageSQLConnection.GetDataSetValues("GetTodayIssuesForGunnyQuantityAccount", sqlParameters);
                todayReceipt         = manageSQLConnection.GetDataSetValues("GetTodayReceiptForGunnyQuantityAccount", sqlParameters);
                issuesUptoYesterday  = manageSQLConnection.GetDataSetValues("GetIssuesUptoYesterForGunnyQuantityAccount", sqlParameters);
                receiptUptoYesterday = manageSQLConnection.GetDataSetValues("GetReceiptUptoYesterForGunnyQuantityAccount", sqlParameters);
                if (dataSetMaster.Tables.Count > 0)
                {
                    foreach (DataRow item in dataSetMaster.Tables[1].Rows) // item master details.
                    {
                        _itemCode      = Convert.ToString(item["ITCode"]);
                        _ITDescription = Convert.ToString(item["ITDescription"]);
                        foreach (DataRow godown in dataSetMaster.Tables[2].Rows) // godown details.
                        {
                            QAGunnyEntity objectEntity = new QAGunnyEntity();
                            objectEntity.ItemCode  = _itemCode;
                            objectEntity.Commodity = _ITDescription;
                            objectEntity.GCode     = godown["TNCSCode"].ToString();
                            objectEntity.RCode     = godown["RGCODE"].ToString();
                            objectEntity.GName     = godown["TNCSName"].ToString();
                            objectEntity.RName     = godown["RGNAME"].ToString();
                            //get opening balance for particualr item.
                            DataRow[] openingBalance = dataSetMaster.Tables[0].Select("CommodityCode='" + _itemCode + "'");

                            DataRow[] receiptuptoYesterday = receiptUptoYesterday.Tables[0].Select("ITCode='" + _itemCode + "'");
                            DataRow[] issuesuptoYesterday  = issuesUptoYesterday.Tables[0].Select("ITCode='" + _itemCode + "'");
                            ClearVariable();

                            if (openingBalance != null && openingBalance.Count() > 0)
                            {
                                _BookBalanceWeight = Convert.ToDecimal(manageReport.DecimalformatForWeight(Convert.ToString(openingBalance[0]["BookBalanceWeight"])));
                            }
                            if (receiptuptoYesterday != null && receiptuptoYesterday.Count() > 0)
                            {
                                _receiptuptoYesterday = Convert.ToDecimal(manageReport.DecimalformatForWeight(Convert.ToString(receiptuptoYesterday[0]["TOTAL"])));
                            }

                            if (issuesuptoYesterday != null && issuesuptoYesterday.Count() > 0)
                            {
                                _issuesuptoYesterday = Convert.ToDecimal(manageReport.DecimalformatForWeight(Convert.ToString(issuesuptoYesterday[0]["TOTAL"])));
                            }

                            _OpeningBalance = (_BookBalanceWeight + _receiptuptoYesterday) - (_issuesuptoYesterday);

                            _RecPURCHASE = GetValue(todayReceipt.Tables[0], dataSetMaster.Tables[3], objectEntity,
                                                    EnumQAReceiptParameter.PURCHASE.ToString());
                            _RecHULLING = GetValue(todayReceipt.Tables[0], dataSetMaster.Tables[3], objectEntity,
                                                   EnumQAReceiptParameter.HULLING.ToString());
                            _RecGUNNYRELEASE = GetValue(todayReceipt.Tables[0], dataSetMaster.Tables[3], objectEntity,
                                                        EnumQAReceiptParameter.GUNNYRELEASE.ToString());
                            _RecHOPURCHASE = GetValue(todayReceipt.Tables[0], dataSetMaster.Tables[3], objectEntity,
                                                      EnumQAReceiptParameter.HOPURCHASE.ToString());

                            _RecTRANSFERWITHINREGION = GetValue(todayReceipt.Tables[0], dataSetMaster.Tables[3], objectEntity,
                                                                EnumQAReceiptParameter.TRANSFERWITHINREGION.ToString());
                            _RecTRANSFEROTHERREGION = GetValue(todayReceipt.Tables[0], dataSetMaster.Tables[3], objectEntity,
                                                               EnumQAReceiptParameter.TRANSFEROTHERREGION.ToString());
                            _RecEXCESS = GetValue(todayReceipt.Tables[0], dataSetMaster.Tables[3], objectEntity,
                                                  EnumQAReceiptParameter.EXCESS.ToString());

                            //issues details
                            _IsSALES = GetValue(todayIssues.Tables[0], dataSetMaster.Tables[4], objectEntity,
                                                EnumQAIssuesHeaderParameter.SALES.ToString());
                            _IsGUNNYRELEASE = GetValue(todayIssues.Tables[0], dataSetMaster.Tables[4], objectEntity,
                                                       EnumQAIssuesHeaderParameter.GU.ToString());
                            _IsMENDING = GetValue(todayIssues.Tables[0], dataSetMaster.Tables[4], objectEntity,
                                                  EnumQAIssuesHeaderParameter.MENDING.ToString());
                            _IsTRANSFERWITHINREGION = GetValue(todayIssues.Tables[0], dataSetMaster.Tables[4], objectEntity,
                                                               EnumQAIssuesHeaderParameter.TRANSFERWITHINREGION.ToString());
                            _IsTRANSFEROTHERREGION = GetValue(todayIssues.Tables[0], dataSetMaster.Tables[4], objectEntity,
                                                              EnumQAIssuesHeaderParameter.TRANSFEROTHERREGION.ToString());
                            _IsWRITEOFF = GetValue(todayIssues.Tables[0], dataSetMaster.Tables[4], objectEntity,
                                                   EnumQAIssuesHeaderParameter.WRITEOFF.ToString());


                            _Total = _RecPURCHASE + _RecHOPURCHASE + _RecHULLING + _RecGUNNYRELEASE + _RecEXCESS + _RecTRANSFERWITHINREGION + _RecTRANSFEROTHERREGION;
                            objectEntity.OpeningBalance          = _OpeningBalance;
                            objectEntity.RecPURCHASE             = _RecPURCHASE;
                            objectEntity.RecHULLING              = _RecHULLING;
                            objectEntity.RecGUNNYRELEASE         = _RecGUNNYRELEASE;
                            objectEntity.RecHOPURCHASE           = _RecHOPURCHASE;
                            objectEntity.Total                   = _Total;
                            objectEntity.RecTRANSFERWITHINREGION = _RecTRANSFERWITHINREGION;
                            objectEntity.RecTRANSFEROTHERREGION  = _RecTRANSFEROTHERREGION;
                            objectEntity.RecEXCESS               = _RecEXCESS;
                            _TotalReceipt                  = _Total;
                            objectEntity.TotalReceipt      = _TotalReceipt;
                            _GrandTotalReceipt             = _TotalReceipt + _OpeningBalance;
                            objectEntity.GrandTotalReceipt = _GrandTotalReceipt;
                            //Issues Details.
                            objectEntity.IsSALES        = _IsSALES;
                            objectEntity.IsGUNNYRELEASE = _IsGUNNYRELEASE;
                            objectEntity.IsMENDING      = _IsMENDING;
                            _IsTotalSales                       = _IsSALES + _IsGUNNYRELEASE + _IsMENDING + _IsWRITEOFF + _IsTRANSFERWITHINREGION + _IsTRANSFEROTHERREGION;
                            objectEntity.IsTotalSales           = _IsTotalSales;
                            objectEntity.IsTRANSFERWITHINREGION = _IsTRANSFERWITHINREGION;
                            objectEntity.IsTRANSFEROTHERREGION  = _IsTRANSFEROTHERREGION;
                            objectEntity.IsWRITEOFF             = _IsWRITEOFF;
                            _IsTotalIssues                      = _IsTotalSales;
                            objectEntity.IsTotalIssues          = _IsTotalIssues;
                            _IsBalanceQty                       = _GrandTotalReceipt - _IsTotalIssues;
                            objectEntity.IsBalanceQty           = _IsBalanceQty;

                            if (_IsBalanceQty > 0 || _IsTotalSales > 0 ||
                                _GrandTotalReceipt > 0 || _TotalReceipt > 0 || _Total > 0)
                            {
                                _qaObjectEntity.Add(objectEntity);
                            }
                            //decimal CheckData = stockDetailsEntity.OpeningBalance + stockDetailsEntity.ClosingBalance +
                            //               stockDetailsEntity.TotalReceipt + stockDetailsEntity.IssueSales
                            //               + stockDetailsEntity.IssueOthers;
                            //if (CheckData > 0)
                            //{
                            //    dailyStockDetailsEntities.Add(stockDetailsEntity);
                            //}
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                AuditLog.WriteError(" Process Daily Stock " + ex.Message);
            }
            //ManageStockStatement manageStockStatement = new ManageStockStatement();
            //Task.Run(() => manageStockStatement.GenerateStockStatementReport(dailyStockDetailsEntities, stockParameter)); //Generate the Report
            return(_qaObjectEntity);
        }
Exemplo n.º 27
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);
            }
        }