SWAPI – ARInvoiceQuery

This command is used to query invoices by InvoiceID or Gen2JobID.

Request

<SessionRequest Version="string" SessionID="{A1019B0B-AC80-4FAB-B452-8D2348739E98}" RequestID="string">

  <ARInvoiceQuery Filter="string" Max="string" OrderBy="string" StyleNo="string" StyleOptions="string">

    <InvoiceID>int</InvoiceID>

    <Gen2JobID>string</Gen2JobID>

  </ARInvoiceQuery>

</SessionRequest>

 

 

·         InvoiceID – The ID of the invoice.

·         Gen2JobID – The ID of Gen 2 job the invoice belongs to.

Response

<ARInvoiceQueryData RequestID="string">
  <ARInvoiceQueryRecord>
    <ExcessPayment>decimal</ExcessPayment>
    <TotalPaymentDue>decimal</TotalPaymentDue>
    <AssignmentID>integer</AssignmentID>
    <InvoiceID>integer</InvoiceID>
    <InvoiceNo>string(10)</InvoiceNo>
    <DiscountType>string(6)</DiscountType>
    <DiscountPct>short</DiscountPct>
    <DiscountAmount>float</DiscountAmount>
    <TotalAmount>float</TotalAmount>
    <TaxableAmount>float</TaxableAmount>
    <TaxCode>string(6)</TaxCode>
    <TaxPercent>float</TaxPercent>
    <TaxIncludedAmount>float</TaxIncludedAmount>
    <TaxIncluded>float</TaxIncluded>
    <TaxAmountDue>float</TaxAmountDue>
    <TaxAmount>float</TaxAmount>
    <SubTotalWarranty>float</SubTotalWarranty>
    <SubTotalAgreement>float</SubTotalAgreement>
    <SubTotal>float</SubTotal>
    <SubAfterDiscount>float</SubAfterDiscount>
    <NetBalance>float</NetBalance>
    <ManualTax>boolean</ManualTax>
    <LessAmount>float</LessAmount>
    <DepositAmount>float</DepositAmount>
    <PaymentAmount>float</PaymentAmount>
    <ModifiedBy>string(6)</ModifiedBy>
    <SigWorkAuth>bin.base64</SigWorkAuth>
    <SigWorkApp>bin.base64</SigWorkApp>
    <SigPayment>bin.base64</SigPayment>
    <HasInvoiceDiscount>boolean</HasInvoiceDiscount>
    <AutoDetail>integer</AutoDetail>
    <ReadyToPost>boolean</ReadyToPost>
    <Modified>dateTime</Modified>
    <Department>string(2)</Department>
    <InvoiceItemType>string(1)</InvoiceItemType>
    <Gen2JobID>string(20)</Gen2JobID>
    <Gen2LocationID>string(20)</Gen2LocationID>
    <LocationID>string(20)</LocationID>
    <dsItemList>
      <dsItem>
        <ReportedTime>time</ReportedTime>
        <InvoiceItemID>integer</InvoiceItemID>
        <InvoiceID>integer</InvoiceID>
        <SaleType>string(6)</SaleType>
        <Department>string(2)</Department>
        <ItemNumber>string(15)</ItemNumber>
        <ItemType>string(1)</ItemType>
        <ItemAsTask>boolean</ItemAsTask>
        <Description>string(100)</Description>
        <Quantity>float</Quantity>
        <PriceLevel>string(1)</PriceLevel>
        <UnitPrice>float</UnitPrice>
        <TotalSale>float</TotalSale>
        <IncludesTax>boolean</IncludesTax>
        <IsDiscountable>boolean</IsDiscountable>
        <AddTax>boolean</AddTax>
        <ChargeTo>string(1)</ChargeTo>
        <AgreementID>integer</AgreementID>
        <WarrantyID>integer</WarrantyID>
        <ReportedHours>float</ReportedHours>
        <IsDiagItem>boolean</IsDiagItem>
        <IsExtraItem>boolean</IsExtraItem>
        <PartSale>float</PartSale>
        <LaborSale>float</LaborSale>
        <MiscSale>float</MiscSale>
        <TaxIncludedDiscount>float</TaxIncludedDiscount>
        <TaxableDiscount>float</TaxableDiscount>
        <NonTaxableDiscount>float</NonTaxableDiscount>
        <DiscountAmount>float</DiscountAmount>
        <TotalAfterDiscount>float</TotalAfterDiscount>
        <dsInvoicedVisitList>
          <dsInvoicedVisit>
            <AgreementVisitID>integer</AgreementVisitID>
            <VisitType>string(6)</VisitType>
            <VisitPrice>float</VisitPrice>
            <InvoiceID>integer</InvoiceID>
            <InvoiceItemID>integer</InvoiceItemID>
          </dsInvoicedVisit>
        </dsInvoicedVisitList>
        <dsInvoicedAgreeList>
          <dsInvoicedAgree>
            <AgreementID>integer</AgreementID>
            <AgreementNumber>string(10)</AgreementNumber>
            <RenewedFromID>integer</RenewedFromID>
            <AgreementType>string(10)</AgreementType>
            <Years>short</Years>
            <StartDate>dateTime</StartDate>
            <TotalPrice>float</TotalPrice>
            <Deposit>float</Deposit>
            <InvoiceID>integer</InvoiceID>
            <BillStartDate>dateTime</BillStartDate>
            <PaymentMethod>string(15)</PaymentMethod>
            <PaymentType>string(15)</PaymentType>
            <XCAlias>string(25)</XCAlias>
            <CreditCardExpireMonth>short</CreditCardExpireMonth>
            <CreditCardExpireYear>short</CreditCardExpireYear>
            <CreditCardNumber>string(32)</CreditCardNumber>
            <CreditCardName>string(40)</CreditCardName>
            <dsAgreeEquipList>
              <dsAgreeEquip>
                <AgreementCoverageUnitID>integer</AgreementCoverageUnitID>
                <LocationUnitID>integer</LocationUnitID>
                <AgreementID>integer</AgreementID>
                <UnitType>string(6)</UnitType>
                <Location>string(20)</Location>
              </dsAgreeEquip>
            </dsAgreeEquipList>
          </dsInvoicedAgree>
        </dsInvoicedAgreeList>
        <dsDetailList>
          <dsDetail>
            <InvoiceItemDetailID>integer</InvoiceItemDetailID>
            <InvoiceItemID>integer</InvoiceItemID>
            <ItemNumber>string(15)</ItemNumber>
            <Description>string(100)</Description>
            <ItemType>string(1)</ItemType>
            <Quantity>float</Quantity>
            <SerialNumber>string(20)</SerialNumber>
            <Serialized>boolean</Serialized>
            <UnitCost>float</UnitCost>
            <TotalCost>float</TotalCost>
            <Markup>float</Markup>
            <UnitPrice>float</UnitPrice>
            <TotalPrice>float</TotalPrice>
            <UnitOfMeasure>string(4)</UnitOfMeasure>
          </dsDetail>
        </dsDetailList>
        <dsItemEquipList>
          <dsItemEquip>
            <InvoiceItemID>integer</InvoiceItemID>
            <LocationUnitID>integer</LocationUnitID>
            <InvoiceID>integer</InvoiceID>
            <UnitType>string(6)</UnitType>
            <Location>string(20)</Location>
          </dsItemEquip>
        </dsItemEquipList>
      </dsItem>
    </dsItemList>
    <dsInvMemoList>
      <dsInvMemo>
        <InvoiceID>integer</InvoiceID>
        <WorkSuggested>string</WorkSuggested>
      </dsInvMemo>
    </dsInvMemoList>
    <dsInvDepositList>
      <dsInvDeposit>
        <DepositReceivableID>integer</DepositReceivableID>
        <DepositBalAvailable>float</DepositBalAvailable>
        <DepositAmount>float</DepositAmount>
      </dsInvDeposit>
    </dsInvDepositList>
  </ARInvoiceQueryRecord>
</ARInvoiceQueryData>
 

 

·         ExcessPayment – Calculated: the amount paid in excess of the total invoice minus deposit amount.

·         TotalPaymentDue – Calculated: Total on the invoice after discount plus overpayment.

·         AssignmentID – The AssignmentID is used to look up the Call ID and associate with new line items added to the invoice.

·         InvoiceID - The unique identifier for the invoice.

·         InvoiceNo - User assigned invoice number, defaults to InvoiceID.  When overriding, it must start with a letter.  If overriding without a letter, 'A' will be  appended at the start.

·         DiscountType - Must be a valid discount type.  Will lookup and apply percent or flatrate discount as set on the discount type.  Takes precedence over DiscountPct and DiscountAmount.

·         DiscountPct - Allows manual application of a discount percent.  Take precedence over Discount Amount.

·         DiscountAmount - Allow manual application of discount amount.

·         TotalAmount - Calculated: Total equals SubTotal - Discount + Tax + Retainage(i.e. RetainBilled - RetainWithheld)

·         TaxableAmount - Calculated: sum(PartSale*Qty) + sum(LaborSale*Qty) + sum(MiscSale*Qty).

·         TaxCode - Must be a valid tax code, defaults to the locations tax code.  Looks up and applies the tax rules based on the code.

·         TaxPercent - Overrides the tax percentage normally used from the tax code table.  When specified, tax will be applied to parts sale, labor sale, and misc sale.

·         TaxIncludedAmount - Calculated: sum from line items (TaxIncludedAfterDiscount).

·         TaxAmount - Calculated: TaxAmount if ManualTax, or sum of taxable amounts * their percentages.

·         SubTotalWarranty - Calculated: sum({items where ChargeTo=W} amounts)  { charge to warranty }

·         SubTotalAgreement - Calculated: sum({items where ChargeTo=A} amounts) { charge to agreement }

·         SubTotal - Calculated: sum({items where ChargeTo=R} amounts)  { charge to receivables .

·         SubAfterDiscount - Calculated: sum({items where ChargeTo=R} total after discount) .

·         NetBalance - Calculated: Total - Less amount.

·         ManualTax - Calculated: Will be set to True if TaxPercent has a value.

·         LessAmount - Calculated: LessAmount equals Deposit + Payment + Credit.

·         DepositAmount - Calculated: from deposits below (see assumptions as well).

·         PaymentAmount - Changes NetBalance, blank does not change value to 0, other fields do.

·         ModifiedBy - Required: Set ModifiedBy value based on Employee code; Must be valid employee on job for the invoice day.

·         SigWorthAuth – Must be a valid signature.

·         SigWorkApp - Must be a valid signature.

·         SigPayment - Must be a valid signature.

·         HasInvoiceDiscount - Sets Has Invoice Discount

·         AutoDetail - Set to AutoPopulate Detail on New Items with no detail.

·         ReadyToPost - Set Ready To Post.

·         Modified - The current date/time, set by the system, not by the value in the xml command..

·         Department - Set the Department, validated against (RefLib-CustAcct-Departments).

·         InvoiceItemType - Q=QuickEntry, P=Cost Plus.

·         Gen2JobID - Required for Gen2: Gen 2 Job Id passed from Abacus, blank for mobile.

·         Gen2LocationID - Gen 2 Location Id passed from Abacus, blank for mobile.

·         LocationID – The unique identifier for the Location.

·         ReportedTime - Calculated: ReportedHours/24.

·         InvoiceItemID - Required for each item: Must be a valid invoice item id.

·         SaleType - (ref lib-accounting-sale types), value can override UnitPrice.

·         ItemNumber - (Must be a valid item number in the pricebook) sets the item number.

·         ItemType - Comes from IC_Item.ItemType [L(abor),M(isc),O(ther), P(art), T(ask) ] and join of Flatrate.

·         ItemAsTask – Set Item As Task.

·         Description - Sets the item(or part) description.

·         Quantity - Quantity of these items/parts on this line of the invoice.

·         PriceLevel - Price level of item; Values can be found in FlatratePrices table, Plevel column..

·         UnitPrice – Unit price of the item/detail item.

·         TotalSale - Calculated: Quantity * UnitPrice.

·         IncludesTax - Set IncludesTax only if it's not an invoice discount line item; whether item includes taxes.

·         IsDiscountable - Calculated: True if TaxDiscountAmount and/or NonTaxDiscountAmount is > 0; False otherwise

·         AddTax - Set Add Tax.

·         ChargeTo - Set where the invoice is to be charged to (A,W,R); enables/disables other fields.

·         AgreementID - Assigns only if ChargeTo=A.

·         WarrantyID - Assigns only if ChargeTo=W.

·         ReportedHours - Set Reported Hours of item.

·         IsDiagItem - Set Is Diag Item.

·         IsExtraItem - Set IsExtra Item.

·         PartSale - Calculated: sum({items where ChargeTo=R} item PartSale).

·         LaborSale - Calculated: sum({items where ChargeTo=R} item LaborSale).

·         MiscSale - Calculated: sum({items where ChargeTo=R} item MiscSale).

·         TaxIncludedDiscount - Calculated: sum(DiscountAmount or {SaleType not discountable;  DiscountPct*(PartSale+LaborSale+MiscSale)}) {IncludesTax flag as well}.

·         TaxableDiscount - Calculated: sum(DiscountAmount or {SaleType not discountable;  DiscountPct*(PartSale+LaborSale+MiscSale)}).

·         NonTaxableDiscount - Calculated: sum(DiscountAmount or {SaleType not discountable;  DiscountPct*(PartSale+LaborSale+MiscSale)}){AddTax flag as well}.

·         DiscountAmount - Calculated: sum(DiscountAmount).

·         TotalAfterDiscount - Calculated: TotalSale - DiscountAmount.

·         AgreementVisitID - Required for visits: set an existing Agreement Visit ID.

·         VisitType - Visit values are in (AgreementVisitID.VisitType?); Sets item number on visit when scheduled maintenance.

·         VisitPrice - Sets UnitPrice for scheduled maintenance.

·         AgreementID - Set to 0 to create a new agreement; existing id for editing.

·         AgreementNumber - User assigned agreement number (may be modified with an 'a' to identify changes from the original id); usually same as agreement id.

·         RenewedFromID - ID of old agreement that the new ID will be extending.

·         AgreementType - Validate against values in AgreementType table.

·         Years - Number of years agreement spread across.

·         StartDate - Agreement start date.

·         TotalPrice (agreement section)- Agreement price.

·         Deposit - Customer deposit on agreement.

·         BillStartDate – Startdate for recurring billing

·         PaymentMethod – assuming kind of credit card for recurring billing

·         PaymentType – will be looked up by PaymentMethod

·         XCAlias – OpenEdge Alias/Token

·         CreditCardExpireMonth – format MM

·         CreditCardExpireYear – format YYYY or YY

·         CreditCardNumber – the expected masked format

·         CreditCardName – name on the credit card

·         AgreementCoverageUnitID – Auto increment field.

·         LocationUnitID - Key used to link agreement equipment locations in datasets.

·         UnitType - Equipment unit type(RefLib-Equipment-StandardEquipment).

·         Location - [dbo].LocationUnit.Location.

·         InvoiceItemDetailID - Must be a valid invoice item detail id; 0 indicates a new detail.   Quantity, UnitCost, & Markup can be updated for existing items..

·         Markup - Cost Plus Markup for a Detail Item.

·         UnitPrice (detail) - Calculation: UnitCost * Markup.

·         TotalPrice – Calculated.

·         SerialNumber - part Serial Number, ItemType must be P.

·         Serialized - [dbo].IC_Item.Serialized.

·         WorkSuggested - Description of needed work.

·         DepositReceivableID – Deposit receivable id.  Must be valid.

·         DepositBalAvailable – Balance available in deposits.

·         DepositAmount – Deposit being added