Exemple #1
0
        public ActionResult SearchARCreditNote(string documentNo)
        {
            if (documentNo != "0")
            {
                ARCreditNote ARCreditNote = null;

                ARCreditNote = new NetStock.BusinessFactory.ARCreditNoteBO().GetARCreditNote(new ARCreditNote {
                    DocumentNo = documentNo
                });

                if (ARCreditNote == null)
                {
                    ARCreditNote = new ARCreditNote();
                    ARCreditNote.DocumentDate        = DateTime.Today.Date;
                    ARCreditNote.ARCreditNoteDetails = new List <ARCreditNoteDetail>();
                }


                return(RedirectToAction("ARCreditNote", new { InvoiceType = "", DocumentNo = documentNo }));
                //return View("CBReceipt", cbReceipt);
            }
            else
            {
                return(RedirectToAction("ARCreditNote"));
            }
        }
Exemple #2
0
 private void OKkryptonButton_Click(object sender, EventArgs e)
 {
     if (gridData.SelectedRows.Count > 0)
     {
         ARCREDIT_NOTE = (ARCreditNote)gridData.SelectedRows[0].Tag;
         this.Close();
     }
 }
Exemple #3
0
 private void gridData_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
 {
     if (gridData.SelectedRows.Count > 0)
     {
         ARCREDIT_NOTE = (ARCreditNote)gridData.SelectedRows[0].Tag;
         this.Close();
     }
 }
Exemple #4
0
        public void ClearForm()
        {
            try
            {
                m_prn            = new ARCreditNote();
                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);
            }
        }
Exemple #5
0
        public ActionResult ARCreditNote(string invoiceType, string documentNo)
        {
            ARCreditNote ARCreditNote = null;

            if (invoiceType == Utility.NEWRECORD)
            {
                ARCreditNote = new ARCreditNote();
                ARCreditNote.DocumentDate        = DateTime.UtcNow.ThaiTime();
                ARCreditNote.ARCreditNoteDetails = new List <ARCreditNoteDetail>();

                ARCreditNote.AccountCodeList = Utility.GetAccountCodeItemList();
            }
            else
            {
                if (documentNo != null && documentNo != "")
                {
                    ARCreditNote = new NetStock.BusinessFactory.ARCreditNoteBO().GetARCreditNote(new ARCreditNote {
                        DocumentNo = documentNo
                    });
                    ARCreditNote.AccountCodeList = Utility.GetAccountCodeItemList();
                }
                else
                {
                    //ARInvoice = new NetStock.BusinessFactory.ARInvoiceBO().GetList().FirstOrDefault();

                    ARCreditNote = new ARCreditNote();
                    ARCreditNote.DocumentDate        = DateTime.Today.Date;
                    ARCreditNote.ARCreditNoteDetails = new List <ARCreditNoteDetail>();
                    ARCreditNote.AccountCodeList     = Utility.GetAccountCodeItemList();
                }
            }
            ARCreditNote.DebtorList        = Utility.GetDebtorList();
            ARCreditNote.CurrencyCodeList  = Utility.GetCurrencyItemList();
            ARCreditNote.DebtorAccountList = Utility.GetDebtorAccountList();


            return(View("ARCreditNote", ARCreditNote));
        }
Exemple #6
0
 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)
         {
             ARCreditNote ap = (ARCreditNote)itemsDataGrid[docnoColumn.Index, e.RowIndex].Tag;
             itemsDataGrid[docnoColumn.Index, e.RowIndex].Value = ap.CODE;
         }
     }
     if (e.ColumnIndex == paymentAmountColumn.Index || e.ColumnIndex == docnoColumn.Index)
     {
         ReCalculateNetTotal();
     }
 }
Exemple #7
0
        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 = (ARCreditNote)result[0];
                m_prn = (ARCreditNote)r_apdn.Get(m_prn.ID);
                //m_prn.EMPLOYEE = (Employee)r_employee.GetById(m_prn.EMPLOYEE);
                // m_prn.VENDOR = (Customer)r_sup.GetById(m_prn.VENDOR);
                setEditMode(EditMode.View);
                loadData();
                setEnableForm(false);
            }
            else
            {
                using (SearchARCreditNoteForm frm = new SearchARCreditNoteForm(searchToolStripTextBox.Text, result, m_mainForm.CurrentUser))
                {
                    frm.ShowDialog();
                    if (frm.ARCREDIT_NOTE == null)
                    {
                        return;
                    }
                    else
                    {
                        m_prn          = frm.ARCREDIT_NOTE;
                        m_prn          = (ARCreditNote)r_apdn.Get(m_prn.ID);
                        m_prn.EMPLOYEE = (Employee)r_employee.GetById(m_prn.EMPLOYEE);
                        // m_prn.VENDOR = (Customer)r_sup.GetById(m_prn.VENDOR);
                        setEditMode(EditMode.View);
                        loadData();
                        setEnableForm(false);
                    }
                }
            }
        }
Exemple #8
0
 public ARCreditNote GetARCreditNote(ARCreditNote item)
 {
     return((ARCreditNote)arcreditnoteDAL.GetItem <ARCreditNote>(item));
 }
Exemple #9
0
 public bool DeleteARCreditNote(ARCreditNote item)
 {
     return(arcreditnoteDAL.Delete(item));
 }
Exemple #10
0
 public bool SaveARCreditNote(ARCreditNote newItem)
 {
     return(arcreditnoteDAL.Save(newItem));
 }
Exemple #11
0
 private void CANCELkryptonButton_Click(object sender, EventArgs e)
 {
     ARCREDIT_NOTE = null;
     this.Close();
 }
        private void runReporttoolStripButton_Click(object sender, EventArgs e)
        {
            Customer s         = (Customer)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();
                        Customer sup = (Customer)r_sup.GetById((Customer)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 SalesOrder)
                        {
                            SalesOrder p = (SalesOrder)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 CustomerInvoice)
                        {
                            CustomerInvoice p = (CustomerInvoice)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 POS)
                        {
                            POS p = (POS)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();
                        Customer sup = (Customer)r_sup.GetById((Customer)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 Receipt)
                        {
                            Receipt p = (Receipt)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 CustomerOutStandingInvoice)
                        {
                            CustomerOutStandingInvoice p = (CustomerOutStandingInvoice)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 ARCreditNote)
                        {
                            ARCreditNote p = (ARCreditNote)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;
                        }
                    }
                }
            }
        }
Exemple #13
0
 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 CustomerInvoiceJournalItem)
         {
             CustomerInvoiceJournalItem si = (CustomerInvoiceJournalItem)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 = "Receipt exceed outstanding amount";
                 return;
             }
         }
         if (itemsDataGrid[invoiceNoColumn.Index, e.RowIndex].Tag is CustomerOutStandingInvoiceItem)
         {
             CustomerOutStandingInvoiceItem si = (CustomerOutStandingInvoiceItem)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 = "Receipt exceed outstanding amount";
                 return;
             }
         }
     }
     if (docnoColumn.Index == e.ColumnIndex)
     {
         ReceiptType type = (ReceiptType)Enum.Parse(typeof(ReceiptType), itemsDataGrid[paymentTypeColumn.Index, e.RowIndex].Value.ToString());
         if (type == ReceiptType.ARCreditNote)
         {
             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;
                 }
                 ARCreditNote ap = (ARCreditNote)itemsDataGrid[docnoColumn.Index, i].Tag;
                 if (ap == null)
                 {
                     continue;
                 }
                 notin.Add(ap.ID);
             }
             IList result = r_apdn.FindARCRForReceipt(((Customer)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         = ((ARCreditNote)result[0]).CODE;
                 itemsDataGrid[paymentAmountColumn.Index, e.RowIndex].Value = ((ARCreditNote)result[0]).NET_AMOUNT;
                 itemsDataGrid[docdateColumn.Index, e.RowIndex].Value       = ((ARCreditNote)result[0]).TRANSACTION_DATE;
                 itemsDataGrid[noteColumn.Index, e.RowIndex].Value          = ((ARCreditNote)result[0]).NOTES;
             }
             else
             {
                 using (SearchARCRForReceiptForm ap = new SearchARCRForReceiptForm(e.FormattedValue.ToString(), (Customer)supplierkryptonComboBox.SelectedItem, result, m_mainForm.CurrentUser, dateKryptonDateTimePicker.Value, notin))
                 {
                     ap.ShowDialog();
                     ARCreditNote res = ap.ARCREDIT_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;
         ReceiptType type = (ReceiptType)Enum.Parse(typeof(ReceiptType), e.FormattedValue.ToString());
         if (type == ReceiptType.ARCreditNote)
         {
             itemsDataGrid[paymentAmountColumn.Index, e.RowIndex].ReadOnly = true;
             itemsDataGrid[docdateColumn.Index, e.RowIndex].ReadOnly       = true;
         }
     }
 }