public FrmCashInvoice(Invoice invoice)
        {
            InitializeComponent();
            EasyFormatter.SetFormater(this);

           

            // quan trọng
            UOW = invoice.Session as UnitOfWork;
            xpcCustomerList.Session = UOW;
            _invoice = invoice;
            _invoiceType = invoice.InvoiceType;
            this.Text = _invoiceType.InvoiceTypeName;
            if (_invoiceType.InvoiceTypeName == Constant.INVOICE_TYPE_THU)
            {
                labelControl2.Text = "Đối tượng nộp tiền";
            }
            else if (_invoiceType.InvoiceTypeName == Constant.INVOICE_TYPE_CHI)
            {
                labelControl2.Text = "Đối tượng nhận tiền";
            }

            DataBinding();
           
        }
Example #2
0
        public FrmInvoice(Invoice invoice)
        {
            InitializeComponent();
            EasyFormatter.SetFormater(this);


            // quan trọng
            _invoice = invoice;
            _invoiceType = invoice.InvoiceType;
            Text = _invoiceType.InvoiceTypeName;
            UOW = _invoice.Session as UnitOfWork;
            xpcItemList.Session = UOW;
            xpcCustomerList.Session = UOW;

            if (_invoiceType.InvoiceTypeName == Constant.INVOICE_TYPE_NHAPHANG
                || _invoiceType.InvoiceTypeName == Constant.INVOICE_TYPE_XUATHANG
                || _invoiceType.InvoiceTypeName == Constant.INVOICE_TYPE_MUAHANG)
            {
                xpcItemList.Criteria = CriteriaOperator.Parse("IsInventory = ?", true);
            }

            if (_invoiceType.InvoiceTypeName == Constant.INVOICE_TYPE_NHAPHANG)
            {
                lcItemPercentDiscount.Visibility
                    = lcItemDiscountAmount.Visibility
                        = lcItemPaidAmount.Visibility
                            = lcItemTotalMustPay.Visibility
                                = lcItemRemainAmount.Visibility
                                    = LayoutVisibility.Never;

                lcItemGridInvDetail.Height = 320;
            }


            DataBinding();
        }
 void SaveAndNew()
 {
     _invoice.Save();
     try
     {
         UOW.CommitChanges();
       
         _invoice = new Invoice(UOW, _invoiceType);
         DataBinding();
     }
     catch (Exception ex)
     {
         EasyDialog.ShowErrorDialog("Không lưu được. (" + ex.Message + ")");
     }
 }