Adam007
Programmer
- Oct 18, 2009
- 21
Hey All,
i have a issue when attempting to update the OEINVH table.
Im trying to locate the invoice base on the INVNUMBER field, but the record is never found.
Any help would be appreciated.
Here is my sample code;
i have a issue when attempting to update the OEINVH table.
Im trying to locate the invoice base on the INVNUMBER field, but the record is never found.
Any help would be appreciated.
Here is my sample code;
Code:
xapiView OEINV1header = null;
xapiFields OEINV1headerFields = null;
xapiView OEINV1detail1 = null;
xapiFields OEINV1detail1Fields = null;
xapiView OEINV1detail2 = null;
xapiFields OEINV1detail2Fields = null;
xapiView OEINV1detail3 = null;
xapiFields OEINV1detail3Fields = null;
xapiView OEINV1detail4 = null;
xapiFields OEINV1detail4Fields = null;
xapiView OEINV1detail5 = null;
xapiFields OEINV1detail5Fields = null;
xapiView OEINV1detail6 = null;
xapiFields OEINV1detail6Fields = null;
try
{
// Compose
OEINV1header = OpenView("OE0420");
OEINV1headerFields = OEINV1header.Fields;
OEINV1detail1 = OpenView("OE0400");
OEINV1detail1Fields = OEINV1detail1.Fields;
OEINV1detail2 = OpenView("OE0720");
OEINV1detail2Fields = OEINV1detail2.Fields;
OEINV1detail3 = OpenView("OE0160");
OEINV1detail3Fields = OEINV1detail3.Fields;
OEINV1detail4 = OpenView("OE0660");
OEINV1detail4Fields = OEINV1detail4.Fields;
OEINV1detail5 = OpenView("OE0427");
OEINV1detail5Fields = OEINV1detail5.Fields;
OEINV1detail6 = OpenView("OE0422");
OEINV1detail6Fields = OEINV1detail6.Fields;
OEINV1header.Compose(new object[]{ OEINV1detail1, OEINV1detail4, OEINV1detail3, OEINV1detail2, OEINV1detail5, OEINV1detail6});
foreach(string ordInv in invoices)
{
OEINV1header.Fields.Item("INVNUMBER").PutWithoutVerification(ordInv);
OEINV1header.Read();
if (Convert.ToBoolean(OEINV1header.Exists)) // make sure the invoice exists
{
OEINV1header.Fields.Item("SHIPTRACK").Value = newFlag;
OEINV1header.Verify();
OEINV1header.Process();
OEINV1header.Update();
}
else
{
MessageBox.Show(string.Format("The invoice with the invoice number of {0} couldn't be found.", ordInv));
}
}
return true;
}
catch
{
string xapiErr = GetXAPIError();
if (!string.IsNullOrEmpty(xapiErr))
throw new Exception(xapiErr);
else
throw;
}
finally
{
if (OEINV1header != null) { OEINV1header.Close(); OEINV1header = null; }
if (OEINV1headerFields != null) { OEINV1headerFields = null; }
if (OEINV1detail1 != null) { OEINV1detail1.Close(); OEINV1detail1 = null; }
if (OEINV1detail1Fields != null) { OEINV1detail1Fields = null; }
if (OEINV1detail2 != null) { OEINV1detail2.Close(); OEINV1detail2 = null; }
if (OEINV1detail2Fields != null) { OEINV1detail2Fields = null; }
if (OEINV1detail3 != null) { OEINV1detail3.Close(); OEINV1detail3 = null; }
if (OEINV1detail3Fields != null) { OEINV1detail3Fields = null; }
if (OEINV1detail4 != null) { OEINV1detail4.Close(); OEINV1detail4 = null; }
if (OEINV1detail4Fields != null) { OEINV1detail4Fields = null; }
if (OEINV1detail5 != null) { OEINV1detail5.Close(); OEINV1detail5 = null; }
if (OEINV1detail5Fields != null) { OEINV1detail5Fields = null; }
if (OEINV1detail6 != null) { OEINV1detail6.Close(); OEINV1detail6 = null; }
if (OEINV1detail6Fields != null) { OEINV1detail6Fields = null; }
}