private void btnAddPayment_Click(object sender, EventArgs e) { if (isInputFieldsValid()) { decimal paymentAmount = in_PaymentAmount.ValueDecimal; if ((PaymentMethod)cbPaymentMethods.SelectedValue == PaymentMethod.Cash && paymentAmount > _payableAmount) { Tools.displayForm(new SharedForms.Verify_Form("KEMBALI", string.Format("Rp. {0:N0}", paymentAmount - _payableAmount), SharedForms.VerifyFormFontSize.Medium)); paymentAmount = _payableAmount; } if (_paymentMode == PaymentMode.VendorInvoice) { Payment.add(_vendorInvoice.ID, (PaymentMethod)cbPaymentMethods.SelectedValue, paymentAmount, txtNotes.Text.Trim()); } else if (_paymentMode == PaymentMode.SaleInvoice) { Guid?id = Payment.add(_sale.id, (PaymentMethod)cbPaymentMethods.SelectedValue, paymentAmount, txtNotes.Text.Trim()); if (id != null && (PaymentMethod)cbPaymentMethods.SelectedValue == PaymentMethod.Credit) { CustomerCredit.submitNew((Guid)_sale.customer_id, paymentAmount * -1, id, txtNotes.Text.Trim(), null); } } populateData(); //resetData(); txtNotes.Text = ""; _dataWasUpdated = true; } }
/*******************************************************************************************************/ #region ADD/UPDATE ITEM private void btnAddPayment_Click(object sender, EventArgs e) { if (isInputValid()) { _customerID = (Guid)iddl_Customers.SelectedValue; CustomerCredit.submitNew((Guid)_customerID, in_Amount.ValueDecimal, null, txtNotes.Text.Trim(), (PaymentMethod)cbPaymentMethods.SelectedValue); populateGridDetail(); in_Amount.reset(); txtNotes.Text = ""; } }
/*******************************************************************************************************/ #region SUBMISSION private void btnSubmit_Click(object sender, EventArgs e) { if (isSaleReturnValid()) { SaleReturn obj = new SaleReturn(txtNotes.Text, (DataTable)grid.DataSource); if (obj.submitNew() != null) { if (_customerID != null) { CustomerCredit.submitNew((Guid)_customerID, _totalAmount, null, string.Format("Credit from Sale Return " + obj.barcode), PaymentMethod.Cash); Tools.hasMessage("Credit sudah dibuat sejumlah " + lblTotalAmount.Text); } this.Close(); } } }