/// <summary> /// Add header for document receipt /// </summary> /// <param name="streamWriter">Stream writer to write the text file.</param> /// <param name="stockReceipt"></param> /// <param name="isDuplicate"></param> public void AddDocHeaderForReceipt(StreamWriter streamWriter, DocumentStockReceiptList stockReceipt, bool isDuplicate = false) { streamWriter.WriteLine("|----------------------------------------------------------------------------------------------------------|"); streamWriter.WriteLine("| |"); streamWriter.WriteLine("| |"); streamWriter.WriteLine("| TAMILNADU CIVIL SUPPLIES CORPORATION |"); streamWriter.Write("| "); streamWriter.Write(report.StringFormatWithoutPipe("REGION : ", 9, 1)); streamWriter.Write(report.StringFormat(stockReceipt.RegionName, 53, 2)); streamWriter.WriteLine(""); streamWriter.WriteLine("| |"); streamWriter.WriteLine("| |"); if (isDuplicate) { streamWriter.WriteLine("| STOCK RECEIPT ACKNOWLEDGMENT DUPLICATE COPY |"); } else { streamWriter.WriteLine("| STOCK RECEIPT ACKNOWLEDGMENT |"); } streamWriter.WriteLine("|----------------------------------------------------------------------------------------------------------|"); streamWriter.Write("|ACKNOWLEDGEMENT NO:"); streamWriter.Write(report.StringFormatWithoutPipe(stockReceipt.SRNo, 21, 2)); streamWriter.Write("ALLOTMENT/RELEASE ORDER: "); streamWriter.Write(report.StringFormatWithoutPipe(stockReceipt.OrderNo + " " + stockReceipt.PAllotment, 16, 2)); streamWriter.Write("GATE PASS : "******"", 10, 2)); streamWriter.Write("|"); streamWriter.WriteLine(" "); streamWriter.Write("| DATE:"); streamWriter.Write(report.StringFormatWithoutPipe(report.FormatDate(stockReceipt.SRDate.ToString()), 21, 2)); streamWriter.Write(report.StringFormatWithoutPipe("DATE: ", 25, 1)); streamWriter.Write(report.StringFormatWithoutPipe(report.FormatDate(stockReceipt.OrderDate.ToString()), 38, 2)); streamWriter.Write("|"); streamWriter.WriteLine(" "); streamWriter.Write("|PERIOD OF ALLOTMENT:"); streamWriter.Write(report.StringFormatWithoutPipe(report.FormatDate(stockReceipt.SRDate.ToString()), 30, 2)); streamWriter.Write("Transaction Type: "); streamWriter.Write(report.StringFormatWithoutPipe(stockReceipt.TransactionName, 36, 2)); streamWriter.Write("|"); streamWriter.WriteLine(" "); streamWriter.Write("|RECEIVING GODOWN:"); streamWriter.Write(report.StringFormatWithoutPipe(stockReceipt.GodownName, 30, 2)); streamWriter.Write("DEPOSITOR'S NAME:"); streamWriter.Write(report.StringFormatWithoutPipe(stockReceipt.DepositorName, 40, 2)); streamWriter.Write("|"); streamWriter.WriteLine(" "); streamWriter.WriteLine("|----------------------------------------------------------------------------------------------------------|"); streamWriter.WriteLine("||--------------------------------------------------------------------------------------------------------||"); streamWriter.WriteLine("||SNo |STACK NO |COMMODITY | SCHEME |UNIT WEIGHT |NO.OF | Gross NET |% OF ||"); streamWriter.WriteLine("|| | | | | | UNIT| WEIGHT in Kgs/NOs |MOISTURE||"); streamWriter.WriteLine("||--------------------------------------------------------------------------------------------------------||"); }
/// <summary> /// Add header for document receipt /// </summary> /// <param name="streamWriter">Stream writer to write the text file.</param> /// <param name="truckMemoList"></param> /// <param name="isDuplicate"></param> public void AddDocHeaderForTruckMemo(StreamWriter streamWriter, DocumentStockTransferDetails truckMemoList, bool isDuplicate = false) { streamWriter.WriteLine("|----------------------------------------------------------------------------------------------------------|"); streamWriter.WriteLine("| |"); streamWriter.WriteLine("| |"); streamWriter.WriteLine("| TAMILNADU CIVIL SUPPLIES CORPORATION |"); streamWriter.Write("| "); streamWriter.Write(report.StringFormatWithoutPipe("REGION : ", 9, 1)); streamWriter.Write(report.StringFormat(truckMemoList.RegionName, 53, 2)); streamWriter.WriteLine(""); streamWriter.WriteLine("| |"); streamWriter.WriteLine("| |"); if (isDuplicate) { streamWriter.WriteLine("| STOCK ISSUE TRUCK MEMO DUPLICATE COPY |"); } else { streamWriter.WriteLine("| STOCK ISSUE TRUCK MEMO |"); } streamWriter.WriteLine("|----------------------------------------------------------------------------------------------------------|"); streamWriter.Write("|TRUCK MEMO NO:"); streamWriter.Write(report.StringFormatWithoutPipe(truckMemoList.STNo, 21, 2)); streamWriter.Write("ALLOTMENT/RELEASE ORDER: "); streamWriter.Write(report.StringFormatWithoutPipe(truckMemoList.RNo, 12, 2)); streamWriter.Write("MOVE. ORDER NO: "); streamWriter.Write(report.StringFormatWithoutPipe(truckMemoList.MNo, 15, 2)); streamWriter.Write("|"); streamWriter.WriteLine(" "); streamWriter.Write("| DATE:"); streamWriter.Write(report.StringFormatWithoutPipe(report.FormatDate(truckMemoList.STDate.ToString()), 21, 2)); streamWriter.Write(report.StringFormatWithoutPipe("TIME: ", 25, 1)); streamWriter.Write(report.StringFormatWithoutPipe(report.GetCurrentTime(DateTime.Now), 16, 2)); streamWriter.Write("DATE:"); streamWriter.Write(report.StringFormatWithoutPipe(report.FormatDate(truckMemoList.RDate.ToString()), 16, 2)); streamWriter.Write("|"); streamWriter.WriteLine(" "); streamWriter.Write("|ISSUING GODOWN :"); streamWriter.Write(report.StringFormatWithoutPipe(truckMemoList.GodownName, 30, 2)); streamWriter.Write("RECEIVER NAME: "); streamWriter.Write(report.StringFormatWithoutPipe(truckMemoList.ReceivingName, 41, 2)); streamWriter.Write("|"); streamWriter.WriteLine(" "); streamWriter.WriteLine("|----------------------------------------------------------------------------------------------------------|"); streamWriter.WriteLine("||--------------------------------------------------------------------------------------------------------||"); streamWriter.WriteLine("||SNo |STACK NO |COMMODITY | SCHEME |UNIT WEIGHT |NO.OF | Gross NET |% OF ||"); streamWriter.WriteLine("|| | | | | | UNIT| WEIGHT in Kgs/NOs |MOISTURE||"); streamWriter.WriteLine("||--------------------------------------------------------------------------------------------------------||"); }
/// <summary> /// Add receipt item details /// </summary> /// <param name="streamWriter"></param> /// <param name="stockReceipt"></param> public void AddDetails(StreamWriter streamWriter, DDChequeEntity chequeEntity) { int i = 0; foreach (var item in chequeEntity.DDChequeItems) { i = i + 1; streamWriter.Write(" "); streamWriter.Write(report.StringFormat(item.PaymentType + " " + item.ChequeNo + " ", 16, 2)); streamWriter.Write(report.StringFormat(report.FormatIndianDate(item.ChequeDate) + " ", 10, 2)); streamWriter.Write(report.StringFormat(item.Bank + " ", 30, 2)); streamWriter.Write(report.StringFormat(item.Amount, 14, 1)); streamWriter.WriteLine(" "); } }
/// <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); }
/// <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); } }
/// <summary> /// Add receipt item details /// </summary> /// <param name="streamWriter"></param> /// <param name="stockReceipt"></param> public void AddDetails(StreamWriter streamWriter, DataSet dataSet, int reportType) { int i = 0; //Add header values int count = dataSet.Tables[0].Columns.Count; int length = 0; length = (count * 16) + count; streamWriter.WriteLine("---" + report.AddLine(length)); streamWriter.Write(" "); int vad = (reportType == 0 && i < 2) || ((reportType == 1 && i < 3)) ? 2 : 1; foreach (DataColumn dataColumn in dataSet.Tables[0].Columns) { streamWriter.Write(report.StringFormat(dataColumn.ColumnName, 16, (reportType == 0 && i < 2) || ((reportType == 1 && i < 3)) ? 2 : 1)); i++; } streamWriter.Write(" Total |"); streamWriter.WriteLine(" "); streamWriter.WriteLine("---" + report.AddLine(length)); foreach (DataRow item in dataSet.Tables[0].Rows) { i = 0; decimal Total = 0; streamWriter.Write(" "); for (int k = 0; k < count; k++) { var result = report.StringFormatWithEmpty(Convert.ToString(item[k])); streamWriter.Write(report.StringFormat(result.Item1, 16, (reportType == 0 && i < 2) || ((reportType == 1 && i < 3)) ? 2 : 1)); if (i > 0) { Total = Total + (result.Item2 == true ? Convert.ToDecimal(result.Item1) : 0); } i++; } //Total streamWriter.Write(report.StringFormat(Convert.ToString(Total), 15, 1)); streamWriter.WriteLine(" "); } streamWriter.WriteLine("---" + report.AddLine(length)); }
/// <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); } }
/// <summary> /// Write text file for item wise abstract data /// </summary> /// <param name="sw">Text Streamwriter</param> /// <param name="dORegEntities">DOReg entity</param> /// <param name="entity">Common Entity</param> public void WriteGUGRAbstract(StreamWriter sw, List <GUList> gULists, CommonEntity entity) { try { int iCount = 11; // Gets the group by values based on ths column Commodity,Scheme var myResultItem = from a in gULists group a by new { a.Commodity } into gValue select new { Netwt = gValue.Sum(s => s.Quantity), GroupByNames = gValue.Key }; double dAmount = 0; AddHeaderforAbstractItem(sw, entity); foreach (var item in myResultItem) { if (iCount >= 50) { //Add header again iCount = 11; sw.WriteLine("-------------------------------------------------------------------------------"); sw.WriteLine((char)12); AddHeaderforAbstractItem(sw, entity); } sw.Write(report.StringFormat("", 10, 2)); sw.Write(report.StringFormat(item.GroupByNames.Commodity, 37, 2)); sw.Write(report.StringFormat(item.Netwt.ToString(), 10, 1)); dAmount = dAmount + item.Netwt; iCount++; sw.WriteLine(""); } // Add toal values sw.WriteLine("-------------------------------------------------------------------------------"); sw.Write(report.StringFormat("", 10, 2)); sw.Write(report.StringFormat(" Total ", 37, 2)); sw.Write(report.StringFormat(dAmount.ToString(), 10, 1)); sw.WriteLine(""); sw.WriteLine("-------------------------------------------------------------------------------"); sw.WriteLine((char)12); } catch (Exception ex) { AuditLog.WriteError(ex.Message + " : " + ex.StackTrace); } }
/// <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)); }
/// <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); } }
/// <summary> /// Add header for document receipt /// </summary> /// <param name="streamWriter">Stream writer to write the text file.</param> /// <param name="deliveryOrderList"></param> /// <param name="isDuplicate"></param> public void AddDocHeaderForDeliveryOrder(StreamWriter streamWriter, DocumentDeliveryOrderEntity deliveryOrderEntity, bool isDuplicate = false) { streamWriter.WriteLine("|==========================================================================================================|"); streamWriter.WriteLine("| |"); streamWriter.WriteLine("| TAMILNADU CIVIL SUPPLIES CORPORATION |"); streamWriter.Write("| "); streamWriter.Write(manageReport.StringFormatWithoutPipe("REGION : ", 9, 1)); streamWriter.Write(manageReport.StringFormat(deliveryOrderEntity.RegionName, 50, 2)); streamWriter.WriteLine(""); streamWriter.WriteLine("| |"); streamWriter.WriteLine("| DELIVERY ORDER |"); streamWriter.WriteLine("|==========================================================================================================|"); streamWriter.Write("|TRANSACTION:"); streamWriter.Write(manageReport.StringFormatWithoutPipe(deliveryOrderEntity.TransactionName, 21, 2)); streamWriter.Write("GODOWN NAME: "); streamWriter.Write(manageReport.StringFormat(deliveryOrderEntity.GodownName, 59, 2)); streamWriter.WriteLine(" "); streamWriter.Write("|DELIVERY ORDER: "); streamWriter.Write(manageReport.StringFormatWithoutPipe(deliveryOrderEntity.Dono, 16, 2)); streamWriter.Write("DATE: "); streamWriter.Write(manageReport.StringFormatWithoutPipe(manageReport.FormatIndianDate(deliveryOrderEntity.DoDate.ToString()), 66, 2)); streamWriter.Write("|"); streamWriter.WriteLine(" "); streamWriter.WriteLine("|==========================================================================================================|"); streamWriter.Write("|ISSUE TO:"); streamWriter.Write(manageReport.StringFormatWithoutPipe(deliveryOrderEntity.ReceivorName, 96, 2) + "|"); streamWriter.WriteLine(" "); streamWriter.Write("|INDENT NO:"); streamWriter.Write(manageReport.StringFormatWithoutPipe(deliveryOrderEntity.IndentNo, 21, 2)); // streamWriter.Write(manageReport.StringFormatWithoutPipe("DATE: ", 25, 1)); streamWriter.Write("PERMIT DATE:"); streamWriter.Write(manageReport.StringFormatWithoutPipe(manageReport.FormatDate(deliveryOrderEntity.PermitDate.ToString()), 13, 2)); streamWriter.Write("ORDER PERIOD ENDING:"); streamWriter.Write(manageReport.StringFormatWithoutPipe(deliveryOrderEntity.OrderPeriod, 27, 2)); streamWriter.Write("|"); streamWriter.WriteLine(" "); streamWriter.WriteLine("|==========================================================================================================|"); }
/// <summary> /// /// </summary> /// <param name="sw"></param> /// <param name="entity"></param> public void DateWiseCommodityReceiptReport(StreamWriter sw, CommonEntity entity) { int count = 10; var dateList = entity.dataSet.Tables[0].DefaultView.ToTable(true, "Commodity"); int i = 1; string ackNo = string.Empty; string fromWhomRcd = string.Empty; bool isDataAvailable = false; decimal Qty = 0; int Bags = 0; count = 11; foreach (DataRow date in dateList.Rows) { isDataAvailable = true; Bags = 0; Qty = 0; string ackNoNext = string.Empty; AddHeader(sw, entity); DataRow[] data = entity.dataSet.Tables[0].Select("Commodity='" + date["Commodity"] + "'"); foreach (DataRow row in data) { if (count >= 50) { //Add header again count = 11; sw.WriteLine("------------------------------------------------------------------------------------------------------------------------------------------------------------------|"); sw.WriteLine((char)12); AddHeader(sw, entity); } ackNoNext = row["Ackno"].ToString(); fromWhomRcd = Convert.ToString(row["RecdFrom"]).Trim(); sw.Write(report.StringFormat(i.ToString(), 4, 2)); sw.Write(report.StringFormat(ackNoNext, 11, 1)); sw.Write(report.StringFormat(row["Date"].ToString(), 10, 1)); sw.Write(report.StringFormat(row["Commodity"].ToString(), 16, 2)); sw.Write(report.StringFormat(row["Bags_No"].ToString(), 8, 1)); sw.Write(report.StringFormat(row["Quantity"].ToString(), 17, 1)); sw.Write(report.StringFormat(fromWhomRcd, 21, 2)); sw.Write(report.StringFormat(row["Lorryno"].ToString(), 11, 1)); sw.Write(report.StringFormat(row["TruckMemoNo"].ToString(), 15, 1)); sw.Write(report.StringFormat(row["Truckmemodate"].ToString(), 11, 1)); sw.Write(report.StringFormat(row["Orderno"].ToString(), 11, 2)); sw.Write(report.StringFormat("", 8, 1)); sw.Write(report.StringFormat("", 7, 1)); sw.WriteLine(""); Bags += !string.IsNullOrEmpty(Convert.ToString(row["Bags_No"])) ? Convert.ToInt32(row["Bags_No"].ToString()) : 0; Qty += !string.IsNullOrEmpty(Convert.ToString(row["Quantity"])) ? Convert.ToDecimal(row["Quantity"].ToString()) : 0; i = i + 1; count++; } sw.WriteLine("------------------------------------------------------------------------------------------------------------------------------------------------------------------|"); sw.Write(report.StringFormat("", 4, 2)); sw.Write(report.StringFormat(" Total ", 11, 1)); sw.Write(report.StringFormatWithoutPipe(" ", 10, 1)); sw.Write(report.StringFormatWithoutPipe(" ", 16, 2)); sw.Write(report.StringFormatWithoutPipe(Bags.ToString(), 8, 1)); sw.Write(report.StringFormatWithoutPipe(Qty.ToString(), 17, 1)); sw.WriteLine(" "); sw.WriteLine("------------------------------------------------------------------------------------------------------------------------------------------------------------------|"); //Total sw.WriteLine((char)12); } if (!isDataAvailable) { sw.WriteLine("------------------------------------------------------------------------------------------------------------------------------------------------------------------|"); sw.WriteLine((char)12); } }
/// <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> /// /// </summary> /// <param name="sw"></param> /// <param name="entity"></param> public void TruckTransitReport(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["ITBweighment"].ToString(); //PBWeight sw.Write(report.StringFormat(i.ToString(), 4, 2)); sw.Write(report.StringFormat(row["STNo"].ToString(), 11, 2)); sw.Write(report.StringFormat(isfirst == true ? row["Region"].ToString() : " ", 15, 2)); sw.Write(report.StringFormat(report.FormatDirectDate(row["STDate"].ToString()), 12, 2) + " "); sw.Write(report.StringFormat(row["TNCSName"].ToString(), 15, 2)); sw.Write(report.StringFormat(row["LNo"].ToString(), 10, 2)); sw.Write(report.StringFormat(row["NoPacking"].ToString(), 6, 1)); sw.Write(report.StringFormat(PackingType.ToUpper() == "NOS" ? row["Nkgs"].ToString() : report.DecimalformatForWeight(row["Nkgs"].ToString()), 13, 1)); sw.Write(report.StringFormat(row["ACKNO"].ToString(), 10, 2)); sw.Write(report.StringFormat(report.FormatDirectDate(row["STDate"].ToString()), 13, 2) + " "); sw.Write(report.StringFormat(isfirst == true ? row["DepositorName"].ToString() : " ", 16, 2)); sw.Write(report.StringFormat(row["NoPacking"].ToString(), 9, 1)); sw.Write(report.StringFormat((PackingType.ToUpper() == "NOS" || PackingType.ToUpper() == "LTRS") ? row["Nkgs"].ToString() : report.DecimalformatForWeight(row["Nkgs"].ToString()), 12, 1)); sw.Write(report.StringFormat(row["Transfertype"].ToString(), 17, 1)); 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); } }
/// <summary> /// Add header for document receipt /// </summary> /// <param name="streamWriter">Stream writer to write the text file.</param> /// <param name="stockIssuesEntity"></param> /// <param name="isDuplicate"></param> public void AddDocHeaderForIssues(StreamWriter streamWriter, DocumentStockIssuesEntity stockIssuesEntity, bool isDuplicate = false) { streamWriter.WriteLine("---------------------------------------------------------------------------------------------------------------"); streamWriter.WriteLine("| |"); streamWriter.WriteLine("| |"); streamWriter.WriteLine("| TAMILNADU CIVIL SUPPLIES CORPORATION |"); streamWriter.Write("| "); streamWriter.Write(report.StringFormatWithoutPipe("REGION : ", 9, 1)); streamWriter.Write(report.StringFormat(stockIssuesEntity.RegionName, 53, 2)); streamWriter.WriteLine(""); streamWriter.WriteLine("| |"); streamWriter.WriteLine("| |"); if (isDuplicate) { streamWriter.WriteLine("| STOCK ISSUE - ISSUE MEMO DUPLICATE COPY |"); } else { streamWriter.WriteLine("| STOCK ISSUE - ISSUE MEMO |"); } streamWriter.WriteLine("|-------------------------------------------------------------------------------------------------------------|"); streamWriter.Write("|ISSUE MEMO NO : "); streamWriter.Write(report.StringFormatWithoutPipe(stockIssuesEntity.SINo, 21, 2)); streamWriter.Write("DATE: "); streamWriter.Write(report.StringFormatWithoutPipe(report.FormatDate(stockIssuesEntity.SIDate.ToString()), 12, 2)); streamWriter.Write("TIME:"); streamWriter.Write(report.StringFormatWithoutPipe(report.GetCurrentTime(DateTime.Now), 14, 2)); streamWriter.Write(report.StringFormatWithoutPipe((stockIssuesEntity.IssueRegularAdvance.ToUpper() == "R" ? "REGULAR" : "ADVANCE"), 8, 2)); streamWriter.Write(report.StringFormat(stockIssuesEntity.IRelates, 20, 2)); streamWriter.WriteLine(" "); streamWriter.Write("|ISSUING GODOWN : "); streamWriter.Write(report.StringFormatWithoutPipe(stockIssuesEntity.GodownName, 21, 2)); streamWriter.Write(report.StringFormatWithoutPipe("TO WHOM ISSUED:", 15, 1)); streamWriter.Write(report.StringFormatWithoutPipe(stockIssuesEntity.ReceiverName, 51, 2)); streamWriter.Write("|"); streamWriter.WriteLine(" "); try { streamWriter.Write("| "); streamWriter.Write(report.StringFormatWithoutPipe("ISSUER CODE :", 15, 1)); streamWriter.Write(report.StringFormatWithoutPipe(stockIssuesEntity.IssuerCode, 51, 2)); streamWriter.Write("|"); streamWriter.WriteLine(" "); } catch (Exception ex) { AuditLog.WriteError(ex.Message); } streamWriter.WriteLine("||------------------------------------------------------------------------------------------------------|-----|"); streamWriter.WriteLine("||SNo| STACK NO | COMMODITY | SCHEME |UNIT WEIGHT |NO.OFUNITS| NET Wt/Nos|MOI% |"); streamWriter.WriteLine("||------------------------------------------------------------------------------------------------------|-----|"); }
/// <summary> /// Add receipt item details /// </summary> /// <param name="streamWriter"></param> /// <param name="stockIssuesEntity"></param> private void AddDetails(StreamWriter streamWriter, List <StackCardEntity> stackCardEntities) { int i = 1; string Fromdate = string.Empty; string Todate = string.Empty; string TotalReceiptBags = string.Empty, TotalIssuesBags = string.Empty; string TotalReceiptQuantity = string.Empty, TotalIssuesQuantity = string.Empty; foreach (var item in stackCardEntities) { if (i == 1) { Fromdate = item.AckDate; } if (item.AckDate == "Total") { streamWriter.WriteLine("----|--------------------------------|-----------------------------------------|"); streamWriter.Write(report.StringFormatWithoutPipe(item.AckDate, 15, 1)); streamWriter.Write(report.StringFormatWithoutPipe(report.StringFormatWithEmpty(item.ReceiptBags).Item1, 5, 1)); streamWriter.Write(report.StringFormat(report.StringFormatWithEmpty(item.ReceiptQuantity).Item1, 15, 1)); streamWriter.Write(report.StringFormatWithoutPipe(report.StringFormatWithEmpty(item.IssuesBags).Item1, 5, 2)); streamWriter.Write(report.StringFormatWithoutPipe(report.StringFormatWithEmpty(item.IssuesQuantity).Item1, 15, 1)); streamWriter.Write(report.StringFormat(report.StringFormatWithEmpty(item.ClosingBalance).Item1, 19, 1)); streamWriter.WriteLine(" "); streamWriter.WriteLine("-------------------------------------------------------------------------------|"); TotalReceiptBags = item.ReceiptBags; TotalIssuesBags = item.IssuesBags; TotalReceiptQuantity = item.ReceiptQuantity; TotalIssuesQuantity = item.IssuesQuantity; break; } Todate = item.AckDate; streamWriter.Write(report.StringFormat(i.ToString(), 4, 1)); streamWriter.Write(report.StringFormatWithoutPipe(report.FormatDirectDate(item.AckDate), 10, 1)); streamWriter.Write(report.StringFormatWithoutPipe(report.StringFormatWithEmpty(item.ReceiptBags).Item1, 5, 1)); streamWriter.Write(report.StringFormat(report.StringFormatWithEmpty(item.ReceiptQuantity).Item1, 15, 1)); streamWriter.Write(report.StringFormatWithoutPipe(report.StringFormatWithEmpty(item.IssuesBags).Item1, 5, 1)); streamWriter.Write(report.StringFormatWithoutPipe(report.StringFormatWithEmpty(item.IssuesQuantity).Item1, 15, 1)); streamWriter.Write(report.StringFormat(report.StringFormatWithEmpty(item.ClosingBalance).Item1, 19, 1)); streamWriter.WriteLine(" "); i = i + 1; } streamWriter.WriteLine(" "); streamWriter.WriteLine(" Bags Quantity"); streamWriter.WriteLine("-------------------------------------------------------------------------------|"); streamWriter.Write(" Total Receipt "); streamWriter.Write(report.StringFormatWithoutPipe(TotalReceiptBags, 8, 2)); streamWriter.Write(report.StringFormatWithoutPipe(TotalReceiptQuantity, 13, 2)); streamWriter.WriteLine(""); streamWriter.Write(" Total Issues "); streamWriter.Write(report.StringFormatWithoutPipe(TotalIssuesBags, 8, 2)); streamWriter.Write(report.StringFormatWithoutPipe(TotalIssuesQuantity, 13, 2)); streamWriter.WriteLine(""); streamWriter.WriteLine("-------------------------------------------------------------------------------|"); streamWriter.Write(" Balance "); streamWriter.Write(report.StringFormatWithoutPipe(GetDifference(TotalReceiptBags, TotalIssuesBags, 1), 8, 2)); streamWriter.Write(report.StringFormatWithoutPipe(GetDifference(TotalReceiptQuantity, TotalIssuesQuantity, 2), 13, 2)); streamWriter.WriteLine(""); streamWriter.WriteLine("-------------------------------------------------------------------------------|"); streamWriter.WriteLine("-------------------------------------------------------------------------------|"); streamWriter.WriteLine(" FROM DATE TODATE TOTAL DAYS"); streamWriter.Write(" Period of Storage "); streamWriter.Write(report.StringFormatWithoutPipe(report.FormatDirectDate(Fromdate), 12, 2)); streamWriter.Write(report.StringFormatWithoutPipe(report.FormatDirectDate(Todate), 12, 2)); streamWriter.Write(report.StringFormatWithoutPipe(report.GetDays(Fromdate, Todate), 12, 2)); streamWriter.WriteLine(""); streamWriter.WriteLine("-------------------------------------------------------------------------------|"); streamWriter.WriteLine((char)12); }