Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automate Day End Processing?

Status
Not open for further replies.

rdingman

IS-IT--Management
May 27, 2006
25
CA
Has anyone written a macro that will invoke Day End Processing automatically? We try to do it last thing everyday, but it never fails to get missed a couple times a week. I can't seem to find a third party utility for this.

This a great forum and I have picked up valuable tips.
 
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");


}
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top