コード例 #1
0
        protected fmCAVTInvoiceBase AVTInvoiceCheck()
        {
            crmCParty supl = null;

            if (crmUserParty.CurrentUserParty != null)
            {
                if (crmUserParty.CurrentUserParty.Value != null)
                {
                    supl = (crmCParty)crmUserParty.CurrentUserPartyGet(this.Session).Party;
                }
            }
            fmCAVTInvoiceBase invoice = Session.FindObject <fmCAVTInvoiceBase>(
                CriteriaOperator.And(
                    new BinaryOperator("Number", AVTInvoiceNumber),
                    new BinaryOperator("Date", AVTInvoiceDate),
                    new BinaryOperator("Supplier", supl)
                    ));

            return(invoice);
        }
コード例 #2
0
 public void СчетФактураУст(fmCAVTInvoiceBase value)
 {
     SetPropertyValue <fmCAVTInvoiceBase>("СчетФактура", ref _СчетФактура, value);
 }
コード例 #3
0
 public void Approve()
 {
     //            if (IsApproved) return;
     if (SaleJurnalNumber == 0)
     {
         if (AVTInvoiceType.AutoNumber)
         {
             SaleJurnalNumber = fmCAVTInvoiceNumberGenerator.GenerateNumber(this.Session, this.Oid, this.AVTInvoiceType, this.AVTInvoiceDate, 0);
             AVTInvoiceNumber = AVTInvoiceType.Prefix + AVTInvoiceDate.ToString("yyyyMMdd").Substring(4, 2) + SaleJurnalNumber.ToString("00000");
         }
         else
         {
             if (AVTInvoiceNumber == null)
             {
                 return;
             }
             if (AVTInvoiceNumber.Substring(0, 1) != "4")
             {
                 if (AVTInvoiceNumber.Length != 8)
                 {
                     return;
                 }
                 if (AVTInvoiceNumber.Substring(0, this.AVTInvoiceType.Prefix.Length) != this.AVTInvoiceType.Prefix)
                 {
                     return;
                 }
                 if (AVTInvoiceNumber.Substring(1, 2) != this.AVTInvoiceDate.ToString("yyyyMMdd").Substring(4, 2))
                 {
                     return;
                 }
                 Int32 num = 0;
                 if (Int32.TryParse(AVTInvoiceNumber.Substring(3, 5), out num))
                 {
                     if (num < 1)
                     {
                         return;
                     }
                     SaleJurnalNumber = num;
                     fmCAVTInvoiceNumberGenerator.GenerateNumber(this.Session, this.Oid, this.AVTInvoiceType, this.AVTInvoiceDate, this.SaleJurnalNumber);
                 }
             }
             else
             {
                 if (AVTInvoiceNumber.Substring(0, this.AVTInvoiceType.Prefix.Length) != this.AVTInvoiceType.Prefix)
                 {
                     return;
                 }
                 if (AVTInvoiceNumber.Substring(2, 2) != this.AVTInvoiceDate.ToString("yyyyMMdd").Substring(4, 2))
                 {
                     return;
                 }
                 Int32 num = 0;
                 if (Int32.TryParse(AVTInvoiceNumber.Substring(5, 5), out num))
                 {
                     if (num < 1)
                     {
                         return;
                     }
                     SaleJurnalNumber = num;
                     fmCAVTInvoiceNumberGenerator.GenerateNumber(this.Session, this.Oid, this.AVTInvoiceType, this.AVTInvoiceDate, this.SaleJurnalNumber);
                 }
             }
         }
     }
     if (!this.SaleOperation.IsNotAVTInvoice && AVTInvoice == null)
     {
         AVTInvoice = AVTInvoiceCheck();
         if (AVTInvoice == null)
         {
             fmCAVTInvoiceBase invoice = new fmCAVTInvoiceBase(this.Session);
             invoice.InvoiceType = this.AVTInvoiceType;
             invoice.Date        = this.AVTInvoiceDate;
             invoice.IntNumber   = SaleJurnalNumber;
             invoice.Number      = this.AVTInvoiceNumber;
             if (crmUserParty.CurrentUserPartyGet(this.Session) != null)
             {
                 invoice.Supplier = crmUserParty.CurrentUserPartyGet(this.Session).Party;
             }
             invoice.UseCounter++;
             invoice.IsApproved = true;
             this.AVTInvoice    = invoice;
         }
     }
     if (AVTInvoice != null)
     {
         this.AVTInvoice.Customer = this.Party;
         this.AVTInvoice.Valuta   = this.Valuta;
         this.AVTInvoice.SummCost = this.SummCost;
         this.AVTInvoice.SummAVT  = this.SummAVT;
     }
     this.DocBuhNumber = this.SaleJurnalNumber;
     this.DocBuhDate   = this.AVTInvoiceDate;
     if (SaleJurnalLine == null)
     {
         SaleJurnalLine = new fmCFJSaleJurnalLine(this.Session);
     }
     SaleJurnalLine.JurnalLineType   = fmJurnalLineType.WorkLine;
     SaleJurnalLine.SaleOperation    = this.SaleOperation;
     SaleJurnalLine.IntNumber        = this.SaleJurnalNumber;
     SaleJurnalLine.Party            = this.Party;
     SaleJurnalLine.AVTInvoiceType   = this.AVTInvoiceType;
     SaleJurnalLine.AVTInvoiceNumber = this.AVTInvoiceNumber;
     SaleJurnalLine.AVTInvoiceDate   = this.AVTInvoiceDate;
     SaleJurnalLine.AVTInvoice       = this.AVTInvoice;
     SaleJurnalLine.Deal             = this.Deal;
     SaleJurnalLine.Order            = this.Order;
     SaleJurnalLine.SummCost         = this.SummCost;
     SaleJurnalLine.AVTRate          = this.AVTRate;
     SaleJurnalLine.SummAVT          = this.SummAVT;
     SaleJurnalLine.Valuta           = this.Valuta;
     SaleJurnalLine.SummValuta       = this.SummValuta;
     //
     SaleJurnalLine.DocBuhProv    = this.DocBuhProv;
     SaleJurnalLine.DocBuhPck     = this.DocBuhPck;
     SaleJurnalLine.DocBuhNumber  = this.DocBuhNumber;
     SaleJurnalLine.DocBuhDate    = this.DocBuhDate;
     SaleJurnalLine.AccRealDebet  = this.AccRealDebet;
     SaleJurnalLine.AccRealCredit = this.AccRealCredit;
     SaleJurnalLine.AccAVTDebet   = this.AccAVTDebet;
     SaleJurnalLine.AccAVTCredit  = this.AccAVTCredit;
     //
     UseCounter = 1;
     IsApproved = true;
 }