Yes it was easy just record it.
Problem however scheduling it when you do not have software to do it.
I have converted the code to C# and compiled it into a Conlsole aplication and it works like a charm every Morning @ 1:00 AM
The code can be optimized, I plan to ad paramters to the comand line calling it etc…
using System;
public class Echo
{
string myString;
public Echo(string aString)
{
myString = aString;
}
}
public class Tell
{
public Tell(string Company)
{
//Console.WriteLine(myString);
//Console.WriteLine("Hello Dot Net");
//Console.ReadLine();
AccpacCOMAPI.AccpacSession pSession;
AccpacSignonManager.AccpacSignonMgr pSignon;
AccpacCOMAPI.AccpacDBLink pDBLinkCmpRW;
AccpacCOMAPI.AccpacDBLink pDBLinkSysRW;
pSession = new AccpacCOMAPI.AccpacSessionClass();
pSignon = new AccpacSignonManager.AccpacSignonMgrClass();
//pSignon.SignonNewSession (pSession);
pSession.Init ("","CS","CS0001", "53A");
pSession.Open("ADMIN", "PASSWORD", Company, System.DateTime.Now , 0, "");
if (pSession.IsOpened)
{
pDBLinkCmpRW = pSession.OpenDBLink
(AccpacCOMAPI.tagDBLinkTypeEnum.DBLINK_COMPANY,
AccpacCOMAPI.tagDBLinkFlagsEnum.DBLINK_FLG_READWRITE);
pDBLinkSysRW = pSession.OpenDBLink
(AccpacCOMAPI.tagDBLinkTypeEnum.DBLINK_SYSTEM,
AccpacCOMAPI.tagDBLinkFlagsEnum.DBLINK_FLG_READWRITE);
//ic
AccpacCOMAPI.AccpacView ICDEND1 ;
//ar
//gl
//ic
AccpacCOMAPI.AccpacViewFields ICDEND1Fields ;
pDBLinkCmpRW.OpenView ("IC0275", out ICDEND1);
ICDEND1Fields = ICDEND1.Fields;
ICDEND1.Process();
// Accounts Payable
AccpacCOMAPI.AccpacViewFields APINVCPOST1Fields;
AccpacCOMAPI.AccpacView APINVCPOST1;
AccpacCOMAPI.AccpacView APPAYMPOST2;
pDBLinkCmpRW.OpenView("AP0039", out APINVCPOST1);
APINVCPOST1Fields = APINVCPOST1.Fields;
AccpacCOMAPI.AccpacViewFields APPAYMPOST2Fields;
pDBLinkCmpRW.OpenView( "AP0040", out APPAYMPOST2);
APPAYMPOST2Fields = APPAYMPOST2.Fields;
//APINVCPOST1Fields.get_FieldByIndex(3).PutWithoutVerification("1");
object tmpobj = ("1");
//System.Object objstart = "1";
//fldsCustHeader.get_FieldByName("IDCUST").set_Value(ref objCustNum);
APINVCPOST1Fields.get_FieldByName("BATCHIDFR").PutWithoutVerification (ref tmpobj); //' From Batch
APPAYMPOST2Fields.get_FieldByName("BATCHIDFR").PutWithoutVerification (ref tmpobj); //' Post Batch From
//APPAYMPOST2Fields("BATCHIDFR").PutWithoutVerification ("1");
APINVCPOST1Fields.get_FieldByName("SWALLBTCH").PutWithoutVerification (ref tmpobj); // ' Process All Batches
APINVCPOST1.Process();
APINVCPOST1Fields.get_FieldByName("BATCHIDFR").PutWithoutVerification (ref tmpobj); //' From Batch
APPAYMPOST2Fields.get_FieldByName("BATCHIDFR").PutWithoutVerification (ref tmpobj); //' Post Batch From
object tmpobjAP = ("AD");
APPAYMPOST2Fields.get_FieldByName("TYPEBTCH").PutWithoutVerification (ref tmpobjAP) ; //' Batch Type
APPAYMPOST2Fields.get_FieldByName("ALLBTCHSW").PutWithoutVerification (ref tmpobj) ; //' Post All Batches
APPAYMPOST2.Process();
AccpacCOMAPI.AccpacView ARINVCPOST3;
AccpacCOMAPI.AccpacViewFields ARINVCPOST3Fields;
pDBLinkCmpRW.OpenView ("AR0048" , out ARINVCPOST3);
ARINVCPOST3Fields = ARINVCPOST3.Fields;
AccpacCOMAPI.AccpacView ARPAYMPOST4 ;
//AccpacCOMAPI.AccpacViewFields ARPAYMPOST4Fields ;
pDBLinkCmpRW.OpenView( "AR0049", out ARPAYMPOST4);
//ARPAYMPOST4.Fields = ARPAYMPOST4Fields ;
ARINVCPOST3Fields.get_FieldByName("SWALLBTCH").PutWithoutVerification (ref tmpobj) ; //' Post All Batches
ARINVCPOST3.Process();
ARINVCPOST3Fields.get_FieldByName("BATCHIDFR").PutWithoutVerification (ref tmpobj) ; // ' Post Batch From
ARPAYMPOST4.Fields.get_FieldByName("ALLBTCHSW").PutWithoutVerification (ref tmpobj) ; //' Post All Batches
ARPAYMPOST4.Process();
ARINVCPOST3Fields.get_FieldByName("BATCHIDFR").PutWithoutVerification (ref tmpobj) ; // ' Post Batch From
ARPAYMPOST4.Fields.get_FieldByName("TYPEBTCH").PutWithoutVerification (ref tmpobjAP) ; // ' Batch Type
ARPAYMPOST4.Process();
AccpacCOMAPI.AccpacView GLPOST5 ;
AccpacCOMAPI.AccpacViewFields GLPOST5Fields;
pDBLinkCmpRW.OpenView ("GL0030",out GLPOST5);
GLPOST5Fields = GLPOST5.Fields;
GLPOST5Fields.get_FieldByName("ALLBTCHSW").PutWithoutVerification (ref tmpobj); // ' Post All Batches Switch
GLPOST5.Process();
pSession.Close();
pSession.SvrDetach();
}
}
}
public class Hello
{
public static void Main()
{
new Tell("SAMLTD");
}
}