} //----------------------------- //this procedure inserts a new payment details public void InsertPaymentDetails(CommonExchange.SysAccess userInfo, ref CommonExchange.PaymentDetails paymentInfo) { paymentInfo.ReceiptNo = PrimaryKeys.GetNewReceiptNoPaymentDetails(userInfo); using (SqlCommand sqlComm = new SqlCommand()) { sqlComm.Connection = userInfo.Connection; sqlComm.CommandType = CommandType.StoredProcedure; sqlComm.CommandText = "dental.InsertPaymentDetails"; sqlComm.Parameters.Add("@receipt_no", SqlDbType.VarChar).Value = paymentInfo.ReceiptNo; sqlComm.Parameters.Add("@sysid_registration", SqlDbType.VarChar).Value = paymentInfo.RegistrationSystemId; sqlComm.Parameters.Add("@date_paid", SqlDbType.DateTime).Value = DateTime.Parse(paymentInfo.DatePaid); sqlComm.Parameters.Add("@amount", SqlDbType.Decimal).Value = paymentInfo.Amount; sqlComm.Parameters.Add("@discount", SqlDbType.Decimal).Value = paymentInfo.Discount; sqlComm.Parameters.Add("@payment_type", SqlDbType.TinyInt).Value = paymentInfo.PaymentType; sqlComm.Parameters.Add("@bank_name", SqlDbType.VarChar).Value = paymentInfo.BankName; sqlComm.Parameters.Add("@check_no", SqlDbType.VarChar).Value = paymentInfo.CheckNo; sqlComm.Parameters.Add("@card_number", SqlDbType.VarChar).Value = paymentInfo.CardNumber; sqlComm.Parameters.Add("@card_type", SqlDbType.VarChar).Value = paymentInfo.CardType; sqlComm.Parameters.Add("@card_expire", SqlDbType.VarChar).Value = paymentInfo.CardExpire; sqlComm.Parameters.Add("@created_by", SqlDbType.VarChar).Value = userInfo.UserId; sqlComm.ExecuteNonQuery(); } } //------------------------------
} //----------------------------------------- //this function returns the payment details public CommonExchange.PaymentDetails GetPaymentDetails(String receiptNo) { CommonExchange.PaymentDetails paymentInfo = new CommonExchange.PaymentDetails(); if (_paymentDetailsTable != null) { String strFilter = "receipt_no = '" + receiptNo + "'"; DataRow[] selectRow = _paymentDetailsTable.Select(strFilter); foreach (DataRow payRow in selectRow) { paymentInfo.ReceiptNo = DatabaseLib.ProcStatic.DataRowConvert(payRow, "receipt_no", ""); paymentInfo.DatePaid = DatabaseLib.ProcStatic.DataRowConvert(payRow, "date_paid", DateTime.Parse(s_serverDateTime)).ToLongDateString(); paymentInfo.Amount = DatabaseLib.ProcStatic.DataRowConvert(payRow, "amount", Decimal.Parse("0")); paymentInfo.Discount = DatabaseLib.ProcStatic.DataRowConvert(payRow, "discount", Decimal.Parse("0")); paymentInfo.PaymentType = DatabaseLib.ProcStatic.DataRowConvert(payRow, "payment_type", Byte.Parse("0")); paymentInfo.BankName = DatabaseLib.ProcStatic.DataRowConvert(payRow, "bank_name", ""); paymentInfo.CheckNo = DatabaseLib.ProcStatic.DataRowConvert(payRow, "check_no", ""); paymentInfo.CardNumber = DatabaseLib.ProcStatic.DataRowConvert(payRow, "card_number", ""); paymentInfo.CardType = DatabaseLib.ProcStatic.DataRowConvert(payRow, "card_type", ""); paymentInfo.CardExpire = DatabaseLib.ProcStatic.DataRowConvert(payRow, "card_expire", ""); } } return(paymentInfo); } //----------------------------
} //------------------------------------ //this procedure inserts a new payment details public void DeletePaymentDetails(CommonExchange.SysAccess userInfo, CommonExchange.PaymentDetails paymentInfo) { using (DatabaseLib.DbLibRegistrationManager dbLib = new DatabaseLib.DbLibRegistrationManager()) { dbLib.DeletePaymentDetails(userInfo, paymentInfo); } if (_paymentDetailsTable != null) { Int32 index = 0; foreach (DataRow payRow in _paymentDetailsTable.Rows) { if (String.Equals(paymentInfo.ReceiptNo, payRow["receipt_no"].ToString())) { DataRow delRow = _paymentDetailsTable.Rows[index]; delRow.Delete(); break; } index++; } _paymentDetailsTable.AcceptChanges(); } } //------------------------------------
} //-------------------------------- //this procedure inserts a new payment details public void InsertPaymentDetails(CommonExchange.SysAccess userInfo, CommonExchange.PaymentDetails paymentInfo) { using (DatabaseLib.DbLibRegistrationManager dbLib = new DatabaseLib.DbLibRegistrationManager()) { dbLib.InsertPaymentDetails(userInfo, ref paymentInfo); } if (_paymentDetailsTable != null) { DataRow newRow = _paymentDetailsTable.NewRow(); newRow["receipt_no"] = paymentInfo.ReceiptNo; newRow["date_paid"] = paymentInfo.DatePaid; newRow["amount"] = paymentInfo.Amount; newRow["discount"] = paymentInfo.Discount; newRow["payment_type"] = paymentInfo.PaymentType; newRow["bank_name"] = paymentInfo.BankName; newRow["check_no"] = paymentInfo.CheckNo; newRow["card_number"] = paymentInfo.CardNumber; newRow["card_type"] = paymentInfo.CardType; newRow["card_expire"] = paymentInfo.CardExpire; _paymentDetailsTable.Rows.Add(newRow); _paymentDetailsTable.AcceptChanges(); } } //--------------------------------------
//############################################CLASS PatientCharges EVENTS####################################################### //event is raised when the class is loaded protected virtual void ClassLoad(object sender, EventArgs e) { if (!DatabaseLib.ProcStatic.IsSystemAccessAdmin(_userInfo) && !DatabaseLib.ProcStatic.IsSystemAccessDentalUser(_userInfo)) { DentalLib.ProcStatic.ShowErrorDialog("You are not allowed to access this module.", "Payment Details"); _hasErrors = true; this.Close(); } else if (!DatabaseLib.ProcStatic.IsSystemAccessAdmin(_userInfo)) { this.lnkChange.Visible = false; } _paymentInfo = new CommonExchange.PaymentDetails(); _paymentInfo.DatePaid = _chargesManager.ServerDateTime; _paymentInfo.RegistrationSystemId = _regInfo.RegistrationSystemId; this.lblDate.Text = DateTime.Parse(_paymentInfo.DatePaid).ToLongDateString(); this.InitializePaymentTypeCombo(); _summary = _chargesManager.GetPaymentSummary(); this.lblBalancetoDate.Text = _summary.Balance.ToString("N"); this.lblShouldBeBalance.Text = _summary.Balance.ToString("N"); } //------------------------------------------------------------
public PaymentDetailsUpdate(CommonExchange.SysAccess userInfo, CommonExchange.Patient patientInfo, CommonExchange.Registration regInfo, CommonExchange.PaymentDetails paymentInfo, ChargesLogic chargesManager) : base(userInfo, patientInfo, regInfo, chargesManager) { this.InitializeComponent(); _paymentInfo = paymentInfo; _paymentInfoTemp = paymentInfo; this.FormClosing += new FormClosingEventHandler(ClassClosing); this.btnUpdate.Click += new EventHandler(btnUpdateClick); this.btnDelete.Click += new EventHandler(btnDeleteClick); this.btnClose.Click += new EventHandler(btnCloseClick); }
} //------------------------------ //this procedure inserts a new payment details public void DeletePaymentDetails(CommonExchange.SysAccess userInfo, CommonExchange.PaymentDetails paymentInfo) { using (SqlCommand sqlComm = new SqlCommand()) { sqlComm.Connection = userInfo.Connection; sqlComm.CommandType = CommandType.StoredProcedure; sqlComm.CommandText = "dental.DeletePaymentDetails"; sqlComm.Parameters.Add("@receipt_no", SqlDbType.VarChar).Value = paymentInfo.ReceiptNo; sqlComm.Parameters.Add("@deleted_by", SqlDbType.VarChar).Value = userInfo.UserId; sqlComm.ExecuteNonQuery(); } } //------------------------------
} //-------------------------------------- //this procedure inserts a new payment details public void UpdatePaymentDetails(CommonExchange.SysAccess userInfo, CommonExchange.PaymentDetails paymentInfo) { using (DatabaseLib.DbLibRegistrationManager dbLib = new DatabaseLib.DbLibRegistrationManager()) { dbLib.UpdatePaymentDetails(userInfo, paymentInfo); } if (_paymentDetailsTable != null) { Int32 index = 0; foreach (DataRow payRow in _paymentDetailsTable.Rows) { if (String.Equals(paymentInfo.ReceiptNo, payRow["receipt_no"].ToString())) { DataRow editRow = _paymentDetailsTable.Rows[index]; editRow.BeginEdit(); editRow["date_paid"] = paymentInfo.DatePaid; editRow["amount"] = paymentInfo.Amount; editRow["discount"] = paymentInfo.Discount; editRow["payment_type"] = paymentInfo.PaymentType; editRow["bank_name"] = paymentInfo.BankName; editRow["check_no"] = paymentInfo.CheckNo; editRow["card_number"] = paymentInfo.CardNumber; editRow["card_type"] = paymentInfo.CardType; editRow["card_expire"] = paymentInfo.CardExpire; editRow.EndEdit(); break; } index++; } _paymentDetailsTable.AcceptChanges(); } } //------------------------------------