예제 #1
0
        private void BtnRefSo_Click(object sender, System.EventArgs e)
        {
            var frmNew = new Form_InvoiceNew();

            frmNew.requestDate = dtpInvoiceDate.Value;
            if (frmNew.ShowDialog() == DialogResult.OK)
            {
                var frm = new Form_InvoiceAddEdit
                {
                    orderNo = frmNew.orderNo
                };
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    LoadInvoice();
                }
            }
        }
예제 #2
0
        private void Gv_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                DataGridView senderGrid = (DataGridView)sender;
                string       invoiceNo  = gv.Rows[e.RowIndex].Cells[ConstColumns.INVOICE_NO].Value.ToString();
                string       orderNo    = gv.Rows[e.RowIndex].Cells[ConstColumns.REF_DOCUMENT_NO].Value.ToString();
                if (senderGrid.Columns[e.ColumnIndex] is DataGridViewImageColumn && e.RowIndex >= 0)
                {
                    switch (senderGrid.Columns[e.ColumnIndex].Name)
                    {
                    case "Edit":
                        var frm = new Form_InvoiceAddEdit
                        {
                            invoiceNo = invoiceNo
                        };
                        if (frm.ShowDialog() == DialogResult.OK)
                        {
                            LoadInvoice();
                        }
                        break;

                    case "Print":
                        var frmPrint = new Form_InvoiceReport
                        {
                            invoiceNo = invoiceNo,
                            orderNo   = orderNo
                        };
                        frmPrint.ShowDialog();
                        //if (frmPrint.ShowDialog() == DialogResult.OK)
                        //{
                        //    LoadInvoice();
                        //}
                        break;
                    }
                }
                if (senderGrid.Columns[e.ColumnIndex] is DataGridViewLinkColumn)
                {
                    LoadItem(invoiceNo);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #3
0
        private void Gv_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                DataGridView senderGrid = (DataGridView)sender;
                string       orderNo    = gv.Rows[e.RowIndex].Cells[ConstColumns.ORDER_NO].Value.ToString();


                if ((senderGrid.Columns[e.ColumnIndex] is DataGridViewImageColumn || senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn) && e.RowIndex >= 0)
                {
                    switch (senderGrid.Columns[e.ColumnIndex].Name)
                    {
                    case "Edit":
                        var frm = new Form_OrderAddEdit
                        {
                            orderNo = orderNo
                        };
                        if (frm.ShowDialog() == DialogResult.OK)
                        {
                            LoadOrder();
                        }
                        break;

                    case "Print":
                        break;

                    case ConstColumns.BTN_INVOICE:
                        string invocieFlag = gv.Rows[e.RowIndex].Cells[ConstColumns.INVOICE_FLAG].Value.ToString();
                        if (invocieFlag == "1")
                        {
                            return;
                        }
                        bool pickingCompleteFlag = OrderItemController.CheckPickingComplete(orderNo);
                        if (pickingCompleteFlag == false)
                        {
                            DialogResult result = MessageBox.Show("จำนวนสินยังไม่ครบตามใบสั่งขาย ท่านยังต้องขายใช่ไหม", "Warning ", MessageBoxButtons.YesNo);
                            if (result == DialogResult.Yes)
                            {
                                var frmInv = new Form_InvoiceAddEdit
                                {
                                    orderNo = orderNo
                                };
                                if (frmInv.ShowDialog() == DialogResult.OK)
                                {
                                    LoadOrder();
                                }
                            }
                            else
                            {
                                LoadItem(orderNo);
                                return;
                            }
                        }
                        else
                        {
                            var frmInv = new Form_InvoiceAddEdit
                            {
                                orderNo = orderNo
                            };
                            if (frmInv.ShowDialog() == DialogResult.OK)
                            {
                                LoadOrder();
                            }
                        }
                        break;

                    case ConstColumns.BTN_PRODUCT_SLIP:
                        var frmSlip = new Form_ProductSlip
                        {
                            orderNo = orderNo,
                        };
                        if (frmSlip.ShowDialog() == DialogResult.OK)
                        {
                            LoadOrder();
                        }
                        break;
                    }
                }
                if (senderGrid.Columns[e.ColumnIndex] is DataGridViewLinkColumn)
                {
                    LoadItem(orderNo);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }