Api.IsWeb = true;
MercatorUi.Forms.Accounting.AccountingProcedures.Procedures.PostIntoAccountingParams p = new MercatorUi.Forms.Accounting.AccountingProcedures.Procedures.PostIntoAccountingParams(
DateTime.Today, // date1
DateTime.Today, // date2
new string[3] { "VEN", "NCV", "FactF" }, // journaux à centraliser
true, // postPayments
true, // performMatching
"001" // dossier si multi
);
MercatorUi.Forms.Accounting.AccountingProcedures.Procedures.PostIntoAccounting(p, true);
StringBuilder sb = new StringBuilder();
if (!string.IsNullOrEmpty(p.LastError))
{
sb.AppendLine(p.LastError);
sb.AppendLine();
sb.AppendLine("*************************************");
sb.AppendLine();
}
sb.AppendLine("VENTES & ACHATS");
sb.AppendLine();
sb.AppendLine(p.ResultPostSalesPurchases);
if (p.LogErrorsPostSalesPurchases != null)
{
sb.AppendLine();
sb.AppendLine(p.LogErrorsPostSalesPurchases.ToString());
}
sb.AppendLine();
sb.AppendLine("-------------------------------------------");
sb.AppendLine();
sb.AppendLine("PAIEMENTS");
sb.AppendLine();
sb.AppendLine(p.ResultPostPayments);
if (p.LogErrorsPostPayments != null)
{
sb.AppendLine();
sb.AppendLine(p.LogErrorsPostPayments.ToString());
}
sb.AppendLine();
sb.AppendLine("-------------------------------------------");
sb.AppendLine();
sb.AppendLine("LETTRAGE");
sb.AppendLine();
sb.AppendLine(p.ResultMatching);
IneoSmtp.Smtp smtp = new IneoSmtp.Smtp();
smtp.MailServer = "...";
smtp.ServerPort = 25;
smtp.SenderEmail = "info@abc.com";
smtp.SenderName = "Mercator PostIntoAccounting";
smtp.Recipient = "xyz@abc.com";
smtp.Message = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString() + "\r\n\r\n" + sb.ToString();
smtp.Subject = "Mercator PostIntoAccounting Log";
smtp.SendMail();