Пример #1
0
        public NAS.DAL.Invoice.PurchaseInvoice PurchaseInvoiceInit(Session session,
                                                                   Guid BillId,
                                                                   string PurchasingStatus,
                                                                   string Code,
                                                                   DateTime CreateDate,
                                                                   DateTime IssueDate,
                                                                   double SumOfItemPrice,
                                                                   double SumOfPromotion,
                                                                   double SumOfTax,
                                                                   double Total,
                                                                   short RowStatus,
                                                                   string SourceOrganizationId,
                                                                   string TargetOrganizationId,
                                                                   Guid BillTypeId
                                                                   )
        {
            NAS.DAL.Invoice.PurchaseInvoice purchaseInvoice = session.GetObjectByKey <NAS.DAL.Invoice.PurchaseInvoice>(BillId);

            if (purchaseInvoice == null)
            {
                purchaseInvoice = new DAL.Invoice.PurchaseInvoice(session);
            }

            purchaseInvoice.PurchasingStatus = PurchasingStatus;
            purchaseInvoice.BillId           = BillId;
            purchaseInvoice.Code             = Code;
            purchaseInvoice.CreateDate       = CreateDate;
            purchaseInvoice.IssuedDate       = IssueDate;
            purchaseInvoice.SumOfItemPrice   = SumOfItemPrice;
            purchaseInvoice.SumOfPromotion   = SumOfPromotion;
            purchaseInvoice.SumOfTax         = SumOfTax;
            purchaseInvoice.Total            = Total;
            purchaseInvoice.RowStatus        = RowStatus;

            CriteriaOperator filter      = new BinaryOperator("Code", SourceOrganizationId, BinaryOperatorType.Equal);
            Organization     supplierOrg = session.FindObject <Organization>(filter);

            if (supplierOrg != null)
            {
                purchaseInvoice.SourceOrganizationId = supplierOrg;
            }

            purchaseInvoice.SourceOrganizationId = supplierOrg;

            filter = new BinaryOperator("Code", TargetOrganizationId, BinaryOperatorType.Equal);
            Person person = session.FindObject <Person>(filter);

            if (person != null)
            {
                purchaseInvoice.TargetOrganizationId = person;
            }

            return(purchaseInvoice);
        }
Пример #2
0
 public override Bill InitTemporary(DevExpress.Xpo.Session session, BillTypeEnum billType)
 {
     try
     {
         NAS.DAL.Invoice.PurchaseInvoice ret = null;
         ret = new DAL.Invoice.PurchaseInvoice(session)
         {
             BillId                   = Guid.NewGuid(),
             RowStatus                = Utility.Constant.ROWSTATUS_TEMP,
             CreateDate               = DateTime.Now,
             IssuedDate               = DateTime.Now,
             TaxClaimStatus           = Utility.Constant.VAT_NO_DECLARE,
             TaxCalculationType       = Utility.Constant.CALCULATION_TYPE_ON_ITEMS,
             PromotionCalculationType = Utility.Constant.CALCULATION_TYPE_ON_ITEMS,
             BillType                 = (byte)billType
         };
         ret.Save();
         return(ret);
     }
     catch (Exception)
     {
         throw;
     }
 }