Coresuite Customize : Optimizer
Good Day All
I have a rule on my delivery note to print automatically for all Document series, with the exception of one specific Document series.
This customisation has been working fine for many years now. All of the sudden a few days ago it has stopped working. Any idea what can cause this?
Here is my Delivery note print definition :
And this is my Optimizer details :
/*
***** General Information *****
Creator: Coresystems AG, kasi
Create Date: 2015-05-26
***** StartConfDesc *****
The customize rule checks if the delivery note which is added, is from the primary series and prints the delivery note if this is true
***** EndConfDesc *****
***** Updates *****
2015-05-26, kasi: Created the rule
*/
string deliveryNoteLayoutId = "U0000150";
try
{
//StatusBar.WriteWarning("DEBUG - Rule: " + pVal.RuleInfo.RuleName + " was triggered. ");
string strSeries = pVal.Form.SystemDataSources["ODLN"].GetValue("Series", 0);
string strDocEntry = pVal.Form.SystemDataSources["ODLN"].GetValue("DocEntry", 0);
string strDocNum = pVal.Form.SystemDataSources["ODLN"].GetValue("DocNum", 0);
string strUserId = SwissAddonFramework.B1Connector.GetB1Connector().UserId.ToString();
//StatusBar.WriteWarning(strSeries);
// if the series is 6, which is primary (<= on customer side) then the delivery should be printed
if(strSeries == "6"){
LayoutHelper.LayoutOpener.ExecutePrintDef(deliveryNoteLayoutId, LayoutHelper.LayoutOpener.OpenLayoutModes.Print, "DocEntry", strDocEntry + "", "UserId", strUserId);
StatusBar.WriteSucess("Printing delivery note " + strDocNum);
}
else
if(strSeries == "101"){
LayoutHelper.LayoutOpener.ExecutePrintDef(deliveryNoteLayoutId, LayoutHelper.LayoutOpener.OpenLayoutModes.Print, "DocEntry", strDocEntry + "", "UserId", strUserId);
StatusBar.WriteSucess("Printing delivery note " + strDocNum);
}
else
if(strSeries == "119"){
LayoutHelper.LayoutOpener.ExecutePrintDef(deliveryNoteLayoutId, LayoutHelper.LayoutOpener.OpenLayoutModes.Print, "DocEntry", strDocEntry + "", "UserId", strUserId);
StatusBar.WriteSucess("Printing delivery note " + strDocNum);
}
else
if(strSeries == "87"){
LayoutHelper.LayoutOpener.ExecutePrintDef(deliveryNoteLayoutId, LayoutHelper.LayoutOpener.OpenLayoutModes.Print, "DocEntry", strDocEntry + "", "UserId", strUserId);
StatusBar.WriteSucess("Printing delivery note " + strDocNum);
}
else
if(strSeries == "95"){
LayoutHelper.LayoutOpener.ExecutePrintDef(deliveryNoteLayoutId, LayoutHelper.LayoutOpener.OpenLayoutModes.Print, "DocEntry", strDocEntry + "", "UserId", strUserId);
StatusBar.WriteSucess("Printing delivery note " + strDocNum);
}
else{
// Do not print other series than serie 6
}
}
catch (Exception ex)
{
string errorMessage = string.Format("Error in {0} Rule '{1}': {2}", pVal.RuleInfo.RuleType, pVal.RuleInfo.RuleName, ex.Message);
MessageBox.Show(errorMessage, "OK");
StatusBar.WriteError(errorMessage);
Debug.WriteMessage(errorMessage, Debug.DebugLevel.Exception);
}
return true;
Why would the rule not work after working fine for years. Any ideas what could cause this?
Thank you
Janice
-
Hi Janice,
I see different things that could be posibble.
I'm not sure if optimizer needs 1 in Copies M instead of 0When only 6 should be printed, why are there there other series as well?
If series is 101 or so on it should print too
Is 6 right or did it changed in the pastWhy using optimizer?
You can gain what you want with "after add" and the Extended Definition as wellregards Lothar
0 -
hi Lothar
I will see if changing the 0 to 1 on Copies M will make a difference, but that has always been 1.
Series 6, 101, etc should all print. We have a few document series. only series 83 should not print.
This was done a few years ago. I am unfamiliar with the Extended Definition, do you have an example I can use perhaps. I havent worked on coresuite for quite some time :-(
thanks
Janice
0 -
Hi Janice,
as I already said putting “after Add” on Print it would do what you want.
Next step Filtering
In the Extended Definition you'll find the “Parameter Expression”. With it you can control that a Printdefinition is “visible” / "useable". You can put a query and if the result is 1 the PrnDef is visible, otherwise 0 not.
Small problem with it, if you have e.g. 10 PrnDef's for one FormType you need to setup the “Parameter Expression” in all PrnDef's
SELECT /*Wenn der Kunde nicht Privat ist dann 1*/ CASE [OCRD].[CmpPrivate] WHEN 'I' THEN 0 ELSE 1 END AS [Visible] FROM [O@@RDR] INNER JOIN [OCRD] ON [OCRD].[CardCode] = [O@@RDR].[CardCode] WHERE [O@@RDR].[DocEntry] = [%DocEntry]
In my case it is Private.
So you could setup a PrintDef for all series <> 83 with Print after add, one Printdef with series = 83 and all other PrndDef could have
Select 1
regards Lothar
0
Please sign in to leave a comment.
Comments
3 comments