/*
***** General Information *****
Creator: coresystems ag, laja@coresystems.ch
Create Date: 2012-04-16
***** StartConfDesc *****
Block all invoices which are based on sales orders or sales quotations. Generally, this produces more reliable reporting in a variety of use case scenarios.
***** EndConfDesc *****
***** Updates *****
2012-04-16, laja: Initial Rule
2012-07-16, muf: use status bas error message instead of message box
*/
string ruleName = pVal.RuleInfo.RuleName.ToString();
string errorMessage = "Error in Optimizer Rule '" + ruleName + "'";
string msgOrder = "Direct Copy from Sales Order to A/R Invoice or A/R Reserve Invoice is not allowed. Please book a Delivery first.";
string msgQuotation = "Direct Copy from Sales Quotation to A/R Invoice or A/R Reserve Invoice is not allowed. Please book Sales Order and Delivery first.";
try
{
Matrix mtr = Matrix.GetFromUID(pVal.Form, "38");
for(int i = 0; i < mtr.Rows.Count - 1; i++)
{
if(mtr.GetValue("43", i).ToString() == "17")
{
StatusBar.WriteError(msgOrder);
return false;
}
if(mtr.GetValue("43", i).ToString() == "23")
{
StatusBar.WriteError(msgQuotation);
return false;
}
}
}
catch(System.Exception ex)
{
//MessageBox.Show(errorMessage + ": \n" + ex.Message, "OK");
StatusBar.WriteError(errorMessage + ": " + ex.Message);
Debug.WriteMessage(errorMessage + ": " + ex.Message, Debug.DebugLevel.Exception);
}
return true;/*
***** General Information *****
Creator: coresystems ag, laja@coresystems.ch
Create Date: 2012-04-16
***** StartConfDesc *****
Block all invoices which are based on sales orders or sales quotations. Generally, this produces more reliable reporting in a variety of use case scenarios.
***** EndConfDesc *****
***** Updates *****
2012-04-16, laja: Initial Rule
2012-07-16, muf: use status bas error message instead of message box
*/
string ruleName = pVal.RuleInfo.RuleName.ToString();
string errorMessage = "Error in Optimizer Rule '" + ruleName + "'";
string msgOrder = "Direct Copy from Sales Order to A/R Invoice or A/R Reserve Invoice is not allowed. Please book a Delivery first.";
string msgQuotation = "Direct Copy from Sales Quotation to A/R Invoice or A/R Reserve Invoice is not allowed. Please book Sales Order and Delivery first.";
try
{
Matrix mtr = Matrix.GetFromUID(pVal.Form, "38");
for(int i = 0; i < mtr.Rows.Count - 1; i++)
{
if(mtr.GetValue("43", i).ToString() == "17")
{
StatusBar.WriteError(msgOrder);
return false;
}
if(mtr.GetValue("43", i).ToString() == "23")
{
StatusBar.WriteError(msgQuotation);
return false;
}
}
}
catch(System.Exception ex)
{
//MessageBox.Show(errorMessage + ": \n" + ex.Message, "OK");
StatusBar.WriteError(errorMessage + ": " + ex.Message);
Debug.WriteMessage(errorMessage + ": " + ex.Message, Debug.DebugLevel.Exception);
}
return true;