Beispiel #1
0
        private void LoadData()
        {
            txtOrderNo.Text = this.orderNo;
            if (String.IsNullOrEmpty(this.invoiceNo))
            {
                Order order = OrderController.GetOrder(this.orderNo);
                if (order != null)
                {
                    txtInvoiceNo.Text         = "";
                    dtpInvoiceDate.Value      = order.RequestDate;
                    cboCustomer.SelectedValue = order.Customer.CustomerCode;
                    //customerCode = order.Customer.CustomerCode;
                    txtComment.Text         = "";
                    chkActive.Checked       = order.Active;
                    cboTrucko.SelectedValue = TruckController.GetTruckNoFromTransport(this.orderNo);

                    //dtpInvoiceDate.Enabled = true;
                }
                BtnCancel.Visible = false;
            }
            else
            {
                Invoice invoice = InvoiceController.GetInvoice(this.invoiceNo);
                if (invoice != null)
                {
                    txtInvoiceNo.Text         = invoice.InvoiceNo;
                    dtpInvoiceDate.Value      = invoice.InvoiceDate;
                    txtOrderNo.Text           = invoice.RefDocumentNo;
                    txtReceiptNo.Text         = invoice.ReceiptNo;
                    lbPrintNo.Text            = invoice.PrintNo.ToString();
                    cboCustomer.SelectedValue = invoice.Customer.CustomerCode;
                    cboTrucko.SelectedValue   = invoice.Truck.TruckId;
                    txtComment.Text           = invoice.Comments;
                    chkActive.Checked         = invoice.Active;
                    txtGrossAmt.Text          = invoice.GrossAmt.ToString();
                    txtDiscount.Text          = invoice.DiscAmtBill.ToString();
                    txtBeforeVat.Text         = (invoice.GrossAmt - invoice.DiscAmtBill).ToString();
                    txtVatAmt.Text            = invoice.VatAmt.ToString();
                    txtNetAmt.Text            = invoice.NetAmt.ToString();
                    if (invoice.VatRate > 0)
                    {
                        chkVatFlag.Checked = true;
                        txtVatRate.Text    = invoice.VatRate.ToString();
                    }
                    else
                    {
                        chkVatFlag.Checked = false;
                        txtVatRate.Text    = "";
                    }

                    chkActive.Enabled   = false;
                    BtnSave.Enabled     = false;
                    txtDiscount.Enabled = false;
                    chkVatFlag.Enabled  = false;
                    txtVatRate.Enabled  = false;
                    cboTrucko.Enabled   = false;
                    if (chkActive.Checked == false)
                    {
                        BtnCancel.Visible  = false;
                        txtComment.Enabled = false;
                    }
                }
            }
            SetFormatNumberTextbox();
            LoadDetail();
        }