SrsReportRunController reportRunController;
Map queryContracts;
MapEnumerator mapEnum;
Query query;
QueryBuildRange range;
GsCamEsTiketContract contract ;
;
// Create the report run controller
reportRunController = new SrsReportRunController();
reportRunController.parmReportName('GsCamEsTiketSalida.PrecisionDesign1');
reportRunController.parmLoadFromSysLastValue(false);
// Set printer settings (print to file, format, filename, etc).
reportRunController.parmReportContract().parmPrintSettings().printMediumType(SRSPrintMediumType::Screen);
// contract =reportRunController.parmReportContract() as GsCamEsTiketContract;
reportRunController.parmReportContract().parmRdpContract().parmGsComEspCamionEsperaid("ABI-000024_Cam");
//reportRunController.parmReportContract().parmPrintSettings().overwriteFile(true);
//reportRunController.parmReportContract().parmPrintSettings().fileFormat(SRSReportFileFormat::PDF);
//reportRunController.parmReportContract().parmPrintSettings().fileName('c:\\test.pdf');
// Find/enumerate queries in the contract. The return from parmQueryContracts is
// a map of type <ParameterName,Query(class)>
// There must be a better way than this of updating the query prior to running the report -
// Or at least utility methods should be created to find the correct query
// or datasource directly from the ReportRunController.
/*
queryContracts = reportRunController.parmReportContract().parmQueryContracts();
mapEnum = queryContracts.getEnumerator();
while(mapEnum.moveNext())
{
// Get the query and update the datasource as required
query = mapEnum.currentValue();
range = SysQuery::findOrCreateRange(query.dataSourceTable(tableNum(VendTable)),fieldNum(VendTable,AccountNum));
range.value('1*');
}
*/
// Run the report
reportRunController.runReport();
Fuente: http://axinternals.blogspot.com/2011/11/running-report-via-code-in-ax2012.html
viernes, 18 de noviembre de 2011
jueves, 10 de noviembre de 2011
Crear Registro de Factura AIF
LedgerPurchaseInvoiceService LedgerPurchaseInvoiceService;
LedgerPurchaseInvoice LedgerPurchaseInvoice;
LedgerPurchaseInvoice_LedgerJournalTable LedgerPurchaseInvoice_LedgerJournalTable;
LedgerPurchaseInvoice_LedgerJournalTrans LedgerPurchaseInvoice_LedgerJournalTrans;
AifMultiTypeAccount AifMultiTypeAccount;
AifDimensionAttributeValueSet AifDimensionAttributeValueSet= new AifDimensionAttributeValueSet();
AifDimensionAttributeValue dimensionAttributeValue;
AfStronglyTypedDataContainerList dimensionAttributeValues;
#AifDimensionDataContainerTypes
;
LedgerPurchaseInvoiceService=LedgerPurchaseInvoiceService::construct();
LedgerPurchaseInvoice=new LedgerPurchaseInvoice();
LedgerPurchaseInvoice_LedgerJournalTable=new LedgerPurchaseInvoice_LedgerJournalTable();
LedgerPurchaseInvoice_LedgerJournalTrans=new LedgerPurchaseInvoice_LedgerJournalTrans();
LedgerPurchaseInvoice_LedgerJournalTable.parmJournalName("DIA_FAC");
LedgerPurchaseInvoice_LedgerJournalTrans=LedgerPurchaseInvoice_LedgerJournalTable.createLedgerJournalTrans().addNew();
///cuenta
AifMultiTypeAccount= new AifMultiTypeAccount();
AifMultiTypeAccount.parmAccount("ABI-000001");
AifMultiTypeAccount.parmDisplayValue("ABI-000001");
LedgerPurchaseInvoice_LedgerJournalTrans.parmLedgerDimension(AifMultiTypeAccount);
LedgerPurchaseInvoice_LedgerJournalTrans.parmAccountType(LedgerJournalACType::Vend);
//////////////////////////////////////////////////////////////////////
///cuenta contrapatida
///
dimensionAttributeValues = new AfStronglyTypedDataContainerList(#AifDimensionAttributeValue);
dimensionAttributeValue = dimensionAttributeValues.addNew();
dimensionAttributeValue.parmName("MainAccount");
dimensionAttributeValue.parmValue("61100022");
dimensionAttributeValue = dimensionAttributeValues.addNew();
dimensionAttributeValue.parmName("Sucursal");
dimensionAttributeValue.parmValue("QRO");
dimensionAttributeValue = dimensionAttributeValues.addNew();
dimensionAttributeValue.parmName("División");
dimensionAttributeValue.parmValue("ABINSA");
dimensionAttributeValue = dimensionAttributeValues.addNew();
dimensionAttributeValue.parmName("CentroCosto");
dimensionAttributeValue.parmValue("GTOB");
AifMultiTypeAccount=new AifMultiTypeAccount();
AifMultiTypeAccount.parmValues(dimensionAttributeValues);
AifMultiTypeAccount.parmDisplayValue("61100022-ABINSA-MEX-GTOT");
AifMultiTypeAccount.parmAccount("61100022");
LedgerPurchaseInvoice_LedgerJournalTrans.parmOffsetAccountType(LedgerJournalACType::Ledger);
LedgerPurchaseInvoice_LedgerJournalTrans.parmOffsetLedgerDimension(AifMultiTypeAccount);
LedgerPurchaseInvoice_LedgerJournalTrans.parmOffsetCompany(curext());
//////////////////////////////////////////////////////////////7
LedgerPurchaseInvoice_LedgerJournalTrans.parmAmountCurCredit(234.34);
LedgerPurchaseInvoice_LedgerJournalTrans.parmDocumentDate(today());
dimensionAttributeValues = new AfStronglyTypedDataContainerList(#AifDimensionAttributeValue);
dimensionAttributeValue = dimensionAttributeValues.addNew();
dimensionAttributeValue.parmName("Sucursal");
dimensionAttributeValue.parmValue("QRO");
dimensionAttributeValue = dimensionAttributeValues.addNew();
dimensionAttributeValue.parmName("División");
dimensionAttributeValue.parmValue("ABINSA");
dimensionAttributeValue = dimensionAttributeValues.addNew();
dimensionAttributeValue.parmName("CentroCosto");
dimensionAttributeValue.parmValue("GTOB");
AifDimensionAttributeValueSet.parmValues(dimensionAttributeValues);
LedgerPurchaseInvoice_LedgerJournalTrans.parmDefaultDimension(AifDimensionAttributeValueSet);
// LedgerInAccountStatementFI_BASIC::createDefaultDimension(["QRO","ABINSA","GTOB"])
LedgerPurchaseInvoice_LedgerJournalTrans.parmCompany(curext());
LedgerPurchaseInvoice_LedgerJournalTrans.parmInvoice("0001");
LedgerPurchaseInvoice.createLedgerJournalTable().add(LedgerPurchaseInvoice_LedgerJournalTable);
LedgerPurchaseInvoiceService.create(LedgerPurchaseInvoice);
LedgerPurchaseInvoice LedgerPurchaseInvoice;
LedgerPurchaseInvoice_LedgerJournalTable LedgerPurchaseInvoice_LedgerJournalTable;
LedgerPurchaseInvoice_LedgerJournalTrans LedgerPurchaseInvoice_LedgerJournalTrans;
AifMultiTypeAccount AifMultiTypeAccount;
AifDimensionAttributeValueSet AifDimensionAttributeValueSet= new AifDimensionAttributeValueSet();
AifDimensionAttributeValue dimensionAttributeValue;
AfStronglyTypedDataContainerList dimensionAttributeValues;
#AifDimensionDataContainerTypes
;
LedgerPurchaseInvoiceService=LedgerPurchaseInvoiceService::construct();
LedgerPurchaseInvoice=new LedgerPurchaseInvoice();
LedgerPurchaseInvoice_LedgerJournalTable=new LedgerPurchaseInvoice_LedgerJournalTable();
LedgerPurchaseInvoice_LedgerJournalTrans=new LedgerPurchaseInvoice_LedgerJournalTrans();
LedgerPurchaseInvoice_LedgerJournalTable.parmJournalName("DIA_FAC");
LedgerPurchaseInvoice_LedgerJournalTrans=LedgerPurchaseInvoice_LedgerJournalTable.createLedgerJournalTrans().addNew();
///cuenta
AifMultiTypeAccount= new AifMultiTypeAccount();
AifMultiTypeAccount.parmAccount("ABI-000001");
AifMultiTypeAccount.parmDisplayValue("ABI-000001");
LedgerPurchaseInvoice_LedgerJournalTrans.parmLedgerDimension(AifMultiTypeAccount);
LedgerPurchaseInvoice_LedgerJournalTrans.parmAccountType(LedgerJournalACType::Vend);
//////////////////////////////////////////////////////////////////////
///cuenta contrapatida
///
dimensionAttributeValues = new AfStronglyTypedDataContainerList(#AifDimensionAttributeValue);
dimensionAttributeValue = dimensionAttributeValues.addNew();
dimensionAttributeValue.parmName("MainAccount");
dimensionAttributeValue.parmValue("61100022");
dimensionAttributeValue = dimensionAttributeValues.addNew();
dimensionAttributeValue.parmName("Sucursal");
dimensionAttributeValue.parmValue("QRO");
dimensionAttributeValue = dimensionAttributeValues.addNew();
dimensionAttributeValue.parmName("División");
dimensionAttributeValue.parmValue("ABINSA");
dimensionAttributeValue = dimensionAttributeValues.addNew();
dimensionAttributeValue.parmName("CentroCosto");
dimensionAttributeValue.parmValue("GTOB");
AifMultiTypeAccount=new AifMultiTypeAccount();
AifMultiTypeAccount.parmValues(dimensionAttributeValues);
AifMultiTypeAccount.parmDisplayValue("61100022-ABINSA-MEX-GTOT");
AifMultiTypeAccount.parmAccount("61100022");
LedgerPurchaseInvoice_LedgerJournalTrans.parmOffsetAccountType(LedgerJournalACType::Ledger);
LedgerPurchaseInvoice_LedgerJournalTrans.parmOffsetLedgerDimension(AifMultiTypeAccount);
LedgerPurchaseInvoice_LedgerJournalTrans.parmOffsetCompany(curext());
//////////////////////////////////////////////////////////////7
LedgerPurchaseInvoice_LedgerJournalTrans.parmAmountCurCredit(234.34);
LedgerPurchaseInvoice_LedgerJournalTrans.parmDocumentDate(today());
dimensionAttributeValues = new AfStronglyTypedDataContainerList(#AifDimensionAttributeValue);
dimensionAttributeValue = dimensionAttributeValues.addNew();
dimensionAttributeValue.parmName("Sucursal");
dimensionAttributeValue.parmValue("QRO");
dimensionAttributeValue = dimensionAttributeValues.addNew();
dimensionAttributeValue.parmName("División");
dimensionAttributeValue.parmValue("ABINSA");
dimensionAttributeValue = dimensionAttributeValues.addNew();
dimensionAttributeValue.parmName("CentroCosto");
dimensionAttributeValue.parmValue("GTOB");
AifDimensionAttributeValueSet.parmValues(dimensionAttributeValues);
LedgerPurchaseInvoice_LedgerJournalTrans.parmDefaultDimension(AifDimensionAttributeValueSet);
// LedgerInAccountStatementFI_BASIC::createDefaultDimension(["QRO","ABINSA","GTOB"])
LedgerPurchaseInvoice_LedgerJournalTrans.parmCompany(curext());
LedgerPurchaseInvoice_LedgerJournalTrans.parmInvoice("0001");
LedgerPurchaseInvoice.createLedgerJournalTable().add(LedgerPurchaseInvoice_LedgerJournalTable);
LedgerPurchaseInvoiceService.create(LedgerPurchaseInvoice);
miércoles, 2 de noviembre de 2011
Leer Puerto Serial
client static real SacarPesoBascula(str puerto)
{
System.IO.Ports.SerialPort test = new System.IO.Ports.SerialPort();
str dataBack;
int rei=10;
int i=0;
;
try
{
test.set_PortName(puerto);
test.set_BaudRate(1200);
test.set_Parity(System.IO.Ports.Parity::None);
test.set_DataBits(8);
//test.set
test.Open();
test.WriteLine("$");
for(i=0;i<=10;i++)
{
sleep(1000);
dataBack = test.ReadExisting();
if(dataBack!="")
{
break;
}
sleep(1000);
}
test.Close();
return str2num(dataBack);
}
catch
{
info("error");
return 0;
}
return 0;
}
{
System.IO.Ports.SerialPort test = new System.IO.Ports.SerialPort();
str dataBack;
int rei=10;
int i=0;
;
try
{
test.set_PortName(puerto);
test.set_BaudRate(1200);
test.set_Parity(System.IO.Ports.Parity::None);
test.set_DataBits(8);
//test.set
test.Open();
test.WriteLine("$");
for(i=0;i<=10;i++)
{
sleep(1000);
dataBack = test.ReadExisting();
if(dataBack!="")
{
break;
}
sleep(1000);
}
test.Close();
return str2num(dataBack);
}
catch
{
info("error");
return 0;
}
return 0;
}
Suscribirse a:
Entradas (Atom)