public OptionsForm() { InitializeComponent(); List <string> listFlatNo = FirstLoad.Retrieve_fl(); for (int i = 0; i < listFlatNo.Count; i++) // Loop through List with for { selFlatNo.Items.Add(listFlatNo[i]); } }
public BillingForm() { InitializeComponent(); textBillMonth.Enabled = false; List <string> listFlatNo = FirstLoad.Retrieve_fl(); for (int i = 0; i < listFlatNo.Count; i++) // Loop through List with for { selFlatNo.Items.Add(listFlatNo[i]); textFlatNo.Items.Add(listFlatNo[i]); } }
private void loadDefaultReport(string tempMonth) { FirstLoad fstLoad = new FirstLoad(); List <DefaulterDetail> invoiceDetList = fstLoad.getDefaulter(tempMonth); dataGridView1.Rows.Clear(); foreach (var def in invoiceDetList) { dataGridView1.Rows.Add(def.FlatNo, def.Name, def.Amount); } }
private void clkReset_Click(object sender, EventArgs e) { List <string> listFlatNo = FirstLoad.Retrieve_fl(); for (int i = 0; i < listFlatNo.Count; i++) // Loop through List with for { selFlatNo.Items.Add(listFlatNo[i]); } selFlatNo.Text = ""; currentResident.Text = ""; subStatus.Text = ""; selMonth.Text = ""; untInput.Text = ""; textConsumption.Text = ""; }
void pdoc_PrintPage(object sender, PrintPageEventArgs e) { string currentYear = DateTime.Now.Year.ToString(); string underLine = "-------------------------------------------------------------------"; int itemCounter = 0; Graphics graphics = e.Graphics; Font font = new Font("Courier New", 10); SolidBrush brush = new SolidBrush(Color.Black); e.PageSettings.PaperSize = new PaperSize("A4", 850, 1100); float pageWidth = e.PageSettings.PrintableArea.Width; float pageHeight = e.PageSettings.PrintableArea.Height; //float fontHeight = font.GetHeight(); int startX = 100; int startK = 50; int startL = 40; int startY = 25; int OffsetY = 20; DateTime today = DateTime.Today; string Today = today.ToString("MM/dd/yyyy"); // As String Image Logo = Properties.Resources.mvslogo; graphics.DrawImage(Logo, startK, startL, 40, 40); graphics.DrawString("Mont Vert Seville CHS Gas Consumption Report", new Font("Courier New", 16, FontStyle.Bold), brush, startX, startY + OffsetY); OffsetY = OffsetY + 30; graphics.DrawString("Date:" + Today, font, brush, startX, startY + OffsetY); OffsetY = OffsetY + 10; graphics.DrawString(underLine, font, brush, startX, startY + OffsetY); OffsetY = OffsetY + 30; graphics.DrawString("Flat No", new Font("Courier New", 12, FontStyle.Bold), brush, startX, startY + OffsetY); graphics.DrawString("Resident Name", new Font("Courier New", 12, FontStyle.Bold), brush, (startX + 170), startY + OffsetY); graphics.DrawString("Consumption (Cylinder Units)", new Font("Courier New", 12, FontStyle.Bold), brush, (startX + 400), startY + OffsetY); FirstLoad fstLoad = new FirstLoad(); List <ConsumptionDetail> consumptionList = fstLoad.getConsumption(); ConsumptionDetail consumptionDet; for (int i = itemCount; i < consumptionList.Count; i++) // Loop through List with for { if (itemCount < consumptionList.Count) { consumptionDet = consumptionList[i]; string flatNo = consumptionDet.FlatNo; string residentName = consumptionDet.Name; string consumption = consumptionDet.Consumption; OffsetY = OffsetY + 30; graphics.DrawString(flatNo, font, brush, (startX + 10), startY + OffsetY); graphics.DrawString(residentName, font, brush, (startX + 150), startY + OffsetY); graphics.DrawString(consumption, font, brush, (startX + 475), startY + OffsetY); OffsetY = OffsetY + 15; itemCounter++; itemCount++; if ((itemCounter == 20) && (itemCount < consumptionList.Count)) { e.HasMorePages = true; return; } else { e.HasMorePages = false; } } } }
void pdoc_PrintPage(object sender, PrintPageEventArgs e) { string valueMonth = subBatchMonth.Text; string currentYear = DateTime.Now.Year.ToString(); string underLine = "-----------------------------------------------------"; string seperator = "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~TEAR ALONG THIS EDGE~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"; String Society = "Mont Vert Seville, Wakad"; string valueSub = "0.00"; string valueNonSub = "0.00"; int itemCounter = 0; Graphics graphics = e.Graphics; Font font = new Font("Courier New", 10); SolidBrush brush = new SolidBrush(Color.Black); e.PageSettings.PaperSize = new PaperSize("A4", 850, 1100); float pageWidth = e.PageSettings.PrintableArea.Width; float pageHeight = e.PageSettings.PrintableArea.Height; //float fontHeight = font.GetHeight(); int startX = 50; int startX1 = 600; int startK = 45; int startK1 = 595; int startZ = 0; int startY = 20; int OffsetY = 20; int startL = 20; int OffsetX = 220; SQLiteConnection sqlite_conn; SQLiteCommand sqlite_cmd; SQLiteDataReader sqlite_datareader; // create a new database connection: sqlite_conn = new SQLiteConnection("Data Source=C:\\RGRAB\\Application\\GasDB.db;Version=3;New=False;Compress=True;"); // open the connection: sqlite_conn.Open(); // create a new SQL command: sqlite_cmd = sqlite_conn.CreateCommand(); // First lets build a SQL-Query again: sqlite_cmd.CommandText = "SELECT Subsidized, NonSubsidized FROM SubValue where Month = '" + valueMonth + "' and Year = '" + currentYear + "';"; // Now the SQLiteCommand object can give us a DataReader-Object: sqlite_datareader = sqlite_cmd.ExecuteReader(); while (sqlite_datareader.Read()) // Read() returns true if there is still a result line to read { valueSub = sqlite_datareader.GetString(0); valueNonSub = sqlite_datareader.GetString(1); } // We are ready, now lets cleanup and close our connection: sqlite_conn.Close(); FirstLoad fstLoad = new FirstLoad(); List <Invoice_Retrieve> invoiceDetList = fstLoad.getInvoiceDetail(valueMonth, currentYear); Invoice_Retrieve invoiceDet; for (int i = itemCount; i < invoiceDetList.Count; i++) // Loop through List with for { if (itemCount < invoiceDetList.Count) { invoiceDet = invoiceDetList[i]; DateTime today = DateTime.Today; string Today = today.ToString("MM/dd/yyyy"); // As String string billMonth = subBatchMonth.Text; string flatNo = invoiceDet.FlatNo; string residentName = invoiceDet.Name; string subsidyStatus = invoiceDet.SubStatus; string lastRdDate = invoiceDet.LastDate; string currentRdDate = invoiceDet.CurrentDate; string lastUnit = invoiceDet.LastUnit; string currentUnit = invoiceDet.CurrentUnit; string subRate = valueSub; string nonSubRate = valueNonSub; string subUnit = invoiceDet.SubsidyUnit; string nonSubUnit = invoiceDet.NonSubsidyUnit; string span = invoiceDet.Span; //string penalty = "0.00"; string units = Convert.ToString(Convert.ToDouble(invoiceDet.Unit) * 2.6); string amount = Convert.ToString(Math.Round(Convert.ToDouble(invoiceDet.Amount), 0)); string totalAmount = Convert.ToString(Math.Round(Convert.ToDouble(invoiceDet.Amount), 0)); if (subsidyStatus == "NonSubsidized") { nonSubUnit = Convert.ToString(Convert.ToDouble(nonSubUnit) + Convert.ToDouble(subUnit)); subUnit = "0"; } Image Logo = Properties.Resources.mvslogo; graphics.DrawImage(Logo, startK, startL + OffsetY, 40, 40); graphics.DrawImage(Logo, startK1, startL + OffsetY, 40, 40); graphics.DrawString(" Mont Vert Seville CHS Gas Receipt", new Font("Courier New", 14, FontStyle.Bold), brush, startX, startY + OffsetY); graphics.DrawString(" Mont Vert Seville CHS Gas Receipt", new Font("Courier New", 14, FontStyle.Bold), brush, startX1, startY + OffsetY); OffsetY = OffsetY + 25; //graphics.DrawString("Date:" + Today, font, brush, startX, startY + OffsetY); //graphics.DrawString("Date:" + Today, font, brush, startX1, startY + OffsetY); graphics.DrawString("Bill Month: " + billMonth, font, brush, (startX + 300), startY + OffsetY); graphics.DrawString("Bill Month: " + billMonth, font, brush, (startX1 + 300), startY + OffsetY); OffsetY = OffsetY + 10; graphics.DrawString(underLine, font, brush, startX, startY + OffsetY); graphics.DrawString(underLine, font, brush, startX1, startY + OffsetY); OffsetY = OffsetY + 10; graphics.DrawString("Flat No: " + flatNo, new Font("Courier New", 10, FontStyle.Bold), brush, startX, startY + OffsetY); graphics.DrawString("Flat No: " + flatNo, new Font("Courier New", 10, FontStyle.Bold), brush, startX1, startY + OffsetY); graphics.DrawString("Subsidy Status: " + subsidyStatus, new Font("Courier New", 10, FontStyle.Bold), brush, startX + OffsetX, startY + OffsetY); graphics.DrawString("Subsidy Status: " + subsidyStatus, new Font("Courier New", 10, FontStyle.Bold), brush, startX1 + OffsetX, startY + OffsetY); OffsetY = OffsetY + 15; graphics.DrawString("Name: " + residentName, font, brush, startX, startY + OffsetY); graphics.DrawString("Name: " + residentName, font, brush, startX1, startY + OffsetY); OffsetY = OffsetY + 15; graphics.DrawString(Society, font, brush, startX, startY + OffsetY); graphics.DrawString(Society, font, brush, startX1, startY + OffsetY); OffsetY = OffsetY + 10; graphics.DrawString(underLine, font, brush, startX, startY + OffsetY); graphics.DrawString(underLine, font, brush, startX1, startY + OffsetY); OffsetY = OffsetY + 10; //graphics.DrawString("Last Rd Date :" + lastRdDate, font, brush, startX, startY + OffsetY); //graphics.DrawString("Last Rd Date :" + lastRdDate, font, brush, startX1, startY + OffsetY); //graphics.DrawString("Current Rd Date :" + currentRdDate, font, brush, startX + OffsetX, startY + OffsetY); //graphics.DrawString("Current Rd Date :" + currentRdDate, font, brush, startX1 + OffsetX, startY + OffsetY); //OffsetY = OffsetY + 15; graphics.DrawString("Last Rd Unit: " + lastUnit, font, brush, startX, startY + OffsetY); graphics.DrawString("Last Rd Unit: " + lastUnit, font, brush, startX1, startY + OffsetY); graphics.DrawString("Current Rd Unit: " + currentUnit, font, brush, startX + OffsetX, startY + OffsetY); graphics.DrawString("Current Rd Unit: " + currentUnit, font, brush, startX1 + OffsetX, startY + OffsetY); OffsetY = OffsetY + 15; graphics.DrawString("Subsidized Unit: " + subUnit, font, brush, startX, startY + OffsetY); graphics.DrawString("Subsidized Unit: " + subUnit, font, brush, startX1, startY + OffsetY); graphics.DrawString("Non Subsidized Unit: " + nonSubUnit, font, brush, startX + OffsetX, startY + OffsetY); graphics.DrawString("Non Subsidized Unit: " + nonSubUnit, font, brush, startX1 + OffsetX, startY + OffsetY); OffsetY = OffsetY + 15; graphics.DrawString("Subsidized Rate: " + subRate, font, brush, startX, startY + OffsetY); graphics.DrawString("Subsidized Rate: " + subRate, font, brush, startX1, startY + OffsetY); graphics.DrawString("Non Subsidized Rate: " + nonSubRate, font, brush, startX + OffsetX, startY + OffsetY); graphics.DrawString("Non Subsidized Rate: " + nonSubRate, font, brush, startX1 + OffsetX, startY + OffsetY); OffsetY = OffsetY + 10; graphics.DrawString(underLine, font, brush, startX, startY + OffsetY); graphics.DrawString(underLine, font, brush, startX1, startY + OffsetY); OffsetY = OffsetY + 10; //graphics.DrawString("Usage Days: " + span, font, brush, startX, startY + OffsetY); //graphics.DrawString("Usage Days: " + span, font, brush, startX1, startY + OffsetY); //graphics.DrawString("Penalty Amount: " + penalty, font, brush, startX + OffsetX, startY + OffsetY); //graphics.DrawString("Penalty Amount: " + penalty, font, brush, startX1 + OffsetX, startY + OffsetY); //OffsetY = OffsetY + 15; graphics.DrawString("Usage(KG): " + units, font, brush, startX, startY + OffsetY); graphics.DrawString("Usage(KG): " + units, font, brush, startX1, startY + OffsetY); graphics.DrawString("Amount(₹): " + amount, new Font("Courier New", 11, FontStyle.Bold), brush, startX + OffsetX, startY + OffsetY); graphics.DrawString("Amount(₹): " + amount, new Font("Courier New", 11, FontStyle.Bold), brush, startX1 + OffsetX, startY + OffsetY); //OffsetY = OffsetY + 15; //graphics.DrawString("Total Amount: " + totalAmount, new Font("Courier New", 11, FontStyle.Bold), brush, startX + OffsetX, startY + OffsetY); //graphics.DrawString("Total Amount: " + totalAmount, new Font("Courier New", 11, FontStyle.Bold), brush, startX1 + OffsetX, startY + OffsetY); OffsetY = OffsetY + 10; graphics.DrawString(underLine, font, brush, startX, startY + OffsetY); graphics.DrawString(underLine, font, brush, startX1, startY + OffsetY); OffsetY = OffsetY + 15; graphics.DrawString(seperator, font, brush, startZ, startY + OffsetY); OffsetY = OffsetY + 25; itemCounter++; itemCount++; if ((itemCounter == 4) && (itemCount < invoiceDetList.Count)) { e.HasMorePages = true; return; } else { e.HasMorePages = false; } } } }