API UpdateInvoice

Z Podpora.nextis.cz
Verze z 9. 11. 2018, 14:10, kterou vytvořil Chrzaszcz (diskuse | příspěvky)
(rozdíl) ← Starší verze | zobrazit aktuální verzi (rozdíl) | Novější verze → (rozdíl)
Přejít na: navigace, hledání

Description

Method allows You to update invoice in system.

Exact name

API_UpdateInvoice

Type

Standard executable stored procedure.

Specification

Parameter Data type Value range Description Relation
@ID int Internal system id
@ContactID int ID of customer from customer list (see relation) API_GetCustomers.ID
@OrdererID int ID of customer from customer list (see relation) API_GetCustomers.ID
@RecipientID int ID of customer from customer list (see relation) API_GetCustomers.ID
@StockID int ID of stock from stock list (see relation) API_GetStocks.ID
@BranchID int ID of branch from branch list (see relation) API_GetBranches.ID
@DocumentTypeID int Document type ID

1 - Invoice

14 - InvoiceProforma

16 - InvoiceForPoints

6 - Chit

8 - CreditNote

15 - DeliveryNote

@TransportID int ID of transport from transport list (see relation) API_GetTransports.ID
@PaymentTypeID int Payment type ID.

-1 - _NA

1 - Cash

2 - WireTransfer

3 - CreditCard

4 - Before

5 - Voucher

6 - CashOnDelivery

@PriceTypeID int Price type ID

0 - WithVAT

1 - WithoutVAT

2 - VATTransfer

@DocumentNumber nvarchar(40) Document number
@Date datetime Date
@TaxableSupplyDate datetime Taxable supply date
@DueDate datetime Due date
@VariableSymbol bigint Variable symbol
@BasicPrice decimal(18,6) Basic price
@BasicPriceInCurrency decimal(18,6) Basic price in currency
@VATPrice decimal(18,6) VAT price
@VATPriceInCurrency decimal(18,6) VAT price in currency
@TotalPrice decimal(18,6) Total price
@TotalPriceInCurrency decimal(18,6) Total price in currency
@RoundPrice decimal(18,4) Round price
@RoundPriceInCurrency decimal(18,4) Round price in currency
@Price decimal(19,6) Price
@PriceInCurrency decimal(19,6) Price in currency
@Currency nvarchar(5) Currency
@CurrencyID int ID of currency from currency list (see relation) API_GetCurrency.ID
@CurrencyIDInCurrency int ID of currency from currency list (see relation) API_GetCurrency.ID
@ExchangeRate decimal(19,4) Exchange rate
@ExchangeRate2 decimal(18,4) Exchange rate 2
@AccountingExchangeRate decimal(18,6) Accounting exchange rate
@VATExchangeRate decimal(18,4) VAT exchange rate
@AccountingExchangeRate2 decimal(18,6) Accounting exchange rate 2
@RoundStyle int Round style.

-1 - not selected,

0 - round off,

-1000 - 0,0001,

-100 - 0,001

1 - 0,01

3 - 1

4 - 10

5 - 100

6 - 1000

@RoundType int Round type

-1 - not selected,

1 - Up,

2 - Down,

3 - Mathematical

@SupplierName nvarchar(140) Supplier name
@SupplierStreet nvarchar(100) Supplier street
@SupplierCity nvarchar(140) Supplier city
@SupplierZIPCode nvarchar(10) Supplier ZIP code
@SupplierCountry nvarchar(50) Supplier country
@SupplierRegion nvarchar(30) Supplier region
@SupplierState nvarchar(50) Supplier state
@SupplierCompanyRegistrationNumber nvarchar(20) Supplier company registration number
@SupplierVATNumber2 nvarchar(20) Supplier VAT number 2
@SupplierVATNumber nvarchar(20) Supplier VAT number
@SupplierPhone nvarchar(30) Supplier phone
@SupplierFax nvarchar(30) Supplier fax
@SupplierMobilePhone nvarchar(30) Supplier mobile phone
@SupplierEmail nvarchar(60) Supplier email
@SupplierWeb nvarchar(50) Supplier web
@SupplierBankName nvarchar(120) Supplier bank name
@SupplierBankAccount nvarchar(50) Supplier bank account
@SupplierBankSwift nvarchar(50) Supplier bank swift
@OrdererName nvarchar(140) Orderer name
@OrdererStreet nvarchar(100) Orderer street
@OrdererCity nvarchar(140) Orderer city
@OrdererZIPCode nvarchar(10) Orderer ZIP code
@OrdererCountry nvarchar(50) Orderer country
@OrdererRegion nvarchar(30) Orderer region
@OrdererState nvarchar(50) Orderer state
@OrdererCompanyRegistrationNumber nvarchar(20) Orderer company registration number
@OrdererVATNumber2 nvarchar(20) Orderer VAT number 2
@OrdererVATNumber nvarchar(20) Orderer VAT number
@OrdererPhone nvarchar(30) Orderer phone
@OrdererFax nvarchar(30) Orderer fax
@OrdererMobilePhone nvarchar(30) Orderer mobile phone
@OrdererEmail nvarchar(60) Orderer email
@OrdererWeb nvarchar(50) Orderer web
@OrdererBankName nvarchar(120) Orderer bank name
@OrdererBankAccount nvarchar(50) Orderer bank account
@RecipientName nvarchar(120) Recipient name
@RecipientStreet nvarchar(100) Recipient street
@RecipientCity nvarchar(140) Recipient city
@RecipientZIPCode nvarchar(10) Recipient ZIP code
@RecipientCountry nvarchar(50) Recipient country
@RecipientRegion nvarchar(30) Recipient region
@RecipientState nvarchar(50) Recipient state
@RecipientCompanyRegistrationNumber nvarchar(20) Recipient company registration number
@RecipientVATNumber nvarchar(20) Recipient VAT number
@RecipientPhone nvarchar(30) Recipient phone
@RecipientFax nvarchar(30) Recipient fax
@RecipientMobilePhone nvarchar(30) Recipient mobile phone
@RecipientEmail nvarchar(60) Recipient email
@RecipientWeb nvarchar(50) Recipient web
@RecipientBankName nvarchar(120) Recipient bank name
@RecipientBankAccount nvarchar(50) Recipient bank account
@IsCanceled int Is canceled
@CancelationReason nvarchar(100) Cancelation reason
@CancelationDate datetime Cancelation date
@IsForeign int Is foreign
@FinancialYear int Financial year
@FinancialMonth int Financial month
@Note nvarchar(500) Note
@Note2 nvarchar(120) Note 2
@IsPrintedOnFiscal int Is printed on fiscal
@FiskalComputerName nvarchar(255) Fiskal computer name
@IsPrinted int Is printed
@CancelDocument int Cancel document
@CancelDocumentOriginID int ID of invoice from invoice list (see relation) API_GetInvoices.ID
@FiskalPrintDate date Fiskal print date
@FiskalPrintOrder int Fiskal print order
@Basis0 numeric(18,4) Basis 0
@BasisInCurrency0 numeric(18,6) Basis in currency 0
@Tax0 numeric(18,4) Tax 0
@TaxInCurrency0 numeric(18,6) Tax in currency 0
@VATRateID0 int ID of VAT rates from VAT rates list (see relation) API_GetVATRates.ID
@Basis1 numeric(18,4) Basis 1
@BasisInCurrency1 numeric(18,6) Basis in currency 1
@Tax1 numeric(18,4) Tax 1
@TaxInCurrency1 numeric(18,6) Tax in currency 1
@VATRateID1 int ID of VAT rates from VAT rates list (see relation) API_GetVATRates.ID
@Basis2 numeric(18,4) Basis 2
@BasisInCurrency2 numeric(18,6) Basis in currency 2
@Tax2 numeric(18,4) Tax 2
@TaxInCurrency2 numeric(18,6) Tax in currency 2
@VATRateID2 int ID of VAT rates from VAT rates list (see relation) API_GetVATRates.ID

Return

0 : OK
100 : Item could not be updated

Example

 DECLARE @return_value int
 DECLARE @ID int 
 DECLARE @ContactID int 
 DECLARE @OrdererID int 
 DECLARE @RecipientID int 
 DECLARE @StockID int 
 DECLARE @BranchID int 
 DECLARE @DocumentTypeID int 
 DECLARE @TransportID int 
 DECLARE @PaymentTypeID int 
 DECLARE @PriceTypeID int 
 DECLARE @DocumentNumber nvarchar(40) 
 DECLARE @Date datetime 
 DECLARE @TaxableSupplyDate datetime 
 DECLARE @DueDate datetime 
 DECLARE @VariableSymbol bigint 
 DECLARE @BasicPrice decimal(18,6) 
 DECLARE @BasicPriceInCurrency decimal(18,6) 
 DECLARE @VATPrice decimal(18,6) 
 DECLARE @VATPriceInCurrency decimal(18,6) 
 DECLARE @TotalPrice decimal(18,6) 
 DECLARE @TotalPriceInCurrency decimal(18,6) 
 DECLARE @RoundPrice decimal(18,4) 
 DECLARE @RoundPriceInCurrency decimal(18,4) 
 DECLARE @Price decimal(19,6) 
 DECLARE @PriceInCurrency decimal(19,6) 
 DECLARE @Currency nvarchar(5) 
 DECLARE @CurrencyID int 
 DECLARE @CurrencyIDInCurrency int 
 DECLARE @ExchangeRate decimal(19,4) 
 DECLARE @ExchangeRate2 decimal(18,4) 
 DECLARE @AccountingExchangeRate decimal(18,6) 
 DECLARE @VATExchangeRate decimal(18,4) 
 DECLARE @AccountingExchangeRate2 decimal(18,6) 
 DECLARE @RoundStyle int 
 DECLARE @RoundType int 
 DECLARE @SupplierName nvarchar(140) 
 DECLARE @SupplierStreet nvarchar(100) 
 DECLARE @SupplierCity nvarchar(140) 
 DECLARE @SupplierZIPCode nvarchar(10) 
 DECLARE @SupplierCountry nvarchar(50) 
 DECLARE @SupplierRegion nvarchar(30) 
 DECLARE @SupplierState nvarchar(50) 
 DECLARE @SupplierCompanyRegistrationNumber nvarchar(20) 
 DECLARE @SupplierVATNumber2 nvarchar(20) 
 DECLARE @SupplierVATNumber nvarchar(20) 
 DECLARE @SupplierPhone nvarchar(30) 
 DECLARE @SupplierFax nvarchar(30) 
 DECLARE @SupplierMobilePhone nvarchar(30) 
 DECLARE @SupplierEmail nvarchar(60) 
 DECLARE @SupplierWeb nvarchar(50) 
 DECLARE @SupplierBankName nvarchar(120) 
 DECLARE @SupplierBankAccount nvarchar(50) 
 DECLARE @SupplierBankSwift nvarchar(50) 
 DECLARE @OrdererName nvarchar(140) 
 DECLARE @OrdererStreet nvarchar(100) 
 DECLARE @OrdererCity nvarchar(140) 
 DECLARE @OrdererZIPCode nvarchar(10) 
 DECLARE @OrdererCountry nvarchar(50) 
 DECLARE @OrdererRegion nvarchar(30) 
 DECLARE @OrdererState nvarchar(50) 
 DECLARE @OrdererCompanyRegistrationNumber nvarchar(20) 
 DECLARE @OrdererVATNumber2 nvarchar(20) 
 DECLARE @OrdererVATNumber nvarchar(20) 
 DECLARE @OrdererPhone nvarchar(30) 
 DECLARE @OrdererFax nvarchar(30) 
 DECLARE @OrdererMobilePhone nvarchar(30) 
 DECLARE @OrdererEmail nvarchar(60) 
 DECLARE @OrdererWeb nvarchar(50) 
 DECLARE @OrdererBankName nvarchar(120) 
 DECLARE @OrdererBankAccount nvarchar(50) 
 DECLARE @RecipientName nvarchar(120) 
 DECLARE @RecipientStreet nvarchar(100) 
 DECLARE @RecipientCity nvarchar(140) 
 DECLARE @RecipientZIPCode nvarchar(10) 
 DECLARE @RecipientCountry nvarchar(50) 
 DECLARE @RecipientRegion nvarchar(30) 
 DECLARE @RecipientState nvarchar(50) 
 DECLARE @RecipientCompanyRegistrationNumber nvarchar(20) 
 DECLARE @RecipientVATNumber nvarchar(20) 
 DECLARE @RecipientPhone nvarchar(30) 
 DECLARE @RecipientFax nvarchar(30) 
 DECLARE @RecipientMobilePhone nvarchar(30) 
 DECLARE @RecipientEmail nvarchar(60) 
 DECLARE @RecipientWeb nvarchar(50) 
 DECLARE @RecipientBankName nvarchar(120) 
 DECLARE @RecipientBankAccount nvarchar(50) 
 DECLARE @IsCanceled int 
 DECLARE @CancelationReason nvarchar(100) 
 DECLARE @CancelationDate datetime 
 DECLARE @IsForeign int 
 DECLARE @FinancialYear int 
 DECLARE @FinancialMonth int 
 DECLARE @Note nvarchar(500) 
 DECLARE @Note2 nvarchar(120) 
 DECLARE @IsPrintedOnFiscal int 
 DECLARE @FiskalComputerName nvarchar(255) 
 DECLARE @IsPrinted int 
 DECLARE @CancelDocument int 
 DECLARE @CancelDocumentOriginID int 
 DECLARE @FiskalPrintDate date 
 DECLARE @FiskalPrintOrder int 

 DECLARE @Basis0 numeric(18,4)
 DECLARE @BasisInCurrency0 numeric(18,6)
 DECLARE @Tax0 numeric(18,4)
 DECLARE @TaxInCurrency0 numeric(18,6)
 DECLARE @VATRateID0 int
 DECLARE @Basis1 numeric(18,4)
 DECLARE @BasisInCurrency1 numeric(18,6)
 DECLARE @Tax1 numeric(18,4)
 DECLARE @TaxInCurrency1 numeric(18,6)
 DECLARE @VATRateID1 int
 DECLARE @Basis2 numeric(18,4)
 DECLARE @BasisInCurrency2 numeric(18,6)
 DECLARE @Tax2 numeric(18,4)
 DECLARE @TaxInCurrency2 numeric(18,6)
 DECLARE @VATRateID2 int

 set @VATRateID0 = -1
 set @VATRateID1 = 16028
 set @VATRateID2 = -1
 
 SELECT @ID = [ID], 
       @ContactID = [ContactID],
       @OrdererID = [OrdererID],
       @RecipientID = [RecipientID],
       @StockID = [StockID],
       @BranchID = [BranchID],
       @DocumentTypeID = [DocumentTypeID],
       @TransportID = [TransportID],
       @PaymentTypeID = [PaymentTypeID],
       @PriceTypeID = [PriceTypeID],
       @DocumentNumber = [DocumentNumber],
       @Date = [Date],
       @TaxableSupplyDate = [TaxableSupplyDate],
       @DueDate = [DueDate],
       @VariableSymbol = '123654897',
       @BasicPrice = [BasicPrice],
       @BasicPriceInCurrency = [BasicPriceInCurrency],
       @VATPrice = [VATPrice],
       @VATPriceInCurrency = [VATPriceInCurrency],
       @TotalPrice = [TotalPrice],
       @TotalPriceInCurrency = [TotalPriceInCurrency],
       @RoundPrice = [RoundPrice],
       @RoundPriceInCurrency = [RoundPriceInCurrency],
       @Price = [Price],
       @PriceInCurrency = [PriceInCurrency],
       @Currency = [Currency],
       @CurrencyID = [CurrencyID],
       @CurrencyIDInCurrency = [CurrencyIDInCurrency],
       @ExchangeRate = [ExchangeRate],
       @ExchangeRate2 = [ExchangeRate2],
       @AccountingExchangeRate = [AccountingExchangeRate],
       @VATExchangeRate = [VATExchangeRate],
       @AccountingExchangeRate2 = [AccountingExchangeRate2],
       @RoundStyle = [RoundStyle],
       @RoundType = [RoundType],
       @SupplierName = [SupplierName],
       @SupplierStreet = [SupplierStreet],
       @SupplierCity = [SupplierCity],
       @SupplierZIPCode = [SupplierZIPCode],
       @SupplierCountry = [SupplierCountry],
       @SupplierRegion = [SupplierRegion],
       @SupplierState = [SupplierState],
       @SupplierCompanyRegistrationNumber = [SupplierCompanyRegistrationNumber],
       @SupplierVATNumber2 = [SupplierVATNumber2],
       @SupplierVATNumber = [SupplierVATNumber],
       @SupplierPhone = [SupplierPhone],
       @SupplierFax = [SupplierFax],
       @SupplierMobilePhone = [SupplierMobilePhone],
       @SupplierEmail = [SupplierEmail],
       @SupplierWeb = [SupplierWeb],
       @SupplierBankName = [SupplierBankName],
       @SupplierBankAccount = [SupplierBankAccount],
       @SupplierBankSwift = [SupplierBankSwift],
       @OrdererName = [OrdererName],
       @OrdererStreet = [OrdererStreet],
       @OrdererCity = [OrdererCity],
       @OrdererZIPCode = [OrdererZIPCode],
       @OrdererCountry = [OrdererCountry],
       @OrdererRegion = [OrdererRegion],
       @OrdererState = [OrdererState],
       @OrdererCompanyRegistrationNumber = [OrdererCompanyRegistrationNumber],
       @OrdererVATNumber2 = [OrdererVATNumber2],
       @OrdererVATNumber = [OrdererVATNumber],
       @OrdererPhone = [OrdererPhone],
       @OrdererFax = [OrdererFax],
       @OrdererMobilePhone = [OrdererMobilePhone],
       @OrdererEmail = [OrdererEmail],
       @OrdererWeb = [OrdererWeb],
       @OrdererBankName = [OrdererBankName],
       @OrdererBankAccount = [OrdererBankAccount],
       @RecipientName = [RecipientName],
       @RecipientStreet = [RecipientStreet],
       @RecipientCity = [RecipientCity],
       @RecipientZIPCode = [RecipientZIPCode],
       @RecipientCountry = [RecipientCountry],
       @RecipientRegion = [RecipientRegion],
       @RecipientState = [RecipientState],
       @RecipientCompanyRegistrationNumber = [RecipientCompanyRegistrationNumber],
       @RecipientVATNumber = [RecipientVATNumber],
       @RecipientPhone = [RecipientPhone],
       @RecipientFax = [RecipientFax],
       @RecipientMobilePhone = [RecipientMobilePhone],
       @RecipientEmail = [RecipientEmail],
       @RecipientWeb = [RecipientWeb],
       @RecipientBankName = [RecipientBankName],
       @RecipientBankAccount = [RecipientBankAccount],
       @IsCanceled = [IsCanceled],
       @CancelationReason = [CancelationReason],
       @CancelationDate = [CancelationDate],
       @IsForeign = [IsForeign],
       @FinancialYear = [FinancialYear],
       @FinancialMonth = [FinancialMonth],
       @Note = [Note],
       @Note2 = [Note2],
       @IsPrintedOnFiscal = [IsPrintedOnFiscal],
       @FiskalComputerName = [FiskalComputerName],
       @IsPrinted = [IsPrinted],
       @CancelDocument = [CancelDocument],
       @CancelDocumentOriginID = [CancelDocumentOriginID],
       @FiskalPrintDate = [FiskalPrintDate],
       @FiskalPrintOrder = [FiskalPrintOrder]
 FROM   [API_GetInvoices] 
 WHERE  id = 8


SELECT @Basis0 = [basis], 
       @BasisInCurrency0 = [basisincurrency], 
       @Tax0 = [tax], 
       @TaxInCurrency0 = [taxincurrency] 
FROM   [API_GetDocumentVAT] 
WHERE  [documentid] = @ID 
       AND [rate] = (SELECT [value] 
                     FROM   [API_GetVATRates] 
                     WHERE  id = @VATRateID0) 
       AND isrounding = 0 


SELECT @Basis1 = [basis], 
       @BasisInCurrency1 = [basisincurrency], 
       @Tax1 = [tax], 
       @TaxInCurrency1 = [taxincurrency] 
FROM   [API_GetDocumentVAT] 
WHERE  [documentid] = @ID 
       AND [rate] = (SELECT [value] 
                     FROM   [API_GetVATRates] 
                     WHERE  id = @VATRateID1) 
       AND isrounding = 0 


SELECT @Basis2 = [basis], 
       @BasisInCurrency2 = [basisincurrency], 
       @Tax2 = [tax], 
       @TaxInCurrency2 = [taxincurrency] 
FROM   [API_GetDocumentVAT] 
WHERE  [documentid] = @ID 
       AND [rate] = (SELECT [value] 
                     FROM   [API_GetVATRates] 
                     WHERE  id = @VATRateID2) 
       AND isrounding = 0 


 
 EXECUTE @return_value = [API_UpdateInvoice] 
  @ID,
  @ContactID,
  @OrdererID,
  @RecipientID,
  @StockID,
  @BranchID,
  @DocumentTypeID,
  @TransportID,
  @PaymentTypeID,
  @PriceTypeID,
  @DocumentNumber,
  @Date,
  @TaxableSupplyDate,
  @DueDate,
  @VariableSymbol,
  @BasicPrice,
  @BasicPriceInCurrency,
  @VATPrice,
  @VATPriceInCurrency,
  @TotalPrice,
  @TotalPriceInCurrency,
  @RoundPrice,
  @RoundPriceInCurrency,
  @Price,
  @PriceInCurrency,
  @Currency,
  @CurrencyID,
  @CurrencyIDInCurrency,
  @ExchangeRate,
  @ExchangeRate2,
  @AccountingExchangeRate,
  @VATExchangeRate,
  @AccountingExchangeRate2,
  @RoundStyle,
  @RoundType,
  @SupplierName,
  @SupplierStreet,
  @SupplierCity,
  @SupplierZIPCode,
  @SupplierCountry,
  @SupplierRegion,
  @SupplierState,
  @SupplierCompanyRegistrationNumber,
  @SupplierVATNumber2,
  @SupplierVATNumber,
  @SupplierPhone,
  @SupplierFax,
  @SupplierMobilePhone,
  @SupplierEmail,
  @SupplierWeb,
  @SupplierBankName,
  @SupplierBankAccount,
  @SupplierBankSwift,
  @OrdererName,
  @OrdererStreet,
  @OrdererCity,
  @OrdererZIPCode,
  @OrdererCountry,
  @OrdererRegion,
  @OrdererState,
  @OrdererCompanyRegistrationNumber,
  @OrdererVATNumber2,
  @OrdererVATNumber,
  @OrdererPhone,
  @OrdererFax,
  @OrdererMobilePhone,
  @OrdererEmail,
  @OrdererWeb,
  @OrdererBankName,
  @OrdererBankAccount,
  @RecipientName,
  @RecipientStreet,
  @RecipientCity,
  @RecipientZIPCode,
  @RecipientCountry,
  @RecipientRegion,
  @RecipientState,
  @RecipientCompanyRegistrationNumber,
  @RecipientVATNumber,
  @RecipientPhone,
  @RecipientFax,
  @RecipientMobilePhone,
  @RecipientEmail,
  @RecipientWeb,
  @RecipientBankName,
  @RecipientBankAccount,
  @IsCanceled,
  @CancelationReason,
  @CancelationDate,
  @IsForeign,
  @FinancialYear,
  @FinancialMonth,
  @Note,
  @Note2,
  @IsPrintedOnFiscal,
  @FiskalComputerName,
  @IsPrinted,
  @CancelDocument,
  @CancelDocumentOriginID,
  @FiskalPrintDate,
  @FiskalPrintOrder,
  @Basis0,
  @BasisInCurrency0,
  @Tax0,
  @TaxInCurrency0,
  @VATRateID0,
  @Basis1,
  @BasisInCurrency1,
  @Tax1,
  @TaxInCurrency1,
  @VATRateID1,
  @Basis2,
  @BasisInCurrency2,
  @Tax2,
  @TaxInCurrency2,
  @VATRateID2

Notices

None.