private void radButton7_Click(object sender, EventArgs e) { GlobleAccess.PaymentReportType = "I"; com_invoice_no.Text = ""; GlobleAccess.cusID = com_customer_id.Text; this.Enabled = false; Payments_Full_Report pr = new Payments_Full_Report(); pr.MdiParent = DHNAULA.ActiveForm; pr.Show(); }
private void btn_repot_Click(object sender, EventArgs e) { GlobleAccess.PaymentReportType = "C"; com_invoice_no.Text = ""; GlobleAccess.cusID = com_customer_id.Text; //string q = "SELECT I.invoiceno,I.invoicedate,C.customername,IL.itemno,IL.itemname,IL.soldqty,IL.retailprice,IL.soldqty*IL.retailprice,I.invoicetotal,IL.discount,I.invoicenote,I.vehicleno FROM invoice I,invoicelines IL, customer C WHERE C.customerno = I.customer AND I.invoiceno = IL.invoiceno AND C.customerno='" + com_customer_id.Text + "'"; // DataSet ds_invoice = middle_access.db_access.SelectData(q); // if (ds_invoice != null) // { //} // int i = 0; /* for (int i = 0; i < ds_invoice.Tables[0].Rows.Count; i++) { DataRow dr_invoice = ds_invoice.Tables[0].Rows[i]; string invoice_no = dr_invoice.ItemArray.GetValue(0).ToString(); string invoice_date = dr_invoice.ItemArray.GetValue(1).ToString(); string customer_name = dr_invoice.ItemArray.GetValue(2).ToString(); string item_no = dr_invoice.ItemArray.GetValue(3).ToString(); string item_name = dr_invoice.ItemArray.GetValue(4).ToString(); string qty = dr_invoice.ItemArray.GetValue(5).ToString(); string unit_price = dr_invoice.ItemArray.GetValue(6).ToString(); string price = dr_invoice.ItemArray.GetValue(7).ToString(); string total_price = dr_invoice.ItemArray.GetValue(8).ToString(); string discount = dr_invoice.ItemArray.GetValue(9).ToString(); string refNo = dr_invoice.ItemArray.GetValue(10).ToString(); string vehicleNo = dr_invoice.ItemArray.GetValue(11).ToString(); if (discount == "") { discount = " "; price = ((Convert.ToDouble(qty) * Convert.ToDouble(unit_price)) / 100 * (100 - 0)).ToString(); } else if (discount != " ") { price = ((Convert.ToDouble(qty) * Convert.ToDouble(unit_price)) / 100 * (100 - Convert.ToDouble(discount))).ToString(); discount = discount + " %"; } string q3 = "INSERT INTO temp_invoice_print(invoice_no,invoice_date,customer_name,item_no,item_name,qty,unit_price,price,total_price,discount,refNo,vehicleno)VALUES('" + invoice_no + "','" + invoice_date + "','" + customer_name + "','" + item_no + "','" + item_name + "'," + qty + ",'" + unit_price + ".00','" + price + ".00','" + total_price + ".00','" + discount + "','" + refNo + "','" + vehicleNo + "')"; bool status = middle_access.db_access.InsertData(q3); // i++; if (status == true) { } else { MessageBox.Show("Error2!", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error); } }*/ this.Enabled = false; // Invoice_report ir = new Invoice_report(); // ir.MdiParent = DHNAULA.ActiveForm; //ir.Show(); Payments_Full_Report pr = new Payments_Full_Report(); pr.MdiParent = DHNAULA.ActiveForm; pr.Show(); /* else { MessageBox.Show("Incorrect item No!", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information); }*/ }