[ExtensionOf(formStr(SalesEditLines))]
Final class EQNSalesEditLinesForm_Extension
{
void run()
{
SalesId salesTableTmp;
SalesParmTable salesParmTableTemp = this.SalesParmTable;
next run();
salesTableTmp = salesParmTableTemp.SalesId; //element.args().caller().salestable;
if(salesFormLetter.documentStatus() == DocumentStatus::PackingSlip)
{
SalesLine salesline;
DlvMode dlvMode;
select dlvMode
join salesline
where dlvMode.Code == salesline.DlvMode
&& dlvMode.EQNLabelTypeforTransaportation != ""
&& salesline.SalesId == salesTableTmp;
if(dlvMode)
{
salesFormLetter.printShippingLabel(true);
printShippingLabelChoice = true;
printShippingLabel.value(true);
}
else
{
salesFormLetter.printShippingLabel(false);
printShippingLabelChoice = false;
printShippingLabel.value(false);
}
}
}
void closeOk()
{
if(SalesShippingStat.CartonsQty == 0.00 && SalesShippingStat.EQNLabelTypeforTransportation != "")
{
throw error(strFmt("@EQN:Shippinglabelerror"));
}
next closeOk();
}
[FormDataSourceEventHandler(formDataSourceStr(SalesEditLines, SalesParmLine), FormDataSourceEventType::Activated)]
public static void DNREvent_SalesParmLineDS_OnActivated(FormDataSource _sender, FormDataSourceEventArgs _eventArgs)
{
FormRun formRun = _sender.formRun() as FormRun;
FormDataSource SalesParmLine_ds = _sender.formRun().dataSource("SalesParmLine");
SalesParmLine_ds.allowEdit(true);
SalesParmLine_ds.object(fieldNum(SalesParmLine, Dlvmode)).allowEdit(true);
formRun.control(formRun.controlId(formControlStr(SalesEditLines, GridSalesParmLine_MCRDlvMode))).allowEdit (true);
}
[FormDataSourceEventHandler(formDataSourceStr(SalesEditLines, SalesShippingStat), FormDataSourceEventType::Activated)]
public static void SalesShippingStat_OnActivated(FormDataSource sender, FormDataSourceEventArgs e)
{
FormRun formRun = sender.formRun() as FormRun;
FormDataSource SalesShippingStat_ds = sender.formRun().dataSource("SalesShippingStat");
SalesShippingStat salesshippingstat =SalesShippingStat_ds.cursor();
if(salesshippingstat.EQNLabelTypeforTransportation != "")
SalesShippingStat_ds.object(fieldNum(SalesShippingStat, CartonsQty)).mandatory(true);
else
SalesShippingStat_ds.object(fieldNum(SalesShippingStat, CartonsQty)).mandatory(false);
FormStringControl LabelType = formRun.design(0).controlName("SalesShippingStat_EQNLabelTypeforTransportation");
if(LabelType.text() != "")
SalesShippingStat_ds.object(fieldNum(SalesShippingStat, CartonsQty)).mandatory(true);
else
{
SalesShippingStat_ds.object(fieldNum(SalesShippingStat, CartonsQty)).mandatory(false);
}
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
[FormEventHandler(formStr(SalesEditLines), FormEventType::Activated)]
public static void SalesEditLines_OnActivated(xFormRun sender, FormEventArgs e)
{
FormDataSource SalesShippingStat_ds = sender.dataSource("SalesShippingStat");
SalesShippingStat salesshippingstat =SalesShippingStat_ds.cursor();
if(salesshippingstat.EQNLabelTypeforTransportation != "")
SalesShippingStat_ds.object(fieldNum(SalesShippingStat, CartonsQty)).mandatory(true);
else
{
SalesShippingStat_ds.object(fieldNum(SalesShippingStat, CartonsQty)).mandatory(false);
}
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
[FormControlEventHandler(formControlStr(SalesEditLines, GridSalesParmLine_MCRDlvMode), FormControlEventType::Modified)]
public static void GridSalesParmLine_MCRDlvMode_OnModified(FormControl sender, FormControlEventArgs e)
{
DlvMode dlvMode;
SalesLine relsalesline,salesline;
FormControl DlvModeControl;
FormRun form;
FormDataSource SalesShippingStat_ds,SalesParmLine_ds;
SalesParmLine salesParmLine;
SalesShippingStat SalesShippingStat;
DlvModeControl = sender as FormControl;
form = DlvModeControl.formRun();
SalesShippingStat_ds = form.dataSource(formDataSourceStr(SalesEditLines, SalesShippingStat)) as FormDataSource;
SalesParmLine_ds = form.dataSource(formDataSourceStr(SalesEditLines, SalesParmLine)) as FormDataSource;
salesParmLine = salesParmLine_ds.cursor();
relsalesline = salesParmLine.salesLine();
select dlvMode
join salesline
where dlvMode.Code == salesparmline.DlvMode
&& dlvMode.EQNLabelTypeforTransaportation != ""
&& salesline.recid == relsalesline.recid;
ttsbegin;
relsalesline.selectForUpdate(true);
relsalesline.DlvMode=salesParmLine.DlvMode;
relsalesline.update();
ttscommit;
SalesShippingStat = SalesShippingStat_ds.cursor();
salesShippingStat.EQNLabelTypeforTransportation = Dlvmode.EQNLabelTypeforTransaportation;
FormCheckBoxControl printshippinglabel = form.design(0).controlName("PrintShippingLabel");
if(dlvmode.EQNLabelTypeforTransaportation != "")
printshippinglabel.checked(true);
else
printshippinglabel.checked(false);
}
/*public void DlvModeModified(FormRun _form)
{
FormControl DlvModeControl;
SalesParmLine salesParmLine;
FormDataSource SalesShippingStat_ds,SalesParmLine_ds;
SalesLine relsalesline,salesline;
DlvMode dlvMode;
SalesShippingStat SalesShippingStat;
SalesShippingStat_ds = _form.dataSource(formDataSourceStr(SalesEditLines, SalesShippingStat)) as FormDataSource;
SalesParmLine_ds = _form.dataSource(formDataSourceStr(SalesEditLines, SalesParmLine)) as FormDataSource;
salesParmLine = salesParmLine_ds.cursor();
relsalesline = salesParmLine.salesLine();
select dlvMode
join salesline
where dlvMode.Code == salesparmline.DlvMode
&& dlvMode.EQNLabelTypeforTransaportation != ""
&& salesline.recid == relsalesline.recid;
SalesShippingStat = SalesShippingStat_ds.cursor();
salesShippingStat.EQNLabelTypeforTransportation = dlvMode.EQNLabelTypeforTransaportation;
}*/
[FormDataFieldEventHandler(formDataFieldStr(SalesEditLines, SalesParmLine, DlvMode), FormDataFieldEventType::Modified)]
public static void DlvMode_OnModified(FormDataObject sender, FormDataFieldEventArgs e)
{
DlvMode dlvMode;
SalesLine relsalesline,salesline;
FormRun form;
FormDataSource SalesShippingStat_ds,SalesParmLine_ds;
SalesParmLine salesParmLine;
SalesShippingStat SalesShippingStat;
form = sender.datasource().formRun();
SalesShippingStat_ds = form.dataSource(formDataSourceStr(SalesEditLines, SalesShippingStat)) as FormDataSource;
SalesParmLine_ds = form.dataSource(formDataSourceStr(SalesEditLines, SalesParmLine)) as FormDataSource;
salesParmLine = salesParmLine_ds.cursor();
relsalesline = salesParmLine.salesLine();
select dlvMode
join salesline
where dlvMode.Code == salesparmline.DlvMode
&& dlvMode.EQNLabelTypeforTransaportation != ""
&& salesline.recid == relsalesline.recid;
ttsbegin;
relsalesline.selectForUpdate(true);
relsalesline.DlvMode=salesParmLine.DlvMode;
relsalesline.update();
ttscommit;
SalesShippingStat = SalesShippingStat_ds.cursor();
salesShippingStat.EQNLabelTypeforTransportation = Dlvmode.EQNLabelTypeforTransaportation;
FormCheckBoxControl printshippinglabel = form.design(0).controlName("PrintShippingLabel");
if(dlvmode.EQNLabelTypeforTransaportation != "")
printshippinglabel.checked(true);
else
printshippinglabel.checked(false);
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
[FormDataSourceEventHandler(formDataSourceStr(SalesEditLines, SalesShippingStat), FormDataSourceEventType::ValidatingWrite)]
public static void SalesShippingStat_OnValidatingWrite(FormDataSource sender, FormDataSourceEventArgs e)
{
FormRun formRun = sender.formRun() as FormRun;
FormDataSource SalesShippingStat_ds = sender.formRun().dataSource("SalesShippingStat");
SalesShippingStat salesshippingstat =SalesShippingStat_ds.cursor();
if(SalesShippingStat.CartonsQty == 0.00 && SalesShippingStat.EQNLabelTypeforTransportation != "")
{
throw error(strFmt("@EQN:Shippinglabelerror"));
}
}
}
==================================================================
class EQNDeliveryModeEventhandler
{
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
[FormControlEventHandler(formControlStr(DeliveryMode, DlvMode_EQNLabelType), FormControlEventType::Lookup)]
public static void DlvMode_EQNLabelType_OnLookup(FormControl sender, FormControlEventArgs e)
{
FormControlCancelableSuperEventArgs event = e as FormControlCancelableSuperEventArgs;
//EQNDeliveryModeEventhandler::createLookup(sender);
sysTableLookup sysTableLookup = sysTableLookup::newParameters(tablenum(EQNLabelType), sender);
Query query = new Query();
QueryBuildDataSource eqnLabelTypeDS;
eqnLabelTypeDS = query.addDataSource(tableNum(EQNLabelType));
sysTableLookup.addLookupfield(fieldNum(EQNLabelType,EQNLabelType));
sysTableLookup.addLookupfield(fieldNum(EQNLabelType,EQNLabeltypedescription));
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
event.CancelSuperCall();
}
}
===================================================================
[ExtensionOf(tableStr(SalesShippingStat))]
Final class EQNSalesShippingStat_Extension
{
void initFromSalesTable(SalesTable _salesTable)
{
next initFromSalesTable(_salesTable);
SalesLine salesline;
DlvMode dlvMode;
select dlvMode
join salesline
where dlvMode.Code == salesline.DlvMode
&& dlvMode.EQNLabelTypeforTransaportation != ""
//&& salesline.DlvMode != ""
&& salesline.SalesId == _salesTable.SalesId;
if(dlvMode)
{
this.EQNLabelTypeforTransportation = dlvMode.EQNLabelTypeforTransaportation;
}
}
}
===================================================================
Final class EQNSalesEditLinesForm_Extension
{
void run()
{
SalesId salesTableTmp;
SalesParmTable salesParmTableTemp = this.SalesParmTable;
next run();
salesTableTmp = salesParmTableTemp.SalesId; //element.args().caller().salestable;
if(salesFormLetter.documentStatus() == DocumentStatus::PackingSlip)
{
SalesLine salesline;
DlvMode dlvMode;
select dlvMode
join salesline
where dlvMode.Code == salesline.DlvMode
&& dlvMode.EQNLabelTypeforTransaportation != ""
&& salesline.SalesId == salesTableTmp;
if(dlvMode)
{
salesFormLetter.printShippingLabel(true);
printShippingLabelChoice = true;
printShippingLabel.value(true);
}
else
{
salesFormLetter.printShippingLabel(false);
printShippingLabelChoice = false;
printShippingLabel.value(false);
}
}
}
void closeOk()
{
if(SalesShippingStat.CartonsQty == 0.00 && SalesShippingStat.EQNLabelTypeforTransportation != "")
{
throw error(strFmt("@EQN:Shippinglabelerror"));
}
next closeOk();
}
[FormDataSourceEventHandler(formDataSourceStr(SalesEditLines, SalesParmLine), FormDataSourceEventType::Activated)]
public static void DNREvent_SalesParmLineDS_OnActivated(FormDataSource _sender, FormDataSourceEventArgs _eventArgs)
{
FormRun formRun = _sender.formRun() as FormRun;
FormDataSource SalesParmLine_ds = _sender.formRun().dataSource("SalesParmLine");
SalesParmLine_ds.allowEdit(true);
SalesParmLine_ds.object(fieldNum(SalesParmLine, Dlvmode)).allowEdit(true);
formRun.control(formRun.controlId(formControlStr(SalesEditLines, GridSalesParmLine_MCRDlvMode))).allowEdit (true);
}
[FormDataSourceEventHandler(formDataSourceStr(SalesEditLines, SalesShippingStat), FormDataSourceEventType::Activated)]
public static void SalesShippingStat_OnActivated(FormDataSource sender, FormDataSourceEventArgs e)
{
FormRun formRun = sender.formRun() as FormRun;
FormDataSource SalesShippingStat_ds = sender.formRun().dataSource("SalesShippingStat");
SalesShippingStat salesshippingstat =SalesShippingStat_ds.cursor();
if(salesshippingstat.EQNLabelTypeforTransportation != "")
SalesShippingStat_ds.object(fieldNum(SalesShippingStat, CartonsQty)).mandatory(true);
else
SalesShippingStat_ds.object(fieldNum(SalesShippingStat, CartonsQty)).mandatory(false);
FormStringControl LabelType = formRun.design(0).controlName("SalesShippingStat_EQNLabelTypeforTransportation");
if(LabelType.text() != "")
SalesShippingStat_ds.object(fieldNum(SalesShippingStat, CartonsQty)).mandatory(true);
else
{
SalesShippingStat_ds.object(fieldNum(SalesShippingStat, CartonsQty)).mandatory(false);
}
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
[FormEventHandler(formStr(SalesEditLines), FormEventType::Activated)]
public static void SalesEditLines_OnActivated(xFormRun sender, FormEventArgs e)
{
FormDataSource SalesShippingStat_ds = sender.dataSource("SalesShippingStat");
SalesShippingStat salesshippingstat =SalesShippingStat_ds.cursor();
if(salesshippingstat.EQNLabelTypeforTransportation != "")
SalesShippingStat_ds.object(fieldNum(SalesShippingStat, CartonsQty)).mandatory(true);
else
{
SalesShippingStat_ds.object(fieldNum(SalesShippingStat, CartonsQty)).mandatory(false);
}
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
[FormControlEventHandler(formControlStr(SalesEditLines, GridSalesParmLine_MCRDlvMode), FormControlEventType::Modified)]
public static void GridSalesParmLine_MCRDlvMode_OnModified(FormControl sender, FormControlEventArgs e)
{
DlvMode dlvMode;
SalesLine relsalesline,salesline;
FormControl DlvModeControl;
FormRun form;
FormDataSource SalesShippingStat_ds,SalesParmLine_ds;
SalesParmLine salesParmLine;
SalesShippingStat SalesShippingStat;
DlvModeControl = sender as FormControl;
form = DlvModeControl.formRun();
SalesShippingStat_ds = form.dataSource(formDataSourceStr(SalesEditLines, SalesShippingStat)) as FormDataSource;
SalesParmLine_ds = form.dataSource(formDataSourceStr(SalesEditLines, SalesParmLine)) as FormDataSource;
salesParmLine = salesParmLine_ds.cursor();
relsalesline = salesParmLine.salesLine();
select dlvMode
join salesline
where dlvMode.Code == salesparmline.DlvMode
&& dlvMode.EQNLabelTypeforTransaportation != ""
&& salesline.recid == relsalesline.recid;
ttsbegin;
relsalesline.selectForUpdate(true);
relsalesline.DlvMode=salesParmLine.DlvMode;
relsalesline.update();
ttscommit;
SalesShippingStat = SalesShippingStat_ds.cursor();
salesShippingStat.EQNLabelTypeforTransportation = Dlvmode.EQNLabelTypeforTransaportation;
FormCheckBoxControl printshippinglabel = form.design(0).controlName("PrintShippingLabel");
if(dlvmode.EQNLabelTypeforTransaportation != "")
printshippinglabel.checked(true);
else
printshippinglabel.checked(false);
}
/*public void DlvModeModified(FormRun _form)
{
FormControl DlvModeControl;
SalesParmLine salesParmLine;
FormDataSource SalesShippingStat_ds,SalesParmLine_ds;
SalesLine relsalesline,salesline;
DlvMode dlvMode;
SalesShippingStat SalesShippingStat;
SalesShippingStat_ds = _form.dataSource(formDataSourceStr(SalesEditLines, SalesShippingStat)) as FormDataSource;
SalesParmLine_ds = _form.dataSource(formDataSourceStr(SalesEditLines, SalesParmLine)) as FormDataSource;
salesParmLine = salesParmLine_ds.cursor();
relsalesline = salesParmLine.salesLine();
select dlvMode
join salesline
where dlvMode.Code == salesparmline.DlvMode
&& dlvMode.EQNLabelTypeforTransaportation != ""
&& salesline.recid == relsalesline.recid;
SalesShippingStat = SalesShippingStat_ds.cursor();
salesShippingStat.EQNLabelTypeforTransportation = dlvMode.EQNLabelTypeforTransaportation;
}*/
[FormDataFieldEventHandler(formDataFieldStr(SalesEditLines, SalesParmLine, DlvMode), FormDataFieldEventType::Modified)]
public static void DlvMode_OnModified(FormDataObject sender, FormDataFieldEventArgs e)
{
DlvMode dlvMode;
SalesLine relsalesline,salesline;
FormRun form;
FormDataSource SalesShippingStat_ds,SalesParmLine_ds;
SalesParmLine salesParmLine;
SalesShippingStat SalesShippingStat;
form = sender.datasource().formRun();
SalesShippingStat_ds = form.dataSource(formDataSourceStr(SalesEditLines, SalesShippingStat)) as FormDataSource;
SalesParmLine_ds = form.dataSource(formDataSourceStr(SalesEditLines, SalesParmLine)) as FormDataSource;
salesParmLine = salesParmLine_ds.cursor();
relsalesline = salesParmLine.salesLine();
select dlvMode
join salesline
where dlvMode.Code == salesparmline.DlvMode
&& dlvMode.EQNLabelTypeforTransaportation != ""
&& salesline.recid == relsalesline.recid;
ttsbegin;
relsalesline.selectForUpdate(true);
relsalesline.DlvMode=salesParmLine.DlvMode;
relsalesline.update();
ttscommit;
SalesShippingStat = SalesShippingStat_ds.cursor();
salesShippingStat.EQNLabelTypeforTransportation = Dlvmode.EQNLabelTypeforTransaportation;
FormCheckBoxControl printshippinglabel = form.design(0).controlName("PrintShippingLabel");
if(dlvmode.EQNLabelTypeforTransaportation != "")
printshippinglabel.checked(true);
else
printshippinglabel.checked(false);
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
[FormDataSourceEventHandler(formDataSourceStr(SalesEditLines, SalesShippingStat), FormDataSourceEventType::ValidatingWrite)]
public static void SalesShippingStat_OnValidatingWrite(FormDataSource sender, FormDataSourceEventArgs e)
{
FormRun formRun = sender.formRun() as FormRun;
FormDataSource SalesShippingStat_ds = sender.formRun().dataSource("SalesShippingStat");
SalesShippingStat salesshippingstat =SalesShippingStat_ds.cursor();
if(SalesShippingStat.CartonsQty == 0.00 && SalesShippingStat.EQNLabelTypeforTransportation != "")
{
throw error(strFmt("@EQN:Shippinglabelerror"));
}
}
}
==================================================================
class EQNDeliveryModeEventhandler
{
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
[FormControlEventHandler(formControlStr(DeliveryMode, DlvMode_EQNLabelType), FormControlEventType::Lookup)]
public static void DlvMode_EQNLabelType_OnLookup(FormControl sender, FormControlEventArgs e)
{
FormControlCancelableSuperEventArgs event = e as FormControlCancelableSuperEventArgs;
//EQNDeliveryModeEventhandler::createLookup(sender);
sysTableLookup sysTableLookup = sysTableLookup::newParameters(tablenum(EQNLabelType), sender);
Query query = new Query();
QueryBuildDataSource eqnLabelTypeDS;
eqnLabelTypeDS = query.addDataSource(tableNum(EQNLabelType));
sysTableLookup.addLookupfield(fieldNum(EQNLabelType,EQNLabelType));
sysTableLookup.addLookupfield(fieldNum(EQNLabelType,EQNLabeltypedescription));
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
event.CancelSuperCall();
}
}
===================================================================
[ExtensionOf(tableStr(SalesShippingStat))]
Final class EQNSalesShippingStat_Extension
{
void initFromSalesTable(SalesTable _salesTable)
{
next initFromSalesTable(_salesTable);
SalesLine salesline;
DlvMode dlvMode;
select dlvMode
join salesline
where dlvMode.Code == salesline.DlvMode
&& dlvMode.EQNLabelTypeforTransaportation != ""
//&& salesline.DlvMode != ""
&& salesline.SalesId == _salesTable.SalesId;
if(dlvMode)
{
this.EQNLabelTypeforTransportation = dlvMode.EQNLabelTypeforTransaportation;
}
}
}
===================================================================
No comments:
Post a Comment