...
SalesTable salesTable;
NumberSeq NumberSeq;
SalesLine salesLine;
AxSalesLine axSalesLine = new axSalesLine();
AxSalesTable axsalesTable = new axSalesTable();
;
...
ttsbegin;
axsalesTable.parmSalesId();
if (ServiceOrder.CustName == "")
axsalesTable.parmCustAccount(ServiceOrder.CustAccount);// Cust Account
else
axsalestable.parmOneTimeCustomer(Dialog_OneTime.value());
axsalesTable.parmDlvMode(Dialog_DLVMode.value());
axsalesTable.parmDlvTerm(Dialog_DLVTerm.value());
axsalesTable.save();
while select forupdate Lines where Lines.RepairJournalId == _RepairJournalId && Lines.SalesId == "" &&
Lines.CSApproval == B_Approval::Approved && Lines.ItemId != "" && Lines.Qty > 0
{
axSalesLine = AxSalesLine::construct();
axSalesLine.parmSalesId(axsalesTable.parmSalesId());
axSalesLine.parmItemId(Lines.ItemId);
axSalesLine.parmSalesQty(Lines.Qty);
axSalesline.parmSalesPrice(Lines.ProjSalesPrice);
axSalesline.parmCurrencyCode(Lines.ProjCurrencyCode);
axSalesline.parmSalesUnit(Lines.Unit);
Lines.SalesId = axsalesTable.parmSalesId();
Lines.update();
axSalesLine.save();
}
ttscommit;
...
31 Ocak 2013 Perşembe
29 Kasım 2012 Perşembe
AXAPTA Add Range with SysQuery to Form & Report
For Form:
SysQuery::findOrCreateRange(B_RMAOutTable_DS.query().dataSourceTable(tablenum(B_RMAOutTable)), fieldnum(B_RMAOutTable,RMAIn)).
value(QueryValue(NoYes::Yes));
For Report:
SysQuery::findOrCreateRange(this.query().dataSourceTable(tablenum(SMAServiceOrderTable)),
fieldnum(SMAServiceOrderTable,ItemSerialNum)).
value(sysquery::valueNotEmptyString());
Run methoduna super'den önce yazabilirsiniz.
You may add this code to before run method's super() call.
SysQuery::findOrCreateRange(B_RMAOutTable_DS.query().dataSourceTable(tablenum(B_RMAOutTable)), fieldnum(B_RMAOutTable,RMAIn)).
value(QueryValue(NoYes::Yes));
For Report:
SysQuery::findOrCreateRange(this.query().dataSourceTable(tablenum(SMAServiceOrderTable)),
fieldnum(SMAServiceOrderTable,ItemSerialNum)).
value(sysquery::valueNotEmptyString());
Run methoduna super'den önce yazabilirsiniz.
You may add this code to before run method's super() call.
27 Kasım 2012 Salı
If and like
In axapta like operator can use with if command like sql - select command :
if (ItemId like "WX*")
if (ItemId like "WX*")
5 Kasım 2012 Pazartesi
AXAPTA - Excel Import
void clicked()
{
SysExcelApplication application;
SysExcelWorkbooks workbooks;
SysExcelWorkbook workbook;
SysExcelWorksheets worksheets;
SysExcelWorksheet worksheet;
SysExcelCells cells;
COMVariantType type;
int row;
str line;
Filename Filename;
;
super();
Filename = WinApi::getOpenFileName(element.hWnd(),['XLS files','*.xls'],"","Filename");
if (!Filename)
return;
application = SysExcelApplication::construct();
workbooks = application.workbooks();
try
{
workbooks.open(filename,0,true);
}
catch (Exception::Error)
{
throw error(strfmt("File cannot open: %1",Filename));
}
element.lock();
workbook = workbooks.item(1);
worksheets = workbook.worksheets();
worksheet = worksheets.itemFromNum(1);
cells = worksheet.cells();
do
{
row++;
type = cells.item(row+1,1).value().variantType();
switch(cells.item(row,1).value().variantType())
{
case COMVariantType::VT_BSTR:
line = cells.item(row,1).value().bStr();
break;
case COMVariantType::VT_DECIMAL, COMVariantType::VT_R4, COMVariantType::VT_R8:
line = strfmt("%1",any2int(cells.item(row,1).value().double()));
break;
case COMVariantType::VT_I1, COMVariantType::VT_I2, COMVariantType::VT_I4:
line = strfmt("%1",cells.item(row,1).value().int());
break;
case COMVariantType::VT_UI1, COMVariantType::VT_UI2, COMVariantType::VT_UI4:
line = strfmt("%1",cells.item(row,1).value().uLong());
break;
case (COMVariantType::VT_DATE):
line = date2str(cells.item(row,1).value().date(),123,2,1,2,1,4);
case COMVariantType::VT_EMPTY:
line ="";
break;
default:
line="";
}
if (Line != "")
element.insertSerial(line);
}
while (type != COMVariantType::VT_EMPTY);
application.quit();
element.unLock();
}
{
SysExcelApplication application;
SysExcelWorkbooks workbooks;
SysExcelWorkbook workbook;
SysExcelWorksheets worksheets;
SysExcelWorksheet worksheet;
SysExcelCells cells;
COMVariantType type;
int row;
str line;
Filename Filename;
;
super();
Filename = WinApi::getOpenFileName(element.hWnd(),['XLS files','*.xls'],"","Filename");
if (!Filename)
return;
application = SysExcelApplication::construct();
workbooks = application.workbooks();
try
{
workbooks.open(filename,0,true);
}
catch (Exception::Error)
{
throw error(strfmt("File cannot open: %1",Filename));
}
element.lock();
workbook = workbooks.item(1);
worksheets = workbook.worksheets();
worksheet = worksheets.itemFromNum(1);
cells = worksheet.cells();
do
{
row++;
type = cells.item(row+1,1).value().variantType();
switch(cells.item(row,1).value().variantType())
{
case COMVariantType::VT_BSTR:
line = cells.item(row,1).value().bStr();
break;
case COMVariantType::VT_DECIMAL, COMVariantType::VT_R4, COMVariantType::VT_R8:
line = strfmt("%1",any2int(cells.item(row,1).value().double()));
break;
case COMVariantType::VT_I1, COMVariantType::VT_I2, COMVariantType::VT_I4:
line = strfmt("%1",cells.item(row,1).value().int());
break;
case COMVariantType::VT_UI1, COMVariantType::VT_UI2, COMVariantType::VT_UI4:
line = strfmt("%1",cells.item(row,1).value().uLong());
break;
case (COMVariantType::VT_DATE):
line = date2str(cells.item(row,1).value().date(),123,2,1,2,1,4);
case COMVariantType::VT_EMPTY:
line ="";
break;
default:
line="";
}
if (Line != "")
element.insertSerial(line);
}
while (type != COMVariantType::VT_EMPTY);
application.quit();
element.unLock();
}
15 Ekim 2012 Pazartesi
AXAPTA - clear client cache
Sometimes your new codes don't update at client side even you reset client computer. In this case this code part may help you:
xSession::removeAOC();
SysTreeNode::refreshAll();
SysFlushDictionary::doFlush();
SysFlushAOD::doFlush();
xSession::updateAOC();
xSession::removeAOC();
SysTreeNode::refreshAll();
SysFlushDictionary::doFlush();
SysFlushAOD::doFlush();
xSession::updateAOC();
9 Ekim 2012 Salı
AXAPTA - Empty compound statement warning
Axapta generates this warning when compiling. To avoid this warning empty blocks may be remove. But when issue Try/Catch block you can't do this. Well, what do you do?
I found this function from a blog, it does nothing except supress warning.
catch (Exception::Error)
{
exceptionTextFallThrough();
}
I found this function from a blog, it does nothing except supress warning.
8 Ekim 2012 Pazartesi
AXAPTA client and server current datetime values
I published datetime value for just client before. Today's values for client and server:
warning(strfmt("Client datetime value: %1",DatetimeUtil::getSystemDateTime()));
warning(strfmt("Server datetime value: %1",DatetimeUtil::utcNow()));
warning(strfmt("Client datetime value: %1",DatetimeUtil::getSystemDateTime()));
warning(strfmt("Server datetime value: %1",DatetimeUtil::utcNow()));
Kaydol:
Kayıtlar (Atom)