private void button17_Click(object sender, EventArgs e) { //Hide sub menu filemaintenance panelProcessSub.Visible = false; //controls foreach (Form form in Application.OpenForms) { if (form.GetType() == typeof(CashReceiptVoucher)) { form.Activate(); return; } } CashReceiptVoucher frm = new CashReceiptVoucher(); frm.Show(); frm.MdiParent = this; }
private void button2_Click(object sender, EventArgs e) { if (clsAccess.checkForViewingRestriction("PDC Management", Classes.clsUser.Username) != true) { return; } if (dataGridView1.Rows.Count > 0) { if (dataGridView1.SelectedRows[0].Cells["ORNumber"].Value.ToString() != "") { CashReceiptVoucher or = new CashReceiptVoucher(); foreach (Form form in Application.OpenForms) { if (form.GetType() == typeof(CashReceiptVoucher)) { form.Activate(); or = (CashReceiptVoucher)Application.OpenForms["CashReceiptVoucher"]; } } //REMOVE GRID FIRST or.datagridviewTransaction.Rows.Clear(); or.dataGridView3.Rows.Clear(); or.dgvChecks.Rows.Clear(); //REMOVE THE OPEN OR FIRST if (or.txtORNo.Text != "") { clsOpen.deleteTransaction("Receipt Voucher", or.txtORNo.Text); } or.txtORNo.Text = dataGridView1.SelectedRows[0].Cells["ORNumber"].Value.ToString(); //======================================================== // PAYOR INFORMATION //======================================================== Classes.clsCashReceipt.userID = Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["userID"].Value.ToString()); or.txtPayorID.Text = dataGridView1.SelectedRows[0].Cells["EmployeeID"].Value.ToString(); or.txtPayorName.Text = dataGridView1.SelectedRows[0].Cells["EmpName"].Value.ToString(); or.txtPayorCompany.Text = clsCash.returnCompanyDescription(clsSearchCash.GetCompanyPerMember(dataGridView1.SelectedRows[0].Cells["userID"].Value.ToString())); or.radioMember.Checked = true; //======================================================== // PAYOR TRANSACTION //======================================================== or.radioPecciCheck.Checked = true; using (SqlConnection con = new SqlConnection(global.connectString())) { con.Open(); SqlDataAdapter adapter = new SqlDataAdapter("SELECT * FROM PDCManagementv2_details WHERE ChequeNo = '" + dataGridView1.SelectedRows[0].Cells["ChequeNo"].Value.ToString() + "'", con); DataSet ds = new DataSet(); adapter.Fill(ds); //================================================ // COCI FOR DETAILS //================================================ or.dataGridView3.Rows.Add( "105", "", "", Convert.ToDecimal(dataGridView1.SelectedRows[0].Cells["TotalAmount"].Value.ToString()).ToString("#,0.00"), "0.00", "0" ); for (int x = 0; x < ds.Tables[0].Rows.Count; x++) { switch (ds.Tables[0].Rows[x]["Category"].ToString()) { case "Savings": or.datagridviewTransaction.Rows.Add( "001", "SAVINGS DEPOSIT", Convert.ToDecimal(ds.Tables[0].Rows[x]["Amount"].ToString()).ToString("#,0.00") ); //================================================ // SAVINGS ENTRY //================================================ or.dataGridView3.Rows.Add( "300.1", "", "", "0.00", Convert.ToDecimal(ds.Tables[0].Rows[x]["Amount"].ToString()).ToString("#,0.00"), dataGridView1.SelectedRows[0].Cells["userID"].Value.ToString() ); break; case "Share Capital": or.datagridviewTransaction.Rows.Add( "003", "FIXED DEPOSIT", Convert.ToDecimal(ds.Tables[0].Rows[x]["Amount"].ToString()).ToString("#,0.00") ); //================================================ // SHARE CAPITAL ENTRY //================================================ or.dataGridView3.Rows.Add( "363", "", "", "0.00", Convert.ToDecimal(ds.Tables[0].Rows[x]["Amount"].ToString()).ToString("#,0.00"), dataGridView1.SelectedRows[0].Cells["userID"].Value.ToString() ); break; case "Loan": or.datagridviewTransaction.Rows.Add( "002", clsPDCManagement.returnLoanDescription(ds.Tables[0].Rows[x]["Loan_Type"].ToString()), Convert.ToDecimal(ds.Tables[0].Rows[x]["Amount"].ToString()).ToString("#,0.00") ); //FOR LOAN SETUP clsPDCManagement.getMonthlyDetails(or.dataGridView3, ds.Tables[0].Rows[x]["Loan_No"].ToString(), Convert.ToDouble(ds.Tables[0].Rows[x]["Amount"].ToString()), or.dgvtempBilling); break; } } or.compute(); or.computeDetails(); } //======================================================== // CHEQUE INFORMATION //======================================================== or.dgvChecks.Rows.Add( dataGridView1.SelectedRows[0].Cells["Bank"].Value.ToString(), dataGridView1.SelectedRows[0].Cells["TotalAmount"].Value.ToString(), Convert.ToDateTime(dataGridView1.SelectedRows[0].Cells["ChequeDate"].Value.ToString()).ToShortDateString(), dataGridView1.SelectedRows[0].Cells["ChequeNo"].Value.ToString() ); or.dataGridView3.Sort(or.dataGridView3.Columns["Debit"], ListSortDirection.Descending); //Enable and Disable Buttons or.btnEdit.Enabled = false; or.btnPost.Enabled = false; or.btnCancel.Enabled = false; or.btnAuditted.Enabled = false; or.btnSearch.Enabled = false; or.btnNew.Enabled = true; or.btnNew.Text = "SAVE"; or.btnEdit.Text = "EDIT"; or.btnClose.Text = "CANCEL"; //FROM PDCMANAGEMENT or.frmPDCManagement = true; or.frmPDCManagementChequeNumber = dataGridView1.SelectedRows[0].Cells["ChequeNo"].Value.ToString(); or.Show(); } else { Alert.show("Please update or number.", Alert.AlertType.error); return; } } }
private void btnUse_Click(object sender, EventArgs e) { if (whosLookUp == "2") //From OR { //========================================================================================== // CASH RECEIPT CODE //========================================================================================== CashReceiptVoucher cashOR = new CashReceiptVoucher(); foreach (Form form in Application.OpenForms) { if (form.GetType() == typeof(CashReceiptVoucher)) { //=============================================================================== // If form is already open //=============================================================================== form.Activate(); cashOR = (CashReceiptVoucher)Application.OpenForms["CashReceiptVoucher"]; cashOR.txtPayorID.Text = dataGridView1.SelectedRows[0].Cells["Client_Code"].Value.ToString(); cashOR.txtPayorName.Text = dataGridView1.SelectedRows[0].Cells["Name"].Value.ToString(); this.Close(); return; } } cashOR.txtPayorID.Text = dataGridView1.SelectedRows[0].Cells["Client_Code"].Value.ToString(); cashOR.txtPayorName.Text = dataGridView1.SelectedRows[0].Cells["Name"].Value.ToString(); cashOR.Show(); this.Close(); } else { DisbursementVoucher disbursement = new DisbursementVoucher(); foreach (Form form in Application.OpenForms) { if (form.GetType() == typeof(DisbursementVoucher)) { //=============================================================================== // If form is already open //=============================================================================== form.Activate(); disbursement = (DisbursementVoucher)Application.OpenForms["DisbursementVoucher"]; disbursement.txtPayee.Text = dataGridView1.SelectedRows[0].Cells["Client_Code"].Value.ToString(); disbursement.txtPayeeName.Text = dataGridView1.SelectedRows[0].Cells["Name"].Value.ToString(); disbursement.radioClient.Checked = true; Classes.clsDisbursement.userID = 0; this.Close(); return; } } disbursement.txtPayee.Text = dataGridView1.SelectedRows[0].Cells["Client_Code"].Value.ToString(); disbursement.txtPayeeName.Text = dataGridView1.SelectedRows[0].Cells["Name"].Value.ToString(); disbursement.radioClient.Checked = true; Classes.clsDisbursement.userID = 0; disbursement.Show(); this.Close(); disbursement.Show(); } }
private void button2_Click(object sender, EventArgs e) { switch (Classes.clsLookUp.whosLookUp) { case "0": //Savings SavingsDataEntry savingsDataentry = new SavingsDataEntry(); //Check for hold accounts if (clsHoldAccount.checkIfHoldAccount(Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["userID"].Value.ToString())) == true) { Alert.show("Member's account is on hold.", Alert.AlertType.error); return; } if (clsHoldAccount.checkIfTHeresADependent(dataGridView1.SelectedRows[0].Cells["EmployeeID"].Value.ToString()) == true) { Alert.show("Member's account is on hold.", Alert.AlertType.error); return; } //for dependent purposes //For Resigned Member if (clsMembership.isResigned(Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["userID"].Value.ToString())) == true) { //Already Resigned DialogResult result = MessageBox.Show(this, "This member already resigned, are you sure you want to continue?", "PLDT Credit Cooperative", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.No) { return; } } foreach (Form form in Application.OpenForms) { //Start Validation first if selected account is hold if (form.GetType() == typeof(SavingsDataEntry)) { //=============================================================================== // If form is already open //=============================================================================== form.Activate(); savingsDataentry = (SavingsDataEntry)Application.OpenForms["SavingsDataEntry"]; savingsDataentry.txtEmployeeID.Text = dataGridView1.SelectedRows[0].Cells["EmployeeID"].Value.ToString(); Classes.clsSavingsDataEntry.userID = Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["userID"].Value.ToString()); savingsDataentry.txtName.Text = dataGridView1.SelectedRows[0].Cells["LastName"].Value.ToString() + ", " + dataGridView1.SelectedRows[0].Cells["FirstName"].Value.ToString() + " " + dataGridView1.SelectedRows[0].Cells["MiddleName"].Value.ToString() + dataGridView1.SelectedRows[0].Cells["Suffix"].Value.ToString(); if (dataGridView1.SelectedRows[0].Cells["Savings_Deposit"].Value == DBNull.Value) { savingsDataentry.txtSDDeduction.Text = "0.00"; } else { savingsDataentry.txtSDDeduction.Text = Convert.ToDecimal(dataGridView1.SelectedRows[0].Cells["Savings_Deposit"].Value).ToString("#,##0.00"); } savingsDataentry.txtCurrentBalanceBeforeWithdrawal.Text = clsSavingsDataEntry.returnMembersSaving(dataGridView1.SelectedRows[0].Cells["userID"].Value.ToString()); //If theres a deposited check savingsDataentry.txtdepositedCheque.Text = clsSavings.returnDepositedChequeAmount(Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["userID"].Value.ToString())); savingsDataentry.txtDepositedDate.Text = clsSavings.returnDepositedChequeDate(Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["userID"].Value.ToString())); //MINUS THE CHECK AMOUNT if (savingsDataentry.txtdepositedCheque.Text != "") { Decimal widAmnt; widAmnt = Convert.ToDecimal(savingsDataentry.txtCurrentBalanceBeforeWithdrawal.Text) - Convert.ToDecimal(savingsDataentry.txtdepositedCheque.Text); savingsDataentry.txtWithdrawalBalance.Text = widAmnt.ToString("#,0.00"); } else { savingsDataentry.txtWithdrawalBalance.Text = clsSavingsDataEntry.returnMembersSaving(dataGridView1.SelectedRows[0].Cells["userID"].Value.ToString()); } savingsDataentry.txtCompany.Text = clsSavingsDataEntry.returnCompanyDescription(dataGridView1.SelectedRows[0].Cells["Company_Code"].Value.ToString()); savingsDataentry.txtLastDateWithdrawal.Text = clsSavings.returnLastWithdrawalDate(Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["userID"].Value.ToString())); //For Account number and Bank Code savingsDataentry.txtAccntNo.Text = dataGridView1.SelectedRows[0].Cells["ATM_Account_No"].Value.ToString(); savingsDataentry.txtBankCode.Text = dataGridView1.SelectedRows[0].Cells["Bank_Code"].Value.ToString(); savingsDataentry.txtAmountWithdrawn.Focus(); this.Close(); return; } } savingsDataentry.txtEmployeeID.Text = dataGridView1.SelectedRows[0].Cells["EmployeeID"].Value.ToString(); savingsDataentry.txtLastDateWithdrawal.Text = clsSavings.returnLastWithdrawalDate(Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["userID"].Value.ToString())); Classes.clsSavingsDataEntry.userID = Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["userID"].Value.ToString()); savingsDataentry.txtName.Text = dataGridView1.SelectedRows[0].Cells["LastName"].Value.ToString() + ", " + dataGridView1.SelectedRows[0].Cells["FirstName"].Value.ToString() + " " + dataGridView1.SelectedRows[0].Cells["MiddleName"].Value.ToString() + dataGridView1.SelectedRows[0].Cells["Suffix"].Value.ToString(); if (dataGridView1.SelectedRows[0].Cells["Savings_Deposit"].Value == DBNull.Value) { savingsDataentry.txtSDDeduction.Text = "0.00"; } else { savingsDataentry.txtSDDeduction.Text = Convert.ToDecimal(dataGridView1.SelectedRows[0].Cells["Savings_Deposit"].Value).ToString("#,##0.00"); } savingsDataentry.txtCurrentBalanceBeforeWithdrawal.Text = clsSavingsDataEntry.returnMembersSaving(dataGridView1.SelectedRows[0].Cells["userID"].Value.ToString()); //If theres a deposited check savingsDataentry.txtdepositedCheque.Text = clsSavings.returnDepositedChequeAmount(Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["userID"].Value.ToString())); savingsDataentry.txtDepositedDate.Text = clsSavings.returnDepositedChequeDate(Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["userID"].Value.ToString())); //MINUS THE CHECK AMOUNT if (savingsDataentry.txtdepositedCheque.Text != "") { Decimal widAmnt; widAmnt = Convert.ToDecimal(savingsDataentry.txtCurrentBalanceBeforeWithdrawal.Text) - Convert.ToDecimal(savingsDataentry.txtdepositedCheque.Text); savingsDataentry.txtWithdrawalBalance.Text = widAmnt.ToString("#,0.00"); } else { savingsDataentry.txtWithdrawalBalance.Text = clsSavingsDataEntry.returnMembersSaving(dataGridView1.SelectedRows[0].Cells["userID"].Value.ToString()); } savingsDataentry.txtCompany.Text = clsSavingsDataEntry.returnCompanyDescription(dataGridView1.SelectedRows[0].Cells["Company_Code"].Value.ToString()); //For Account number and Bank Code savingsDataentry.txtAccntNo.Text = dataGridView1.SelectedRows[0].Cells["ATM_Account_No"].Value.ToString(); savingsDataentry.txtBankCode.Text = dataGridView1.SelectedRows[0].Cells["Bank_Code"].Value.ToString(); savingsDataentry.Show(); this.Close(); savingsDataentry.txtAmountWithdrawn.Focus(); savingsDataentry.Show(); break; case "1": //========================================================================================== // DISBURSEMENT CODE //========================================================================================== DisbursementVoucher disbursement = new DisbursementVoucher(); foreach (Form form in Application.OpenForms) { if (form.GetType() == typeof(DisbursementVoucher)) { //=============================================================================== // If form is already open //=============================================================================== form.Activate(); disbursement = (DisbursementVoucher)Application.OpenForms["DisbursementVoucher"]; Classes.clsDisbursement.userID = Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["userID"].Value.ToString()); LoanLookUpProcess.clsLoanLookUpMember.userid = Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["userID"].Value.ToString()); disbursement.txtLoanNo.Text = ""; disbursement.txtLoanType.Text = ""; disbursement.txtPayee.Text = dataGridView1.SelectedRows[0].Cells["EmployeeID"].Value.ToString(); disbursement.txtPayeeName.Text = dataGridView1.SelectedRows[0].Cells["LastName"].Value.ToString() + ", " + dataGridView1.SelectedRows[0].Cells["FirstName"].Value.ToString() + " " + dataGridView1.SelectedRows[0].Cells["MiddleName"].Value.ToString() + dataGridView1.SelectedRows[0].Cells["Suffix"].Value.ToString(); this.Close(); return; } } Classes.clsDisbursement.userID = Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["userID"].Value.ToString()); LoanLookUpProcess.clsLoanLookUpMember.userid = Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["userID"].Value.ToString()); disbursement.txtLoanNo.Text = ""; disbursement.txtLoanType.Text = ""; disbursement.txtPayee.Text = dataGridView1.SelectedRows[0].Cells["EmployeeID"].Value.ToString(); disbursement.txtPayeeName.Text = dataGridView1.SelectedRows[0].Cells["LastName"].Value.ToString() + ", " + dataGridView1.SelectedRows[0].Cells["FirstName"].Value.ToString() + " " + dataGridView1.SelectedRows[0].Cells["MiddleName"].Value.ToString() + dataGridView1.SelectedRows[0].Cells["Suffix"].Value.ToString(); disbursement.Show(); this.Close(); break; case "2": //========================================================================================== // CASH RECEIPT CODE //========================================================================================== CashReceiptVoucher cashOR = new CashReceiptVoucher(); foreach (Form form in Application.OpenForms) { if (form.GetType() == typeof(CashReceiptVoucher)) { //=============================================================================== // If form is already open //=============================================================================== form.Activate(); cashOR = (CashReceiptVoucher)Application.OpenForms["CashReceiptVoucher"]; Classes.clsCashReceipt.userID = Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["userID"].Value.ToString()); cashOR.txtPayorID.Text = dataGridView1.SelectedRows[0].Cells["EmployeeID"].Value.ToString(); cashOR.txtPayorName.Text = dataGridView1.SelectedRows[0].Cells["LastName"].Value.ToString() + ", " + dataGridView1.SelectedRows[0].Cells["FirstName"].Value.ToString() + " " + dataGridView1.SelectedRows[0].Cells["MiddleName"].Value.ToString() + dataGridView1.SelectedRows[0].Cells["Suffix"].Value.ToString(); cashOR.txtPayorCompany.Text = clsCash.returnCompanyDescription(dataGridView1.SelectedRows[0].Cells["Company_Code"].Value.ToString()); this.Close(); return; } } Classes.clsCashReceipt.userID = Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["userID"].Value.ToString()); cashOR.txtPayorID.Text = dataGridView1.SelectedRows[0].Cells["EmployeeID"].Value.ToString(); cashOR.txtPayorName.Text = dataGridView1.SelectedRows[0].Cells["LastName"].Value.ToString() + ", " + dataGridView1.SelectedRows[0].Cells["FirstName"].Value.ToString() + " " + dataGridView1.SelectedRows[0].Cells["MiddleName"].Value.ToString() + dataGridView1.SelectedRows[0].Cells["Suffix"].Value.ToString(); cashOR.txtPayorCompany.Text = clsCash.returnCompanyDescription(dataGridView1.SelectedRows[0].Cells["Company_Code"].Value.ToString()); cashOR.Show(); this.Close(); break; } }