/// <summary> /// /// </summary> /// <param name="entity"></param> public void GenerateWriteOffReport(CommonEntity entity) { string fPath = string.Empty, subF_Path = string.Empty, fileName = string.Empty, filePath = string.Empty; StreamWriter streamWriter = null; try { fileName = entity.GCode + GlobalVariable.WriteOFFReportFileName; fPath = GlobalVariable.ReportPath + "Reports"; report.CreateFolderIfnotExists(fPath); // create a new folder if not exists subF_Path = fPath + "//" + entity.UserName; //ManageReport.GetDateForFolder(); report.CreateFolderIfnotExists(subF_Path); //delete file if exists filePath = subF_Path + "//" + fileName + ".txt"; report.DeleteFileIfExists(filePath); streamWriter = new StreamWriter(filePath, true); CommodityWiseIssueMemoReport(streamWriter, entity); streamWriter.Flush(); } catch (Exception ex) { AuditLog.WriteError(ex.Message + " " + ex.StackTrace); } finally { streamWriter.Close(); fPath = string.Empty; fileName = string.Empty; streamWriter = null; } }
/// <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> /// Generate the transaction receipt /// </summary> /// <param name="entity">Common entity</param> public void GenerateTransactionReceipt(CommonEntity entity) { string fPath = string.Empty, sPath = string.Empty, sFileName = string.Empty; string filePath = string.Empty; StreamWriter sw = null; try { GName = entity.dataSet.Tables[0].Rows[0]["Godownname"].ToString(); RegionName = entity.dataSet.Tables[0].Rows[0]["Region"].ToString(); sFileName = entity.GCode + GlobalVariable.TransactionReceiptFileName; fPath = GlobalVariable.ReportPath + "Reports"; report.CreateFolderIfnotExists(fPath); // create a new folder if not exists sPath = fPath + "//" + entity.UserName; //ManageReport.GetDateForFolder(); report.CreateFolderIfnotExists(sPath); //delete file if exists filePath = sPath + "//" + sFileName + ".txt"; report.DeleteFileIfExists(filePath); sw = new StreamWriter(filePath, true); WriteTransactionForAbstract(sw, entity); sw.Flush(); sw.Close(); //send mail to corresponding godown. } catch (Exception ex) { AuditLog.WriteError(ex.Message + " : " + ex.StackTrace); } }
/// <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); } }
/// <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); }
/// <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); } }
/// <summary> /// /// </summary> /// <param name="sw"></param> /// <param name="date"></param> public void AddHeader(StreamWriter sw, CommonEntity entity, int pageNo) { sw.WriteLine(" TamilNadu Civil Supplies Corporation " + entity.RName); sw.WriteLine(" Godown Name: " + entity.GName + " Stock Issue W/off Register "); sw.WriteLine(" Issue Date: " + report.FormatDate(entity.FromDate) + " To : " + report.FormatDate(entity.Todate) + " Page No :" + pageNo.ToString()); sw.WriteLine("-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------"); sw.WriteLine(" SNO. DATE DOCUMENT NO COMMODITY NET.WEIGHT STACK NO REMARKS"); sw.WriteLine("-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------"); }
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); } }
/// <summary> /// /// </summary> /// <param name="sw"></param> /// <param name="entity"></param> public void AddHeaderforAbstractStackAndCommodity(StreamWriter sw, CommonEntity entity) { sw.WriteLine(" Stock Receipt Abstract Report Date : " + ManageReport.GetCurrentDate()); sw.WriteLine(" "); sw.WriteLine(" "); sw.WriteLine("Abstract:" + report.FormatDate(entity.FromDate) + " - " + report.FormatDate(entity.Todate) + " Godown : " + GName + " Region :" + RName); sw.WriteLine("--------------------------------------------------------------------------|"); sw.WriteLine("StackNo |Commodity |No Bags |Net Wt (in Kgs)/Nos |"); sw.WriteLine("--------------------------------------------------------------------------|"); }
/// <summary> /// /// </summary> /// <param name="sw"></param> /// <param name="entity"></param> public void AddHeaderforAbstractDetails(StreamWriter sw, CommonEntity entity) { sw.WriteLine(" Hulling Rice Receipt Abstract Details of Godown: " + GName + " Report Date : " + ManageReport.GetCurrentDate()); sw.WriteLine(" "); // sw.WriteLine(" From:" + report.FormatDate(date) + " To:" + report.FormatDate(date) + " Weight in Kilo Grams Page No: 1"); sw.WriteLine(" Abstract:" + report.FormatDate(entity.FromDate) + " - " + report.FormatDate(entity.Todate) + " Region :" + RName); sw.WriteLine("---------------------------------------------------------------------------------------------------------|"); sw.WriteLine(" Hulling Name | Commodity | Bags | Net Wt (in Kgs)/Nos |"); sw.WriteLine("---------------------------------------------------------------------------------------------------------|"); }
/// <summary> /// Add header for Socity, Scheme and item wise abstract data /// </summary> /// <param name="sw">Text Streamwriter</param> /// <param name="entity">Common Entity</param> public void AddHeaderforAbstractSchemeandSociety(StreamWriter sw, CommonEntity entity) { sw.WriteLine(" Delivery Order Register Society Scheme and Rate Wise Abstract Report Date : " + ManageReport.GetCurrentDate()); sw.WriteLine(" "); sw.WriteLine(" "); sw.WriteLine("Delivery Order Date:" + report.FormatDate(entity.FromDate) + " - " + report.FormatDate(entity.Todate) + " Godown : " + GName + " Region :" + Regioncode); sw.WriteLine("----------------------------------------------------------------------------------------------------------------------------------------------|"); sw.WriteLine(" SOCIETY |ITEMS |SCHEME |Wt (Kgs/Nos) |RATE |AMOUNT |"); sw.WriteLine("----------------------------------------------------------------------------------------------------------------------------------------------|"); }
/// <summary> /// /// </summary> /// <param name="sw"></param> /// <param name="entity"></param> public void AddHeaderforAbstractCommodityWise(StreamWriter sw, CommonEntity entity) { sw.WriteLine(" Stock Receipt Register Commodity Wise Abstract Report Date : " + ManageReport.GetCurrentDate()); sw.WriteLine(" "); sw.WriteLine(" "); sw.WriteLine("Stock Receipt Register:" + report.FormatDate(entity.FromDate) + " - " + report.FormatDate(entity.Todate) + " Godown : " + GName + " Region :" + RName); sw.WriteLine("----------------------------------------------------------------------------------|"); sw.WriteLine("Commodity |Packing Type |No Bags |Net Wt (Kgs/Nos) |"); sw.WriteLine("----------------------------------------------------------------------------------|"); }
/// <summary> /// Add header for item wise abstract data /// </summary> /// <param name="sw">Text Streamwriter</param> /// <param name="entity">Common Entity</param> public void AddHeaderforAbstractItem(StreamWriter sw, CommonEntity entity) { sw.WriteLine(" Delivery Order Register Commodity and Rate Wise Abstract Report Date : " + ManageReport.GetCurrentDate()); sw.WriteLine(" "); sw.WriteLine(" "); sw.WriteLine("DO Date:" + report.FormatDate(entity.FromDate) + " - " + report.FormatDate(entity.Todate) + " Godown : " + GName + " Region :" + Regioncode); sw.WriteLine("-----------------------------------------------------------------------------|"); sw.WriteLine("ITEMS |Wt (Kgs/Nos) |RATE |AMOUNT |"); sw.WriteLine("-----------------------------------------------------------------------------|"); }
public void AddHeaderforTMCommodityAbstract(StreamWriter sw, CommonEntity commonEntity) { sw.WriteLine(" TAMILNADU CIVIL SUPPLIES CORPORATION Report Date : " + ManageReport.GetCurrentDate()); sw.WriteLine(" "); sw.WriteLine(" Truck Memo Register Abstract Region :" + Regioncode); sw.WriteLine(" "); sw.WriteLine("Issue Date:" + report.FormatDate(commonEntity.FromDate) + " To : " + report.FormatDate(commonEntity.Todate) + " (Net Wt in kgs/Klts/Nos) Godown : " + GName); sw.WriteLine("-----------------------------------------------------------------------------------------------------------------------------------"); sw.WriteLine("Recd.Type Commodity No bags Net Wt(in Kgs)/Nos "); sw.WriteLine("-----------------------------------------------------------------------------------------------------------------------------------"); }
/// <summary> /// Add header for Transaction receipt /// </summary> /// <param name="sw"></param> /// <param name="entity"></param> public void AddHeaderForTransactionReceipt(StreamWriter sw, CommonEntity entity) { sw.WriteLine(" TAMILNADU CIVIL SUPPLIES CORPORATION Report Date : " + ManageReport.GetCurrentDate()); sw.WriteLine(" "); sw.WriteLine(" Receipt Date Wise Abstract Details of " + GName + " Godown"); sw.WriteLine(" "); sw.WriteLine(" From: " + report.FormatDate(entity.FromDate) + " to " + report.FormatDate(entity.Todate) + " Weight in Kilo Grams"); sw.WriteLine("------------------------------------------------------------------------------------"); sw.WriteLine(" Commodity Date Transaction Net Weight "); sw.WriteLine("------------------------------------------------------------------------------------"); }
/// <summary> /// /// </summary> /// <param name="sw"></param> /// <param name="date"></param> public void AddHeader(StreamWriter sw, CommonEntity entity) { sw.WriteLine(" TAMILNADU CIVIL SUPPLIES CORPORATION " + RName); sw.WriteLine(" "); sw.WriteLine(" Issue Memo Datewise Details of - Commodity Godown : " + GName); sw.WriteLine(" "); sw.WriteLine(" From:" + report.FormatDate(entity.FromDate) + " To : " + report.FormatDate(entity.Todate)); sw.WriteLine("--------------------------------------------------------------------------------------------------------------"); sw.WriteLine("S.No I.MEMO NO Date Commodity NET Weight(Kgs) ISSUED TO Lorry No "); sw.WriteLine("---------------------------------------------------------------------------------------------------------------"); }
/// <summary> /// /// </summary> /// <param name="sw"></param> /// <param name="date"></param> public void AddAbstractHeader(StreamWriter sw, CommonEntity entity) { sw.WriteLine(" TAMILNADU CIVIL SUPPLIES CORPORATION " + RName); sw.WriteLine(" "); sw.WriteLine(" Issue memo Abstract Details of " + SCName + " Scheme Godown : " + GName); sw.WriteLine(" "); sw.WriteLine(" From:" + report.FormatDate(entity.FromDate) + " To : " + report.FormatDate(entity.Todate)); sw.WriteLine("--------------------------------------------------------"); sw.WriteLine(" Commodity Net Weight(Kgs) "); sw.WriteLine("--------------------------------------------------------"); }
/// <summary> /// /// </summary> /// <param name="sw"></param> /// <param name="date"></param> public void AddHeader(StreamWriter sw, CommonEntity entity) { sw.WriteLine(" TAMILNADU CIVIL SUPPLIES CORPORATION " + RName); sw.WriteLine(" "); sw.WriteLine(" Issue memo Date wise Details of " + SCName + " Scheme Godown : " + GName); sw.WriteLine(" "); sw.WriteLine(" From:" + report.FormatDate(entity.FromDate) + " To : " + report.FormatDate(entity.Todate)); sw.WriteLine("------------------------------------------------------------------------------------------------------------------"); sw.WriteLine("S.No Receipt.NO Date Commodity Net Weight(Kgs) Received From T.MEMO.NO Lorry No "); sw.WriteLine("------------------------------------------------------------------------------------------------------------------"); }
/// <summary> /// Add header for receiver and scheme wise abstract details /// </summary> /// <param name="sw">streamwriter</param> /// <param name="entity">common entity</param> public void AddheaderForReceiverTypeAndSchemewiseAbstract(StreamWriter sw, CommonEntity entity) { sw.WriteLine(" TAMILNADU CIVIL SUPPLIES CORPORATION Report Date : " + ManageReport.GetCurrentDate()); sw.WriteLine(" "); sw.WriteLine(" Stock Issue Register Scheme Wise Abstract"); sw.WriteLine(" "); sw.WriteLine("Issue Date:" + report.FormatDate(entity.FromDate) + "Godown : " + GName + " Region :" + RName); sw.WriteLine("-----------------------------------------------------------------------------------------------------------------------------------"); sw.WriteLine("ISSUER TYPE Scheme Commodity No Bags Wt(Kgs\\Nos)"); sw.WriteLine("-----------------------------------------------------------------------------------------------------------------------------------"); sw.WriteLine(""); }
/// <summary> /// Add header for Commodity wise abstract details /// </summary> /// <param name="sw">streamwriter</param> /// <param name="entity">common entity</param> public void AddheaderForCommoditywiseAbstract(StreamWriter sw, CommonEntity entity) { sw.WriteLine(" TAMILNADU CIVIL SUPPLIES CORPORATION Report Date : " + ManageReport.GetCurrentDate()); sw.WriteLine(" "); sw.WriteLine(" Stock Issue Register COMMODITY Wise Abstract "); sw.WriteLine(" "); sw.WriteLine("Issue Date:" + report.FormatDate(entity.FromDate) + "Godown : " + GName + " Region :" + RName); sw.WriteLine("-----------------------------------------------------------------------------------------------------------------------------------"); sw.WriteLine(" Commodity No Bags Net Wt (in Kgs)\\Nos"); sw.WriteLine("-----------------------------------------------------------------------------------------------------------------------------------"); sw.WriteLine(""); }
/// <summary> /// /// </summary> /// <param name="sw"></param> /// <param name="date"></param> public void AddHeader(StreamWriter sw, CommonEntity entity) { sw.WriteLine(" TAMILNADU CIVIL SUPPLIES CORPORATION " + RName); sw.WriteLine(" "); sw.WriteLine(" Receipt Datewise Details of - " + TRName + " - " + ITName + " Godown : " + GName); sw.WriteLine(" "); sw.WriteLine(" From:" + report.FormatDate(entity.FromDate) + " To : " + report.FormatDate(entity.Todate) + " "); sw.WriteLine("------------------------------------------------------------------------------------------------------------------------------------------------------------------|"); sw.WriteLine("S.No| Ack No |Date | Commodity | Bags | Qty(Kgs)/NO's | Received From | Lorry No | T.MEMO.NO | T.MEMO DT | ORDERNO | EXCESS | SHORT |"); sw.WriteLine("------------------------------------------------------------------------------------------------------------------------------------------------------------------|"); sw.WriteLine(" | | | | | | | | | | | | |"); }
/// <summary> /// /// </summary> /// <param name="sw"></param> /// <param name="date"></param> public void AddHeader(StreamWriter sw, CommonEntity entity) { sw.WriteLine(" TAMILNADU CIVIL SUPPLIES CORPORATION Region: " + RName + " Report Date : " + ManageReport.GetCurrentDate()); sw.WriteLine(" "); sw.WriteLine(" Hulling Rice Receipt Details of " + GName + " Godown "); sw.WriteLine(" "); sw.WriteLine(" From:" + report.FormatDate(entity.FromDate) + " To:" + report.FormatDate(entity.Todate) + " Weight in Kilo Grams Page No: 1"); sw.WriteLine("------------------------------------------------------------------------------------------------------------------------------------------|"); sw.WriteLine("S.No| Ack No | Date | Hulling Name | Commodity | Bags | Net Weight |"); sw.WriteLine("------------------------------------------------------------------------------------------------------------------------------------------|"); // sw.WriteLine(" | | | | | | |"); }
public void TruckMemoRegAbstract(StreamWriter sw, CommonEntity entity) { // var distinctDate = entity.dataSet.Tables[0].DefaultView.ToTable(true, "Issue_Date"); //Date wise DO report int iCount = 11; string sIssuer = string.Empty; string sDoNo = string.Empty; //foreach (DataRow dateValue in distinctDate.Rows) //{ iCount = 11; string sDoNo1 = string.Empty; List <TruckMemoRegEntity> dORegEntities = new List <TruckMemoRegEntity>(); dORegEntities = report.ConvertDataTableToList <TruckMemoRegEntity>(entity.dataSet.Tables[0]); // Gets the group by values based on ths column To_Whom_Issued, Commodity,Scheme var myResult = from a in dORegEntities orderby a.Commodity, a.Stackno ascending group a by new { a.Stackno, a.Commodity } into gValue select new { NoBags = gValue.Sum(s => s.NoBags), NetWt = gValue.Sum(s => s.NetWt), GroupByNames = gValue.Key }; AddHeaderforTMAbstract(sw, entity); foreach (var item in myResult) { if (iCount >= 50) { //Add header again iCount = 11; sw.WriteLine("-----------------------------------------------------------------------------------------------------------------------------------"); sw.WriteLine((char)12); AddHeaderforTMAbstract(sw, entity); } sw.Write(report.StringFormatWithoutPipe(item.GroupByNames.Stackno, 13, 2)); sw.Write(report.StringFormatWithoutPipe(item.GroupByNames.Commodity, 44, 2)); sw.Write(report.StringFormatWithoutPipe(item.NoBags.ToString(), 10, 1)); sw.Write(report.StringFormatWithoutPipe(report.DecimalformatForWeight(item.NetWt.ToString()), 25, 1)); iCount++; sw.WriteLine(""); } sw.WriteLine("-----------------------------------------------------------------------------------------------------------------------------------"); sw.WriteLine((char)12); // } }
/// <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); } }
public void GenerateDeliveryOrderForRegister(CommonEntity entity) { string fPath = string.Empty, sPath = string.Empty, sFileName = string.Empty; string filePath = string.Empty; StreamWriter sw = null; try { GName = entity.dataTable.Rows[0]["Godown"].ToString(); Regioncode = entity.dataTable.Rows[0]["Region"].ToString(); sFileName = entity.GCode + GlobalVariable.StockDORegisterFileName; fPath = GlobalVariable.ReportPath + "Reports"; report.CreateFolderIfnotExists(fPath); // create a new folder if not exists sPath = fPath + "//" + entity.UserName; //ManageReport.GetDateForFolder(); report.CreateFolderIfnotExists(sPath); //delete file if exists filePath = sPath + "//" + sFileName + ".txt"; report.DeleteFileIfExists(filePath); sw = new StreamWriter(filePath, true); WriteDORegForDateWise(sw, entity); // sw.WriteLine((char)12); List <DORegEntity> dORegEntities = new List <DORegEntity>(); dORegEntities = report.ConvertDataTableToList <DORegEntity>(entity.dataTable); WriteDORegforSocityandScheme(sw, dORegEntities, entity); WriteDORegforItemandScheme(sw, dORegEntities, entity); WriteDORegforItem(sw, dORegEntities, entity); sw.Flush(); //send mail to corresponding godown. } catch (Exception ex) { AuditLog.WriteError("GenerateDeliveryOrderForRegister " + ex.Message + " : " + ex.StackTrace); } finally { sw.Close(); sw = null; fPath = string.Empty; sFileName = string.Empty; } }
/// <summary> /// /// </summary> /// <param name="entity"></param> public void GenerateStockReceiptRegister(CommonEntity entity) { string fPath = string.Empty, subF_Path = string.Empty, fileName = string.Empty, filePath = string.Empty; StreamWriter streamWriter = null; try { GName = entity.dataSet.Tables[0].Rows[0]["Godownname"].ToString(); RName = entity.dataSet.Tables[0].Rows[0]["Region"].ToString(); fileName = entity.GCode + GlobalVariable.StockReceiptRegisterFileName; fPath = GlobalVariable.ReportPath + "Reports"; report.CreateFolderIfnotExists(fPath); // create a new folder if not exists subF_Path = fPath + "//" + entity.UserName; //ManageReport.GetDateForFolder(); report.CreateFolderIfnotExists(subF_Path); //delete file if exists filePath = subF_Path + "//" + fileName + ".txt"; report.DeleteFileIfExists(filePath); streamWriter = new StreamWriter(filePath, true); DateWiseStockReceiptRegister(streamWriter, entity); List <StockReceiptList> stockReceiptList = new List <StockReceiptList>(); stockReceiptList = report.ConvertDataTableToList <StockReceiptList>(entity.dataSet.Tables[0]); // DateWiseStockReceiptRegister(streamWriter, entity); StockReceiptAbstractRecdTypeAndSchemeWise(streamWriter, stockReceiptList, entity); StockReceiptAbstractSchemeAndCommodityWise(streamWriter, stockReceiptList, entity); StockReceiptAbstractStackNoAndCommodity(streamWriter, stockReceiptList, entity); StockReceiptAbstractCommodityWise(streamWriter, stockReceiptList, entity); streamWriter.Flush(); } catch (Exception ex) { AuditLog.WriteError(ex.Message + " " + ex.StackTrace); } finally { streamWriter.Close(); fPath = string.Empty; fileName = string.Empty; streamWriter = null; } }
///</summary> /// /// <param name="sw"></param> /// <param name="entity"></param> public void DateWiseHullingDetails(StreamWriter sw, CommonEntity entity) { int iCount = 11; int i = 1; string SRNO = string.Empty; bool isDataAvailable = false; // foreach (DataRow dateValue in distinctDate.Rows) //{ isDataAvailable = true; AddHeader(sw, entity); // DataRow[] datas = entity.dataSet.Tables[0].Select("HullingReportDate='" + dateValue["HullingReportDate"] + "'"); foreach (DataRow dr in entity.dataSet.Tables[0].Rows) { if (iCount >= 50) { iCount = 11; sw.WriteLine("------------------------------------------------------------------------------------------------------------------------------------------|"); sw.WriteLine((char)12); AddHeader(sw, entity); } //sIssuer = Convert.ToString(dr["DepositorName"]).Trim(); sw.Write(report.StringFormatWithoutPipe(i.ToString(), 4, 2)); sw.Write(report.StringFormatWithoutPipe(dr["SRNo"].ToString(), 18, 2)); sw.Write(report.StringFormatWithoutPipe(report.FormatDirectDate(dr["SRDate"].ToString()), 16, 2)); sw.Write(report.StringFormatWithoutPipe(Convert.ToString(dr["DepositorName"]).Trim(), 37, 2)); sw.Write(report.StringFormatWithoutPipe(dr["ITDescription"].ToString(), 26, 2)); sw.Write(report.StringFormatWithoutPipe(dr["NoPacking"].ToString(), 12, 1)); sw.Write(report.StringFormatWithoutPipe(dr["Nkgs"].ToString(), 19, 1)); sw.WriteLine(""); sw.WriteLine(" "); i = i + 1; iCount++; } sw.WriteLine("------------------------------------------------------------------------------------------------------------------------------------------|"); sw.WriteLine((char)12); if (!isDataAvailable) { sw.WriteLine("---------------------------------------------------------------------------------------------------------------------------------------|"); sw.WriteLine((char)12); } }
/// <summary> /// /// </summary> /// <param name="sw"></param> /// <param name="entity"></param> public void DateWiseCommodityIssueMemoReport(StreamWriter sw, CommonEntity entity) { try { int count = 10; // var dateList = entity.dataSet.Tables[0].DefaultView.ToTable(true, "Issue_Date"); int i = 1; string issuedTo = string.Empty; AddHeader(sw, entity); 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); } issuedTo = Convert.ToString(row["Issuedto"]).Trim(); sw.Write(report.StringFormatWithoutPipe(i.ToString(), 4, 2)); sw.Write(report.StringFormatWithoutPipe(row["Issue_Memono"].ToString(), 16, 1)); sw.Write(report.StringFormatWithoutPipe(row["Issue_Date"].ToString(), 10, 1) + " "); sw.Write(report.StringFormatWithoutPipe(row["Commodity"].ToString(), 17, 2)); sw.Write(report.StringFormatWithoutPipe(row["Quantity"].ToString(), 18, 1)); sw.Write(report.StringFormatWithoutPipe(issuedTo, 24, 2)); sw.Write(report.StringFormatWithoutPipe(row["Lorryno"].ToString(), 11, 1)); sw.WriteLine(""); sw.WriteLine(" "); i = i + 1; count = count + 2; } sw.WriteLine("---------------------------------------------------------------------------------------------------------------"); sw.WriteLine((char)12); } catch (Exception ex) { AuditLog.WriteError(ex.Message); } }
/// <summary> /// /// </summary> /// <param name="entity"></param> public void GenerateHullingReport(CommonEntity entity) { //AuditLog.WriteError("GenerateHullingReport"); string fPath = string.Empty, subF_Path = string.Empty, fileName = string.Empty, filePath = string.Empty; StreamWriter streamWriter = null; try { GName = entity.dataSet.Tables[0].Rows[0]["Godownname"].ToString(); RName = entity.dataSet.Tables[0].Rows[0]["Region"].ToString(); fileName = entity.GCode + GlobalVariable.HullingDetailsReportFileName; fPath = GlobalVariable.ReportPath + "Reports"; report.CreateFolderIfnotExists(fPath); // create a new folder if not exists subF_Path = fPath + "//" + entity.UserName; //ManageReport.GetDateForFolder(); report.CreateFolderIfnotExists(subF_Path); //delete file if exists filePath = subF_Path + "//" + fileName + ".txt"; report.DeleteFileIfExists(filePath); streamWriter = new StreamWriter(filePath, true); DateWiseHullingDetails(streamWriter, entity); List <HullingReportEntity> hullingReportList = new List <HullingReportEntity>(); hullingReportList = report.ConvertDataTableToList <HullingReportEntity>(entity.dataSet.Tables[0]); HullingDetailsAbstract(streamWriter, hullingReportList, entity); streamWriter.Flush(); } catch (Exception ex) { AuditLog.WriteError(ex.Message + " " + ex.StackTrace); } finally { streamWriter.Close(); fPath = string.Empty; fileName = string.Empty; streamWriter = null; } }
/// <summary> /// Write text file for item wise abstract data /// </summary> /// <param name="sw">Text Streamwriter</param> /// <param name="hullingReportList">DOReg entity</param> /// <param name="entity">Common Entity</param> public void HullingDetailsAbstract(StreamWriter sw, List <HullingReportEntity> hullingReportList, CommonEntity entity) { try { int iCount = 11; var myResultItem = from a in hullingReportList group a by new { a.ITDescription, a.DepositorName } into gValue select new { Nkgs = gValue.Sum(s => s.Nkgs), NoPacking = gValue.Sum(s => s.NoPacking), GroupByNames = gValue.Key }; double dAmount = 0; AddHeaderforAbstractDetails(sw, entity); foreach (var item in myResultItem) { if (iCount >= 50) { iCount = 11; sw.WriteLine("----------------------------------------------------------------------------------------------------------------------|"); sw.WriteLine((char)12); AddHeaderforAbstractDetails(sw, entity); } sw.Write(report.StringFormat(item.GroupByNames.DepositorName, 37, 2)); sw.Write(report.StringFormat(item.GroupByNames.ITDescription, 26, 2)); sw.Write(report.StringFormat(report.Decimalformat(item.NoPacking.ToString()), 12, 1)); sw.Write(report.StringFormat(report.Decimalformat(item.Nkgs.ToString()), 27, 1)); // sw.Write(report.StringFormat(report.Decimalformat(item.Itemamount.ToString()), 20, 1)); dAmount = dAmount + item.Nkgs; iCount++; sw.WriteLine(""); sw.WriteLine(""); } // Add toal values sw.WriteLine("---------------------------------------------------------------------------------------------------------|"); sw.Write(report.StringFormat("Total Amount", 64, 1)); sw.Write(report.StringFormat(report.Decimalformat(dAmount.ToString()), 40, 1)); sw.WriteLine(""); sw.WriteLine("---------------------------------------------------------------------------------------------------------|"); sw.WriteLine((char)12); } catch (Exception ex) { AuditLog.WriteError(ex.Message + " : " + ex.StackTrace); } }