コード例 #1
0
 protected override void Update()
 {
     using (
         var vatInvoiceRequestService =
             SvcClientManager.GetSvcClient<VATInvoiceRequestServiceClient>(SvcType.VATInvoiceRequestSvc))
     {
         var vtr = new VATInvoiceRequest
                       {
                           Id = ObjectId,
                           BPId = BPId,
                           InternalBPId = InternalBPId,
                           Comment = Comment,
                           RequestDate = RequestDate,
                       };
         vatInvoiceRequestService.UpdateDocument(CurrentUser.Id, vtr, AddVATInvoiceRequestLines,
                                                 UpdateVATInvoiceRequestLines, DeleteVATInvoiceRequestLines, QuotaList);
     }
 }
コード例 #2
0
     private void FixupVATInvoiceRequest(VATInvoiceRequest previousValue)
     {
         if (IsDeserializing)
         {
             return;
         }
 
         if (previousValue != null && previousValue.VATInvoiceRequestLines.Contains(this))
         {
             previousValue.VATInvoiceRequestLines.Remove(this);
         }
 
         if (VATInvoiceRequest != null)
         {
             if (!VATInvoiceRequest.VATInvoiceRequestLines.Contains(this))
             {
                 VATInvoiceRequest.VATInvoiceRequestLines.Add(this);
             }
 
             VATInvoiceRequestId = VATInvoiceRequest.Id;
         }
         if (ChangeTracker.ChangeTrackingEnabled)
         {
             if (ChangeTracker.OriginalValues.ContainsKey("VATInvoiceRequest")
                 && (ChangeTracker.OriginalValues["VATInvoiceRequest"] == VATInvoiceRequest))
             {
                 ChangeTracker.OriginalValues.Remove("VATInvoiceRequest");
             }
             else
             {
                 ChangeTracker.RecordOriginalValue("VATInvoiceRequest", previousValue);
             }
             if (VATInvoiceRequest != null && !VATInvoiceRequest.ChangeTracker.ChangeTrackingEnabled)
             {
                 VATInvoiceRequest.StartTracking();
             }
         }
     }
コード例 #3
0
 protected override void Create()
 {
     using (
         var vatInvoiceRequestService =
             SvcClientManager.GetSvcClient<VATInvoiceRequestServiceClient>(SvcType.VATInvoiceRequestSvc))
     {
         var invoiceRequest = new VATInvoiceRequest
                                  {
                                      BPId = BPId,
                                      InternalBPId = InternalBPId,
                                      Comment = Comment,
                                      RequestDate = RequestDate,
                                      IsDeleted = false,
                                      IsDraft = false,
                                  };
         vatInvoiceRequestService.CreateDocument(CurrentUser.Id, invoiceRequest, AddVATInvoiceRequestLines, QuotaList);
     }
 }
コード例 #4
0
        //存在的增值税申请 赋值增值税发票
        public void BindVATInvoiceVM(VATInvoiceRequest vatInvoiceRequset)
        {
            if (vatInvoiceRequset != null)
            {
                BPId = vatInvoiceRequset.BPId;
                InternalBPId = vatInvoiceRequset.InternalBPId;
                VATInvoiceRequestId = vatInvoiceRequset.Id;
                BusinessPartner bp;
                using (
                    var businessPartnerService =
                        SvcClientManager.GetSvcClient<BusinessPartnerServiceClient>(SvcType.BusinessPartnerSvc))
                {
                    bp = businessPartnerService.GetById(BPId);
                }
                if (bp != null)
                {
                    BPName = bp.ShortName;
                }

                VATRate vatRate;
                using (
                    var vatRateService =
                        SvcClientManager.GetSvcClient<VATRateServiceReference.VATRateServiceClient>(SvcType.VATRateSvc))
                {
                    //it.Type=2 为销项税
                    vatRate = vatRateService.Select("it.IsDeleted=false and it.Type=2 order by it.Created", null, null).FirstOrDefault();
                }


                var vatInvoiceLines = new List<VATInvoiceLine>();
                foreach (VATInvoiceRequestLine item in vatInvoiceRequset.VATInvoiceRequestLines)
                {
                    var line = new VATInvoiceLine();
                    int id = GetLineId();
                    line.Id = -id;
                    line.QuotaId = item.QuotaId;
                    line.VATInvoiceQuantity = item.RequestQuantity - item.VATInvoicedQuantity;
                    line.UnOpenedQuantity = item.RequestQuantity - item.VATInvoicedQuantity;
                    line.VATAmount = item.RequestAmount;
                    line.VATPrice = item.RequestPrice;
                    line.VATInvoiceRequestLineId = item.Id;
                    if (vatRate != null)
                    {
                        line.VATRateId = vatRate.Id;
                        line.VATRate = vatRate;
                    }
                    if (DetailVM == null)
                    {
                        DetailVM = new VATInvoiceLineDetailVM(VATInvoiceType);
                    }

                    using (var quotaService = SvcClientManager.GetSvcClient<QuotaServiceClient>(SvcType.QuotaSvc))
                    {
                        Quota qt = quotaService.GetById(item.QuotaId);
                        if (qt != null)
                        {
                            line.Quota = qt;
                            line.Quota.VATStatus = qt.VATStatus;
                        }
                    }
                    vatInvoiceLines.Add(line);
                    if (ShowVATInvoiceLines == null)
                    {
                        ShowVATInvoiceLines = new List<VATInvoiceLine>();
                    }
                    ShowVATInvoiceLines.Add(line);
                    if (AddVATInvoiceLines == null)
                    {
                        AddVATInvoiceLines = new List<VATInvoiceLine>();
                    }
                    AddVATInvoiceLines.Add(line);
                }
            }
        }