Method PostInvoiceDetail

Summary

Get Invioce Detail

Remarks

Get the details of an invoice returned from PostInvoices

Input Parameters

NameTypeLengthDescription
vendorNumber numeric 7 [Required] Vendor number. This must be an approved vendor (7-digit), not a non-system vendor (10-digit).
invoice System.String 15 [Required] InvoiceNumber from PostInvoices
batch numeric 5 [Required] BatchNumber from PostInvoices
transNumber numeric 7 [Required] TransactionNumber from PostInvoices
apYear numeric 4 [Required] AccountingPeriodYear from PostInvoices
apMonth numeric 2 [Required] AccountingPeriodMonth from PostInvoices

Example

POST http://localhost/FusionServices/v3/Naviline/ProductInventory/InvoiceDetail

Sample Responses

Sample Code

using System.Net;
using Newtonsoft.Json.Linq;

public void MethodName(parms)
{
   string uri = "http://localhost/FusionServices/v3/Naviline/ProductInventory/InvoiceDetail";
   System.Collections.Specialized.NameValueCollection postParms = 
     new System.Collections.Specialized.NameValueCollection(); 
   // Set paramater values
   postParms.Add("vendorNumber",System.Web.HttpUtility.UrlEncode("871"));
   postParms.Add("invoice",System.Web.HttpUtility.UrlEncode("18634A"));
   postParms.Add("batch",System.Web.HttpUtility.UrlEncode("220"));
   postParms.Add("transNumber",System.Web.HttpUtility.UrlEncode("400"));
   postParms.Add("apYear",System.Web.HttpUtility.UrlEncode("2016"));
   postParms.Add("apMonth",System.Web.HttpUtility.UrlEncode("3"));

   WebClient req = new WebClient();
   wc.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
   wc.Headers.Set("X-APPID", "YOURID");
   wc.Headers.Set("X-APPKEY", "YOURKEY");

   byte[] responseBytes = wc.UploadValues(new Uri(uri), "POST", postParms);
   string stringResult = Encoding.UTF8.GetString(responseBytes); 
   JObject response = JObject.Parse(stringResult);
   string error = response["OutputParms"]["ErrorCode"].ToString();
   if (error == "0000")
   {
         // TODO - YOUR CODE HERE
   }
}

C# Razor MVC Sample Code

using System;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using System.Collections.Specialized;
using FusionServiceHelper.Models;

// NOTE: Use the namespace generated when you add the class, so that it is correct.
namespace FusionRazor.Models
{
   public class PostInvoiceDetail
   {
       // Add property for each input param in order to map a field to it
       [Required(ErrorMessage = "Required")]
       [RegularExpression("[0-9]{0,7}", ErrorMessage = "Numeric values only. Must be 7 digits or less. ")]
       public string vendorNumber{get; set;}

       [Required(ErrorMessage = "Required")]
       [RegularExpression("^(?=.{0,15}$).*", ErrorMessage = "Must be 15 characters or less. ")]
       public string invoice{get; set;}

       [Required(ErrorMessage = "Required")]
       [RegularExpression("[0-9]{0,5}", ErrorMessage = "Numeric values only. Must be 5 digits or less. ")]
       public string batch{get; set;}

       [Required(ErrorMessage = "Required")]
       [RegularExpression("[0-9]{0,7}", ErrorMessage = "Numeric values only. Must be 7 digits or less. ")]
       public string transNumber{get; set;}

       [Required(ErrorMessage = "Required")]
       [RegularExpression("[0-9]{0,4}", ErrorMessage = "Numeric values only. Must be 4 digits or less. ")]
       public string apYear{get; set;}

       [Required(ErrorMessage = "Required")]
       [RegularExpression("[0-9]{0,2}", ErrorMessage = "Numeric values only. Must be 2 digits or less. ")]
       public string apMonth{get; set;}

       public PostInvoiceDetail()
       {
           //Set any defaults here
       }
   }
}
@* NOTE: Use Add->View to add the View. *@
@* NOTE: Check the 'Create strongly-typed view checkbox, and select the PostInvoiceDetail class. *@
@* NOTE: Select Edit as the Scaffold template. *@
@* NOTE: Use the @model line that is generated at the top.  Replace the rest with the lines below.
@model FusionRazor.Models.PostInvoiceDetail

@{
   ViewBag.Title = "PostInvoiceDetail";
}

<h2>PostInvoiceDetail</h2>
@using (Html.BeginForm()) {
   @Html.AntiForgeryToken()
   @Html.ValidationSummary(true)
   <fieldset>
   <legend>PostInvoiceDetail</legend>
       <div class="editor-label">
           @Html.LabelFor(model => model.vendorNumber)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.vendorNumber)
           @Html.ValidationMessageFor(model => model.vendorNumber)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.invoice)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.invoice)
           @Html.ValidationMessageFor(model => model.invoice)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.batch)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.batch)
           @Html.ValidationMessageFor(model => model.batch)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.transNumber)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.transNumber)
           @Html.ValidationMessageFor(model => model.transNumber)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.apYear)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.apYear)
           @Html.ValidationMessageFor(model => model.apYear)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.apMonth)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.apMonth)
           @Html.ValidationMessageFor(model => model.apMonth)
       </div>
       <p>
       <input type="submit" value="Submit"/>
       </p>
   </fieldset>

}

@section Scripts {
   @Scripts.Render("~/bundles/jqueryval")
}
using System;
using System.Collections.Specialized;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using FusionServiceHelper.Models;

// NOTE: Replace 'MyController' with the name of your controller.

// 
// GET: /MyController/PostInvoiceDetail
public ActionResult PostInvoiceDetail()
{
   // Create a new instance of the model to pick up any default values.
   PostInvoiceDetail model =  new PostInvoiceDetail();

   // pass model to set to default values
   // NOTE: Change 'MyFolderPath' to the path to the .cshtml file.
   return View("~/Views/MyFolderPath/PostInvoiceDetail.cshtml", model);
}

// 
// POST: /MyController/PostInvoiceDetail
[HttpPost]
public ActionResult PostInvoiceDetail(FormCollection collection)
{
   string url = "v3/Naviline/ProductInventory/InvoiceDetail";
   // Get the value from each input field
   NameValueCollection inputParms = new NameValueCollection();
   inputParms.Add("vendorNumber", collection["vendorNumber"]);
   inputParms.Add("invoice", collection["invoice"]);
   inputParms.Add("batch", collection["batch"]);
   inputParms.Add("transNumber", collection["transNumber"]);
   inputParms.Add("apYear", collection["apYear"]);
   inputParms.Add("apMonth", collection["apMonth"]);

   try
   {
       // Send the request
       FusionServiceRequest request = new FusionServiceRequest();
       FusionServiceResult result = request.Post(url, inputParms);

       return View("Result", result);
   }
   catch(Exception e)
   {
       HandleErrorInfo info = new HandleErrorInfo(e, "MyController", "PostInvoiceDetail");
       return View("Error", info);
   }
}