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();
           
        }
        public void SetInvoiceType(InvoiceType t)
        {
            _invoiceType = t;
            _invoiceType.XPCInvoices.DeleteObjectOnRemove = true;

            UOW = t.Session as UnitOfWork;
            Text = "Danh sách " + t.InvoiceTypeName.ToLower();
            grdInvoiceList.DataSource = _invoiceType.XPCInvoices;
        }
Exemple #3
0
        public Invoice(Session session, InvoiceType t) : base(session)
        {
            InvoiceType = t;

            // Place here your initialization code.
            if (IsNewObject)
            {
                InvoiceDate = DateTime.Today;
                if (InvoiceType == null) return;

                if (InvoiceType.InvoiceTypeName == Constant.INVOICE_TYPE_BANHANG)
                    VAT = 10; // mac dinh

                currentAutoID = InvoiceType.CurrentID;
                if (InvoiceType.XPCInvoices.Count == 0)
                    currentAutoID = 0;
                InvoiceCode = GetInvoiceCode();
            }
        }
        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();
        }
 public static void GenerateInvoiceType()
 {
     var t = new InvoiceType();
     t.InvoiceTypeName = Constant.INVOICE_TYPE_THU;
     t.FormatInvoiceCode = "T{0:ddMMyyyy}.{1:d3}";
     t.IsAutoID = true;
     t.Save();
     t = new InvoiceType
     {
         InvoiceTypeName = Constant.INVOICE_TYPE_CHI,
         FormatInvoiceCode = "C{0:ddMMyyyy}.{1:d3}",
         IsAutoID = true
     };
     t.Save();
     t = new InvoiceType
     {
         InvoiceTypeName = Constant.INVOICE_TYPE_NHAPHANG,
         FormatInvoiceCode = "N{0:ddMMyyyy}.{1:d3}",
         IsAutoID = true,
         BeginGroup = true
     };
     t.Save();
     t = new InvoiceType
     {
         InvoiceTypeName = Constant.INVOICE_TYPE_XUATHANG,
         FormatInvoiceCode = "X{0:ddMMyyyy}.{1:d3}",
         IsAutoID = true
     };
     t.Save();
     t = new InvoiceType
     {
         InvoiceTypeName = Constant.INVOICE_TYPE_BANHANG,
         FormatInvoiceCode = "B{0:ddMMyyyy}.{1:d3}",
         IsAutoID = true,
         BeginGroup = true
     };
     t.Save();
     t = new InvoiceType
     {
         InvoiceTypeName = Constant.INVOICE_TYPE_MUAHANG,
         FormatInvoiceCode = "M{0:ddMMyyyy}.{1:d3}",
         IsAutoID = true
     };
     t.Save();
 }