/// <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); } }
/// <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); } }