public ActionResult SearchAPDebitNote(string documentNo) { if (documentNo != "0") { APDebitNote apDebitNote = null; apDebitNote = new NetStock.BusinessFactory.APDebitNoteBO().GetAPDebitNote(new APDebitNote { DocumentNo = documentNo }); if (apDebitNote == null) { apDebitNote = new APDebitNote(); apDebitNote.DocumentDate = DateTime.Today.Date; apDebitNote.APDebitNoteDetails = new List <APDebitNoteDetail>(); } return(RedirectToAction("APDebitNote", new { InvoiceType = "", DocumentNo = documentNo })); //return View("CBReceipt", cbReceipt); } else { return(RedirectToAction("APDebitNote")); } }
private void gridData_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { if (gridData.SelectedRows.Count > 0) { APDEBIT_NOTE = (APDebitNote)gridData.SelectedRows[0].Tag; this.Close(); } }
private void OKkryptonButton_Click(object sender, EventArgs e) { if (gridData.SelectedRows.Count > 0) { APDEBIT_NOTE = (APDebitNote)gridData.SelectedRows[0].Tag; this.Close(); } }
public void ClearForm() { try { m_prn = new APDebitNote(); textBoxCode.Text = ""; dateKryptonDateTimePicker.Value = DateTime.Today; employeeKryptonComboBox.SelectedIndex = 0; notesKryptonTextBox.Text = ""; supplierkryptonComboBox.SelectedIndex = 0; netAmountkryptonNumericUpDown.Value = 0; currencyKryptonComboBox.SelectedIndex = 0; itemsDataGrid.Rows.Clear(); errorProvider1.Clear(); } catch (Exception x) { KryptonMessageBox.Show(x.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
void dataItemskryptonDataGridView_CellValidated(object sender, DataGridViewCellEventArgs e) { if (m_editMode == EditMode.View) { return; } if (!itemsDataGrid[e.ColumnIndex, e.RowIndex].IsInEditMode) { return; } if (docnoColumn.Index == e.ColumnIndex) { if (itemsDataGrid[docnoColumn.Index, e.RowIndex].Tag != null) { APDebitNote ap = (APDebitNote)itemsDataGrid[docnoColumn.Index, e.RowIndex].Tag; itemsDataGrid[docnoColumn.Index, e.RowIndex].Value = ap.CODE; } } if (e.ColumnIndex == paymentAmountColumn.Index || e.ColumnIndex == docnoColumn.Index) { ReCalculateNetTotal(); } }
public ActionResult APDebitNote(string invoiceType, string documentNo) { APDebitNote apDebitNote = null; if (invoiceType == Utility.NEWRECORD) { apDebitNote = new APDebitNote(); apDebitNote.DocumentDate = DateTime.UtcNow.ThaiTime(); apDebitNote.APDebitNoteDetails = new List <APDebitNoteDetail>(); apDebitNote.CreditorList = Utility.GetCreditorList(); apDebitNote.AccountCodeList = Utility.GetAccountCodeItemList(); } else { if (documentNo != null && documentNo != "") { apDebitNote = new NetStock.BusinessFactory.APDebitNoteBO().GetAPDebitNote(new APDebitNote { DocumentNo = documentNo }); apDebitNote.CreditorList = Utility.GetCreditorList(); apDebitNote.AccountCodeList = Utility.GetAccountCodeItemList(); } else { //apInvoice = new NetStock.BusinessFactory.APInvoiceBO().GetList().FirstOrDefault(); apDebitNote = new APDebitNote(); apDebitNote.DocumentDate = DateTime.UtcNow.ThaiTime(); apDebitNote.APDebitNoteDetails = new List <APDebitNoteDetail>(); apDebitNote.CreditorList = Utility.GetCreditorList(); apDebitNote.AccountCodeList = Utility.GetAccountCodeItemList(); } } return(View("APDebitNote", apDebitNote)); }
private void searchToolStripButton_Click(object sender, EventArgs e) { IList result = searchToolStripTextBox.Text == string.Empty ? new ArrayList() : r_apdn.Search(searchToolStripTextBox.Text); if (result.Count == 1) { m_prn = (APDebitNote)result[0]; m_prn = (APDebitNote)r_apdn.Get(m_prn.ID); //m_prn.EMPLOYEE = (Employee)r_employee.GetById(m_prn.EMPLOYEE); // m_prn.VENDOR = (Supplier)r_sup.GetById(m_prn.VENDOR); setEditMode(EditMode.View); loadData(); setEnableForm(false); } else { using (SearchAPDebitNoteForm frm = new SearchAPDebitNoteForm(searchToolStripTextBox.Text, result, m_mainForm.CurrentUser)) { frm.ShowDialog(); if (frm.APDEBIT_NOTE == null) { return; } else { m_prn = frm.APDEBIT_NOTE; m_prn = (APDebitNote)r_apdn.Get(m_prn.ID); m_prn.EMPLOYEE = (Employee)r_employee.GetById(m_prn.EMPLOYEE); // m_prn.VENDOR = (Supplier)r_sup.GetById(m_prn.VENDOR); setEditMode(EditMode.View); loadData(); setEnableForm(false); } } } }
private void CANCELkryptonButton_Click(object sender, EventArgs e) { APDEBIT_NOTE = null; this.Close(); }
private void runReporttoolStripButton_Click(object sender, EventArgs e) { Supplier s = (Supplier)supplierkryptonComboBox.SelectedItem; bool allStatus = statuskryptonComboBox2.Text == "ALL"; bool status = true; if (!allStatus) { status = Boolean.Parse(statuskryptonComboBox2.Text); } string type = trtypekryptonComboBox1.Text; IList trs = r_sup.GetAllTransactions(s.ID, startdateKryptonDateTimePicker.Value, enDatekryptonDateTimePicker1.Value, allStatus, status); transactionkryptonDataGridView.Rows.Clear(); if (trs.Count > 0) { foreach (object ev in trs) { if (ev is Event) { Event t = (Event)ev; if (type != "ALL") { if (t.STOCK_CARD_ENTRY_TYPE.ToString() != type) { continue; } } int r = transactionkryptonDataGridView.Rows.Add(); transactionkryptonDataGridView[datetrColumn.Index, r].Value = t.TRANSACTION_DATE; transactionkryptonDataGridView[typeTrColumn.Index, r].Value = t.STOCK_CARD_ENTRY_TYPE.ToString(); transactionkryptonDataGridView[codeTrColumn.Index, r].Value = t.CODE; transactionkryptonDataGridView[postedColumn.Index, r].Value = t.POSTED.ToString(); Supplier sup = (Supplier)r_sup.GetById((Supplier)t.VENDOR); Employee emp = (Employee)r_emp.GetById(t.EMPLOYEE); transactionkryptonDataGridView[supplierColumn.Index, r].Value = sup.NAME; transactionkryptonDataGridView[supCodeColumn.Index, r].Value = sup.CODE; transactionkryptonDataGridView[supAddressColumn.Index, r].Value = sup.ADDRESS; transactionkryptonDataGridView[employeeColumn.Index, r].Value = emp.CODE; if (t is PurchaseOrder) { PurchaseOrder p = (PurchaseOrder)t; p.TOP = (TermOfPayment)r_top.GetById(p.TOP); p.CURRENCY = (Currency)r_ccy.GetById(p.CURRENCY); transactionkryptonDataGridView[topColumn.Index, r].Value = p.TOP.CODE; transactionkryptonDataGridView[amountColumn.Index, r].Value = p.NET_TOTAL; transactionkryptonDataGridView[ccyColumn.Index, r].Value = p.CURRENCY.CODE; } if (t is SupplierInvoice) { SupplierInvoice p = (SupplierInvoice)t; p.TOP = (TermOfPayment)r_top.GetById(p.TOP); p.CURRENCY = (Currency)r_ccy.GetById(p.CURRENCY); transactionkryptonDataGridView[topColumn.Index, r].Value = p.TOP.CODE; transactionkryptonDataGridView[amountColumn.Index, r].Value = p.NET_TOTAL; transactionkryptonDataGridView[ccyColumn.Index, r].Value = p.CURRENCY.CODE; } } if (ev is EventJournal) { EventJournal t = (EventJournal)ev; if (type != "ALL") { if (t.VENDOR_BALANCE_ENTRY_TYPE.ToString() != type) { continue; } } int r = transactionkryptonDataGridView.Rows.Add(); transactionkryptonDataGridView[datetrColumn.Index, r].Value = t.TRANSACTION_DATE; transactionkryptonDataGridView[typeTrColumn.Index, r].Value = t.VENDOR_BALANCE_ENTRY_TYPE.ToString(); transactionkryptonDataGridView[codeTrColumn.Index, r].Value = t.CODE; transactionkryptonDataGridView[postedColumn.Index, r].Value = t.POSTED.ToString(); Supplier sup = (Supplier)r_sup.GetById((Supplier)t.VENDOR); Employee emp = (Employee)r_emp.GetById(t.EMPLOYEE); transactionkryptonDataGridView[supplierColumn.Index, r].Value = sup.NAME; transactionkryptonDataGridView[supCodeColumn.Index, r].Value = sup.CODE; transactionkryptonDataGridView[supAddressColumn.Index, r].Value = sup.ADDRESS; transactionkryptonDataGridView[employeeColumn.Index, r].Value = emp.CODE; if (t is Payment) { Payment p = (Payment)t; p.CURRENCY = (Currency)r_ccy.GetById(p.CURRENCY); transactionkryptonDataGridView[amountColumn.Index, r].Value = p.NET_AMOUNT; transactionkryptonDataGridView[ccyColumn.Index, r].Value = p.CURRENCY.CODE; } if (t is SupplierOutStandingInvoice) { SupplierOutStandingInvoice p = (SupplierOutStandingInvoice)t; p.CURRENCY = (Currency)r_ccy.GetById(p.CURRENCY); transactionkryptonDataGridView[amountColumn.Index, r].Value = p.NET_AMOUNT; transactionkryptonDataGridView[ccyColumn.Index, r].Value = p.CURRENCY.CODE; } if (t is APDebitNote) { APDebitNote p = (APDebitNote)t; p.CURRENCY = (Currency)r_ccy.GetById(p.CURRENCY); transactionkryptonDataGridView[amountColumn.Index, r].Value = p.NET_AMOUNT; transactionkryptonDataGridView[ccyColumn.Index, r].Value = p.CURRENCY.CODE; } } } } }
public APDebitNote GetAPDebitNote(APDebitNote item) { return((APDebitNote)apdebitnoteDAL.GetItem <APDebitNote>(item)); }
public bool DeleteAPDebitNote(APDebitNote item) { return(apdebitnoteDAL.Delete(item)); }
public bool SaveAPDebitNote(APDebitNote newItem) { return(apdebitnoteDAL.Save(newItem)); }
void dataItemskryptonDataGridView_CellValidating(object sender, DataGridViewCellValidatingEventArgs e) { if (m_editMode == EditMode.View) { return; } itemsDataGrid.Rows[e.RowIndex].ErrorText = ""; if (!itemsDataGrid[e.ColumnIndex, e.RowIndex].IsInEditMode) { return; } if (e.ColumnIndex == paymentAmountColumn.Index) { double py = Convert.ToDouble(e.FormattedValue); if (itemsDataGrid[invoiceNoColumn.Index, e.RowIndex].Tag == null) { return; } if (itemsDataGrid[invoiceNoColumn.Index, e.RowIndex].Tag is SupplierInvoiceJournalItem) { SupplierInvoiceJournalItem si = (SupplierInvoiceJournalItem)itemsDataGrid[invoiceNoColumn.Index, e.RowIndex].Tag; si.OUTSTANDING_AMOUNT = r_sij.GetOutstanding(si.ID); if (si == null) { e.Cancel = true; itemsDataGrid.Rows[e.RowIndex].ErrorText = "Please Fill Invoice"; return; } if (py > si.OUTSTANDING_AMOUNT) { e.Cancel = true; itemsDataGrid.Rows[e.RowIndex].ErrorText = "Payment exceed outstanding amount"; return; } } if (itemsDataGrid[invoiceNoColumn.Index, e.RowIndex].Tag is SupplierOutStandingInvoiceItem) { SupplierOutStandingInvoiceItem si = (SupplierOutStandingInvoiceItem)itemsDataGrid[invoiceNoColumn.Index, e.RowIndex].Tag; si.OUTSTANDING_AMOUNT = r_soij.GetOutstanding(si.ID); if (si == null) { e.Cancel = true; itemsDataGrid.Rows[e.RowIndex].ErrorText = "Please Fill Invoice"; return; } if (py > si.OUTSTANDING_AMOUNT) { e.Cancel = true; itemsDataGrid.Rows[e.RowIndex].ErrorText = "Payment exceed outstanding amount"; return; } } } if (docnoColumn.Index == e.ColumnIndex) { PaymentType type = (PaymentType)Enum.Parse(typeof(PaymentType), itemsDataGrid[paymentTypeColumn.Index, e.RowIndex].Value.ToString()); if (type == PaymentType.APDebitNote) { itemsDataGrid[docnoColumn.Index, e.RowIndex].Tag = null; IList notin = new ArrayList(); for (int i = 0; i < itemsDataGrid.Rows.Count; i++) { if (i == e.RowIndex) { continue; } if (itemsDataGrid[docnoColumn.Index, i].Tag == null) { continue; } APDebitNote ap = (APDebitNote)itemsDataGrid[docnoColumn.Index, i].Tag; if (ap == null) { continue; } notin.Add(ap.ID); } IList result = r_apdn.FindAPDNForPayment(((Supplier)supplierkryptonComboBox.SelectedItem).ID, dateKryptonDateTimePicker.Value, e.FormattedValue.ToString(), notin); if (result.Count == 1) { itemsDataGrid[docnoColumn.Index, e.RowIndex].Tag = result[0]; itemsDataGrid[docnoColumn.Index, e.RowIndex].Value = ((APDebitNote)result[0]).CODE; itemsDataGrid[paymentAmountColumn.Index, e.RowIndex].Value = ((APDebitNote)result[0]).NET_AMOUNT; itemsDataGrid[docdateColumn.Index, e.RowIndex].Value = ((APDebitNote)result[0]).TRANSACTION_DATE; itemsDataGrid[noteColumn.Index, e.RowIndex].Value = ((APDebitNote)result[0]).NOTES; } else { using (SearchAPDNForPaymentForm ap = new SearchAPDNForPaymentForm(e.FormattedValue.ToString(), (Supplier)supplierkryptonComboBox.SelectedItem, result, m_mainForm.CurrentUser, dateKryptonDateTimePicker.Value, notin)) { ap.ShowDialog(); APDebitNote res = ap.APDEBIT_NOTE; if (res == null) { return; } itemsDataGrid[docnoColumn.Index, e.RowIndex].Tag = res; itemsDataGrid[docnoColumn.Index, e.RowIndex].Value = res.CODE; itemsDataGrid[paymentAmountColumn.Index, e.RowIndex].Value = res.NET_AMOUNT; itemsDataGrid[docdateColumn.Index, e.RowIndex].Value = res.TRANSACTION_DATE; itemsDataGrid[noteColumn.Index, e.RowIndex].Value = res.NOTES; } } } } if (paymentTypeColumn.Index == e.ColumnIndex) { itemsDataGrid[paymentAmountColumn.Index, e.RowIndex].Value = 0; itemsDataGrid[paymentAmountColumn.Index, e.RowIndex].ReadOnly = false; itemsDataGrid[docdateColumn.Index, e.RowIndex].ReadOnly = false; PaymentType type = (PaymentType)Enum.Parse(typeof(PaymentType), e.FormattedValue.ToString()); if (type == PaymentType.APDebitNote) { itemsDataGrid[paymentAmountColumn.Index, e.RowIndex].ReadOnly = true; itemsDataGrid[docdateColumn.Index, e.RowIndex].ReadOnly = true; } } }