private void mtbSearch_Click(object sender, EventArgs e) { // check if OPNo is valid int OPNo = int.Parse(tOPNo.Text); float temp = 0; string query = "SELECT * FROM tbl_PayOrder WHERE OPNo = " + OPNo; if (new clsDB().Con().countRecord(query) > 0) { // Compute Total query = "SELECT AcctCode, Particular, Amount FROM tbl_PayOrder_Details WHERE OPSeqNo = '" + OPNo + "'"; new clsDB().Con().FillLvw(listView1, query); float[] total = Payor.computeAccount(listView1); temp = total[0] + total[1]; frmPaymentDataEntry f = new frmPaymentDataEntry(); f.total = temp; f.orderOfPaymentNo = OPNo; f.listLength = listView1.Items.Count; f.ShowDialog(); } else { MessageBox.Show("Invalid Order of Payment Number", "Input Error!", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void mtbSearch_Click(object sender, EventArgs e) { // check if OPNo is valid int OPNo = 0; try { OPNo = int.Parse(tOPNo.Text); } catch (Exception ex) { MessageBox.Show("Invalid OP Number"); return; } float temp = 0; string query = "SELECT * FROM tbl_PayOrder WHERE OPNo = " + OPNo; if (new clsDB().Con().countRecord(query) > 0) { // Compute Total query = "SELECT AcctCode, Particular, Amount FROM tbl_PayOrder_Details WHERE OPSeqNo = '" + OPNo + "'"; new clsDB().Con().FillLvw(listView1, query); float[] total = Payor.computeAccount(listView1); temp = total[0] + total[1]; frmPaymentDataEntry f = new frmPaymentDataEntry(this.lastORNumber); f.total = temp; f.orderOfPaymentNo = OPNo; f.listLength = listView1.Items.Count; f.ShowDialog(); this.lastORNumber = f.lastORNumber; parent.lbTotalCollection.Text = "" + Cashier.classes.clsCollection.getDailyAccumulatedAmount(DateTime.Now.ToShortDateString()); string date = DateTime.Now.ToShortDateString(); Cashier.classes.clsCollection c = new Cashier.classes.clsCollection(); Dictionary <string, float> summary = c.summaryOfCollection(2, date); for (int i = 0; i < summary.Count; i++) { ListViewItem lvi = new ListViewItem(); lvi.SubItems[0].Text = summary.Keys.ToList()[i]; ListViewItem.ListViewSubItem item = new ListViewItem.ListViewSubItem(); item.Text = Convert.ToString(summary[summary.Keys.ToList()[i]]); lvi.SubItems.Add(item); parent.lvSummaryOfCollection.Items.Add(lvi); } } else { MessageBox.Show("Invalid Order of Payment Number", "Input Error!", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void lvManageRecord_SelectedIndexChanged(object sender, EventArgs e) { if (lvManageRecord.SelectedItems.Count > 0) { lbPaid.Visible = false; btnPay.Enabled = true; btnPay.Text = "Pay"; lbPaid.Text = "PAID( OR # "; orderOfPaymentID = int.Parse(lvManageRecord.SelectedItems[0].SubItems[0].Text); string query = "SELECT AcctCode, Particular, Amount FROM tbl_PayOrder_Details WHERE OPSeqNo = '" + orderOfPaymentID + "'"; new clsDB().Con().FillLvw(listView1, query); Dictionary <string, string> data = new Dictionary <string, string>(); new clsDB().Con().SelectDataDictionary("SELECT DISTINCT OP.SemNO , OP.Payor as Payor,OP.DateIssued FROM tbl_PayOrder as OP LEFT JOIN Student_Account as SA ON OP.StudID = SA.StudID LEFT JOIN Student as S ON S.StudID = OP.StudID WHERE OP.OPNo = " + orderOfPaymentID, data); //new clsDB().Con().SelectDataDictionary("SELECT * FROM Student_Account as SA JOIN student as S on SA.StudID = S.StudID JOIN tbl_PayOrder as OP ON SA.StudID = OP.StudID WHERE OP.OPNo = "+ orderOfPaymentID , data); lbFName.Text = data["Payor"]; DateTime dt = DateTime.Parse(data["DateIssued"]); lbDate.Text = dt.ToShortDateString(); OrderOfPayment OP = new OrderOfPayment(); if (OP.hasORNumber(orderOfPaymentID)) { btnPay.Enabled = false; btnPay.Text = "PAID"; lbPaid.Visible = true; lbPaid.Text += OP.ORNumber.ToString() + ")"; } // Compute Total float[] total = Payor.computeAccount(listView1); temp = total[0] + total[1]; lbTotal.Text = "Total = " + Convert.ToString(temp); lbTuition.Text = "Tuition = " + Convert.ToString(total[0]); lbMsc.Text = "Msc = " + Convert.ToString(total[1]); listView1.Visible = true; } }
private void btnDelete_Click(object sender, EventArgs e) { try { new clsDB().Con().listViewRemoveSelectedIndex(lvDataEntryOP); float[] account = Payor.computeAccount(lvDataEntryOP); lbTotal.Text = Convert.ToString(account[1]); tAmount.Text = Convert.ToString(account[1]); lvDataEntryOP.Items[lvDataEntryOP.Items.Count - 1].Focused = true; lvDataEntryOP.Items[lvDataEntryOP.Items.Count - 1].Selected = true; } catch (Exception ex) { // Test } }
private void btnAddParticular_Click(object sender, EventArgs e) { frmParticulars f = new frmParticulars(); f.ShowDialog(); string[][] data = f.checkedItems; string[] col = new string[f.listView1.Columns.Count]; if (f.listView1.CheckedItems.Count > 0) { for (int i = 0; i < f.listView1.Columns.Count; i++) { col[i] = f.listView1.Columns[i].Text; } try { if (new clsDB().Con().listViewTransferData(data, lvDataEntryOP, col)) { f.Close(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } try { float[] account = Payor.computeAccount(lvDataEntryOP); lbTotal.Text = Convert.ToString(account[1]); tAmount.Text = Convert.ToString(account[1]); } catch (Exception ex) { lvDataEntryOP.Items.Clear(); MessageBox.Show("Particular Has no Amount"); } } }
private void textBox1_TextChanged(object sender, EventArgs e) { string semNo = tbSemNo.Text; isFullPayment = rbtnFull.Checked; if (int.Parse(semNo) == 0) { MessageBox.Show("No Record Found", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } semNo = (!String.IsNullOrEmpty(tbSemNo.Text.Trim())) ? semNo : "" + 0; new clsDB().Con().FillLvw(listView1, StudentAccount.searchBySemester(semNo, studentData[0])); // for Payment summary float[] accountData = null; accountData = Payor.computeAccount(listView1); float tuitionFee = accountData[0]; float mscFee = accountData[1]; // Compute Tuition Fee Based on payment type tuitionFee = (isFullPayment) ? tuitionFee : tuitionFee / 2; lbTuitionFee.Text = "" + tuitionFee; lbMscFee.Text = "" + mscFee; // Total float total = tuitionFee + mscFee; lbTotal.Text = "" + total; tAmount.Text = "" + total; new clsDB().Con().checkAllListView(listView1); }
private void btnAddParticular_Click_1(object sender, EventArgs e) { string particular = ""; string query = "Select AssessmentID, AssessmentName, ISNULL(Amount,0) from assessment WHERE AssessmentName = '"; if (cmbParticular.SelectedIndex > -1) { particular = cmbParticular.SelectedItem.ToString(); } else { particular = cmbParticular.Text; } try { if (!string.IsNullOrEmpty(particular)) { int count = new clsDB().Con().countRecord(query + particular + "'"); string[] column = { "No", "Particulars", "Amount" }; string[][] data = new string[count][]; string[] obj = new string[3]; bool hasAmount = false; // if has record in the database - get data for transfer if (count > 0) { if (new clsDB().Con().SelectData(query + particular + "'", obj)) { data[0] = obj; // check if the amount is zero and ask for input if (float.Parse(data[0][2]) >= 0 || data[0][1] == "Tuition Fee") { frmParticularAmountDataEntry f = new frmParticularAmountDataEntry(int.Parse(data[0][0])); // FLAG for TUITION FEE if (data[0][1] == "Tuition Fee") { f.isTuitionFee = true; isTuitionFee = true; } f.ShowDialog(); data[0][2] = Convert.ToString(f.amount); hasAmount = f.hasAmount; } else { hasAmount = true; } if (hasAmount && new clsDB().Con().listViewTransferData(data, lvDataEntryOP, column)) { float[] account = Payor.computeAccount(lvDataEntryOP); // Set TEMPORARY FIX for TUITION PAYMENT - G lbTotal.Text = Convert.ToString(account[0] + account[1]); tAmount.Text = Convert.ToString(account[0] + account[1]); /** * lbTotal.Text = Convert.ToString(account[1]); * tAmount.Text = Convert.ToString(account[1]); */ } } } else { pNewParticular.Visible = true; } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }