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;
}
viernes, 21 de octubre de 2011
Crear Producto Ax 2012
EcoResProductService erProdSvc;
EcoResEcoResProduct EcoResProd;
EcoResEcoResProduct_Product_Master ProdMast;
EcoResEcoResProduct_Translation Transalation;
EcoResEcoResProduct_Identifier Identifiers;
EcoResEcoResProduct_ProductDimGroup prodDimGroup;
;
erProdSvc=EcoResProductService::construct();
EcoResProd=new EcoResEcoResProduct();
ProdMast=new EcoResEcoResProduct_Product_Master();
ProdMast.parmDisplayProductNumber("A3");
ProdMast.parmProductType(EcoResProductType::Item);
ProdMast.parmSearchName("A3 name");
Transalation=ProdMast.createTranslation().addNew();
Transalation.parmDescription("A3 name");
Transalation.parmLanguageId("ES-MX");
Transalation.parmName("A3 name");
Identifiers=ProdMast.createIdentifier().addNew();
Identifiers.parmProductNumber("A3");
prodDimGroup=ProdMast.createProductDimGroup().addNew();
prodDimGroup.parmProduct("A3");
prodDimGroup.parmProductDimensionGroup("Con-Dim");
ProdMast.parmVariantConfigurationTechnology(EcoResVariantConfigurationTechnologyType::PredefinedVariants);
EcoResProd.createProduct().add(ProdMast);
erProdSvc.create(EcoResProd);
EcoResEcoResProduct EcoResProd;
EcoResEcoResProduct_Product_Master ProdMast;
EcoResEcoResProduct_Translation Transalation;
EcoResEcoResProduct_Identifier Identifiers;
EcoResEcoResProduct_ProductDimGroup prodDimGroup;
;
erProdSvc=EcoResProductService::construct();
EcoResProd=new EcoResEcoResProduct();
ProdMast=new EcoResEcoResProduct_Product_Master();
ProdMast.parmDisplayProductNumber("A3");
ProdMast.parmProductType(EcoResProductType::Item);
ProdMast.parmSearchName("A3 name");
Transalation=ProdMast.createTranslation().addNew();
Transalation.parmDescription("A3 name");
Transalation.parmLanguageId("ES-MX");
Transalation.parmName("A3 name");
Identifiers=ProdMast.createIdentifier().addNew();
Identifiers.parmProductNumber("A3");
prodDimGroup=ProdMast.createProductDimGroup().addNew();
prodDimGroup.parmProduct("A3");
prodDimGroup.parmProductDimensionGroup("Con-Dim");
ProdMast.parmVariantConfigurationTechnology(EcoResVariantConfigurationTechnologyType::PredefinedVariants);
EcoResProd.createProduct().add(ProdMast);
erProdSvc.create(EcoResProd);
jueves, 22 de septiembre de 2011
Abrir una pantalla en ax
Args args;
FormRun formRun;
;
args = new Args();
args.name(formStr(custtable));
args.caller();
// args.record(_buffer); //si se va a pasar un registro
formRun = classfactory.formRunClass(args);
formRun.init();
formRun.run();
formRun.wait();
FormRun formRun;
;
args = new Args();
args.name(formStr(custtable));
args.caller();
// args.record(_buffer); //si se va a pasar un registro
formRun = classfactory.formRunClass(args);
formRun.init();
formRun.run();
formRun.wait();
miércoles, 14 de septiembre de 2011
Mostrar un objeto del aot Resource
display Bitmap myBitmap()
{
ResourceNode resourceNode;
Container nodeData;
;
resourceNode = SysResource::getResourceNode(resourceStr(resourceobjectnameAOT));
resourceNode.AOTload();
nodeData = SysResource::getResourceNodeData(resourceNode);
return nodeData;
}
{
ResourceNode resourceNode;
Container nodeData;
;
resourceNode = SysResource::getResourceNode(resourceStr(resourceobjectnameAOT));
resourceNode.AOTload();
nodeData = SysResource::getResourceNodeData(resourceNode);
return nodeData;
}
martes, 6 de septiembre de 2011
Otro ejemplo mas completo que hice, estuvo complicado pero ya esta, sobre las combinaciones finacneras Ax 2012
public static DimensionDynamicAccount CrearCombinacion(DimensionDisplayValue _DimensionDisplayValue)
{
DimensionStorage DimensionStorage;
DimensionAttributeValue dimAttributeValue;
DimensionStorageSegment DimensionStorageSegment;
MainAccount MainAccount;
recid dimHierarchyId;
recid mainAccountRecId;
DimensionValue _DimensionValue;
container cont;
int i;
container dimensiones=["MainAccount","División","Sucursal","CentroCosto"];
;
cont=str2con(_DimensionDisplayValue,"-");
////declarar el objecto
DimensionStorage=DimensionStorage::construct(0,LedgerDimensionType::Account);
for(i=1;i<=conLen(cont);i++)
{
try
{
_DimensionValue=conPeek(cont,i);
if(i==1)
{
dimAttributeValue = DimensionAttributeValue::findByDimensionAttributeAndValueNoError(
DimensionAttribute::findByName(conPeek(dimensiones,i)),
_DimensionValue,
false,
true);
mainAccountRecId= DimensionAttributeValue::find(dimAttributeValue.RecId).EntityInstance;
dimHierarchyId = DimensionHierarchy::getAccountStructure(mainAccountRecId);
DimensionStorage.addHierarchy(dimHierarchyId);
DimensionStorageSegment=DimensionStorageSegment::constructFromValue(dimAttributeValue.CachedDisplayValue,dimAttributeValue);
DimensionStorage.setSegment(i,DimensionStorageSegment);
}
else
{
if(_DimensionValue!="")
{
dimAttributeValue = DimensionAttributeValue::findByDimensionAttributeAndValueNoError(
DimensionAttribute::findByName(conPeek(dimensiones,i)),
_DimensionValue,
false,
true);
DimensionStorageSegment=DimensionStorageSegment::constructFromValue(dimAttributeValue.CachedDisplayValue,dimAttributeValue);
DimensionStorage.setSegment(i,DimensionStorageSegment);
}
else
{
DimensionStorageSegment=DimensionStorageSegment::emptySegment();
DimensionStorage.setSegment(i,DimensionStorageSegment);
}
}
}
catch
{
return 0;
}
}
return DimensionStorage.save();
}
{
DimensionStorage DimensionStorage;
DimensionAttributeValue dimAttributeValue;
DimensionStorageSegment DimensionStorageSegment;
MainAccount MainAccount;
recid dimHierarchyId;
recid mainAccountRecId;
DimensionValue _DimensionValue;
container cont;
int i;
container dimensiones=["MainAccount","División","Sucursal","CentroCosto"];
;
cont=str2con(_DimensionDisplayValue,"-");
////declarar el objecto
DimensionStorage=DimensionStorage::construct(0,LedgerDimensionType::Account);
for(i=1;i<=conLen(cont);i++)
{
try
{
_DimensionValue=conPeek(cont,i);
if(i==1)
{
dimAttributeValue = DimensionAttributeValue::findByDimensionAttributeAndValueNoError(
DimensionAttribute::findByName(conPeek(dimensiones,i)),
_DimensionValue,
false,
true);
mainAccountRecId= DimensionAttributeValue::find(dimAttributeValue.RecId).EntityInstance;
dimHierarchyId = DimensionHierarchy::getAccountStructure(mainAccountRecId);
DimensionStorage.addHierarchy(dimHierarchyId);
DimensionStorageSegment=DimensionStorageSegment::constructFromValue(dimAttributeValue.CachedDisplayValue,dimAttributeValue);
DimensionStorage.setSegment(i,DimensionStorageSegment);
}
else
{
if(_DimensionValue!="")
{
dimAttributeValue = DimensionAttributeValue::findByDimensionAttributeAndValueNoError(
DimensionAttribute::findByName(conPeek(dimensiones,i)),
_DimensionValue,
false,
true);
DimensionStorageSegment=DimensionStorageSegment::constructFromValue(dimAttributeValue.CachedDisplayValue,dimAttributeValue);
DimensionStorage.setSegment(i,DimensionStorageSegment);
}
else
{
DimensionStorageSegment=DimensionStorageSegment::emptySegment();
DimensionStorage.setSegment(i,DimensionStorageSegment);
}
}
}
catch
{
return 0;
}
}
return DimensionStorage.save();
}
lunes, 5 de septiembre de 2011
Pequeño ejemplo de sacar el recid de la combinacion de las dimenciones fincancieras AX 2012
DimensionStorage DimensionStorage;
DimensionAttributeValue dimAttributeValue;
DimensionStorageSegment DimensionStorageSegment;
;
DimensionStorage=DimensionStorage::construct(0,LedgerDimensionType::Account);
//DimensionAttributeValue::findByDimensionAttributeAndValueNoError(
dimAttributeValue = DimensionAttributeValue::findByDimensionAttributeAndValueNoError(
DimensionAttribute::find(5637144840),
"180300",
false,
true);
DimensionStorage.addHierarchy(DimensionHierarchy::find(5637146169).RecId);
DimensionStorageSegment=DimensionStorageSegment::constructFromValue(dimAttributeValue.CachedDisplayValue,dimAttributeValue);
DimensionStorage.setSegment(1,DimensionStorageSegment);
info(int642str(DimensionStorage.save()));
DimensionAttributeValue dimAttributeValue;
DimensionStorageSegment DimensionStorageSegment;
;
DimensionStorage=DimensionStorage::construct(0,LedgerDimensionType::Account);
//DimensionAttributeValue::findByDimensionAttributeAndValueNoError(
dimAttributeValue = DimensionAttributeValue::findByDimensionAttributeAndValueNoError(
DimensionAttribute::find(5637144840),
"180300",
false,
true);
DimensionStorage.addHierarchy(DimensionHierarchy::find(5637146169).RecId);
DimensionStorageSegment=DimensionStorageSegment::constructFromValue(dimAttributeValue.CachedDisplayValue,dimAttributeValue);
DimensionStorage.setSegment(1,DimensionStorageSegment);
info(int642str(DimensionStorage.save()));
jueves, 4 de agosto de 2011
Recorrer los registros seleccionados de un grid
static server void RegorrerGrid(FormDataSource _fds_custtable)
{
custtable buffer2;
;
for(buffer2 = _fds_custtable.getFirst(true) ? _fds_custtable.getFirst(true) : _fds_custtable.cursor();
buffer2;
buffer2 = _fds_custtable.getnext())
{
info(buffer2.AccountNum);
}
}
{
custtable buffer2;
;
for(buffer2 = _fds_custtable.getFirst(true) ? _fds_custtable.getFirst(true) : _fds_custtable.cursor();
buffer2;
buffer2 = _fds_custtable.getnext())
{
info(buffer2.AccountNum);
}
}
miércoles, 3 de agosto de 2011
Crear Calidades en una ruta y abrir su respectiva pantalla ax 2009
void crear_calidad(ProdJournalRoute ProdJournalRoute )
{
InventQualityOrderTable InventQualityOrderTable;
ProdTable ProdTable;
//ProdJournalRoute ProdJournalRoute;
FormDataSource fds;
NumberSequenceCode NumberSequenceCode;
NumberSeq NumberSeq;
TubOperPruebas TubOperPruebas;
NumberSeqFormHandler NumberSeqFormHandler;//=NumberSeqFormHandler::construct();
Args args;
FormRun formRun;
;
ttsbegin;
NumberSeq=NumberSeq::newGetNum( NumberSeqReference::findReference(typeId2ExtendedTypeId(typeid(InventQualityOrderId))));
ProdTable=ProdJournalRoute.prodTable();
InventQualityOrderTable.initValue();
InventQualityOrderTable.initFromProdTable(ProdTable);
InventQualityOrderTable.initFromReferenceBuffer(ProdJournalRoute.prodRoute());
InventQualityOrderTable.QualityOrderId=NumberSeq.num();
InventQualityOrderTable.Qty=ProdJournalRoute.QtyGood;
TubOperPruebas =TubOperPruebas::find(InventQualityOrderTable.RouteOprId);
if(!TubOperPruebas)
{
throw(InventQualityOrderTable.RouteOprId+" no encuentra grupo de test");
}
InventQualityOrderTable.TestGroupId=TubOperPruebas.TestGroupId;
InventQualityOrderTable.insert();
ttscommit;
/////////////////////abrir pantalla/////////////7
args = new Args();
args.name(formStr("InventQualityOrderTable")); //form SysBoxForm is used to show the message
formRun = classFactory.formRunClass(args); //creating a FormRun object
args.record(InventQualityOrderTable); // as argument is optional
formRun.init();
formRun.run();
formRun.wait(); //waiting for user action
///////////////////////////////////////
}
{
InventQualityOrderTable InventQualityOrderTable;
ProdTable ProdTable;
//ProdJournalRoute ProdJournalRoute;
FormDataSource fds;
NumberSequenceCode NumberSequenceCode;
NumberSeq NumberSeq;
TubOperPruebas TubOperPruebas;
NumberSeqFormHandler NumberSeqFormHandler;//=NumberSeqFormHandler::construct();
Args args;
FormRun formRun;
;
ttsbegin;
NumberSeq=NumberSeq::newGetNum( NumberSeqReference::findReference(typeId2ExtendedTypeId(typeid(InventQualityOrderId))));
ProdTable=ProdJournalRoute.prodTable();
InventQualityOrderTable.initValue();
InventQualityOrderTable.initFromProdTable(ProdTable);
InventQualityOrderTable.initFromReferenceBuffer(ProdJournalRoute.prodRoute());
InventQualityOrderTable.QualityOrderId=NumberSeq.num();
InventQualityOrderTable.Qty=ProdJournalRoute.QtyGood;
TubOperPruebas =TubOperPruebas::find(InventQualityOrderTable.RouteOprId);
if(!TubOperPruebas)
{
throw(InventQualityOrderTable.RouteOprId+" no encuentra grupo de test");
}
InventQualityOrderTable.TestGroupId=TubOperPruebas.TestGroupId;
InventQualityOrderTable.insert();
ttscommit;
/////////////////////abrir pantalla/////////////7
args = new Args();
args.name(formStr("InventQualityOrderTable")); //form SysBoxForm is used to show the message
formRun = classFactory.formRunClass(args); //creating a FormRun object
args.record(InventQualityOrderTable); // as argument is optional
formRun.init();
formRun.run();
formRun.wait(); //waiting for user action
///////////////////////////////////////
}
martes, 2 de agosto de 2011
Registrar Diario Contable
server static void registrar_pago_cobranza(journalId id_jou)
{
LedgerJournalCheckPost LedgerJCP;
;
LedgerJCP = LedgerJournalCheckPost::newLedgerJournalTable(LedgerJournalTable::find(id_jou),NoYes::Yes,NoYes::Yes);
LedgerJCP.run();
}
{
LedgerJournalCheckPost LedgerJCP;
;
LedgerJCP = LedgerJournalCheckPost::newLedgerJournalTable(LedgerJournalTable::find(id_jou),NoYes::Yes,NoYes::Yes);
LedgerJCP.run();
}
lunes, 1 de agosto de 2011
LookUp Programado Con Rango de fechas, query, tabla Temporal
server static void lookupResponsable(object cont,FormDataSource fdsf,date fecha_Inicio,date fecha_fin)
{
SysTableLookup myLookup =
SysTableLookup::newParameters(tablenum(SMAGSTempserviceObject),cont);
Query query = new Query(querystr(SMAServiceOrderTableLine));
QueryBuildDataSource qbds;
QueryBuildRange qbr;
str rangos;
SMAServiceOrderTable _SMAServiceOrderTable;
SMAServiceOrderLine _SMAServiceOrderLine;
queryrun qr;
SMAGSTempserviceObject _SMAGSTempserviceObject;
RecordInsertList _SMAGSTempserviceObjectList;
//tcDateTime fecha_ini_t;
//UtcDateTime fecha_fin_t;
;
rangos = strfmt("%1..%2",Date2StrXpp(fecha_Inicio)+" 12:00:00 am",Date2StrXpp(fecha_fin)+" 11:59:59 pm");
qbds = query.dataSourceTable(tablenum(SMAServiceOrderTable));
qbds.addRange(fieldnum(SMAServiceOrderTable,ServiceDateTime)).value(rangos);
qbds.addGroupByField(fieldnum(SMAServiceOrderTable,Responsible));
qr=new queryrun(query);
while(qr.next())
{
_SMAServiceOrderLine=qr.get(tablenum(SMAServiceOrderLine));
_SMAServiceOrderTable=qr.get(tablenum(SMAServiceOrderTable));
_SMAGSTempserviceObject.ServiceObjectId=_SMAServiceOrderTable.Responsible;
_SMAGSTempserviceObject.descripcion= _SMAServiceOrderTable.ServiceResponsibleName();
_SMAGSTempserviceObject.doInsert();
}
myLookup.addLookupField(fieldnum(SMAGSTempserviceObject,ServiceObjectId));
myLookup.addLookupField(fieldnum(SMAGSTempserviceObject,descripcion));
myLookup.parmTmpBuffer(_SMAGSTempserviceObject);
myLookup.performFormLookup();
}
{
SysTableLookup myLookup =
SysTableLookup::newParameters(tablenum(SMAGSTempserviceObject),cont);
Query query = new Query(querystr(SMAServiceOrderTableLine));
QueryBuildDataSource qbds;
QueryBuildRange qbr;
str rangos;
SMAServiceOrderTable _SMAServiceOrderTable;
SMAServiceOrderLine _SMAServiceOrderLine;
queryrun qr;
SMAGSTempserviceObject _SMAGSTempserviceObject;
RecordInsertList _SMAGSTempserviceObjectList;
//tcDateTime fecha_ini_t;
//UtcDateTime fecha_fin_t;
;
rangos = strfmt("%1..%2",Date2StrXpp(fecha_Inicio)+" 12:00:00 am",Date2StrXpp(fecha_fin)+" 11:59:59 pm");
qbds = query.dataSourceTable(tablenum(SMAServiceOrderTable));
qbds.addRange(fieldnum(SMAServiceOrderTable,ServiceDateTime)).value(rangos);
qbds.addGroupByField(fieldnum(SMAServiceOrderTable,Responsible));
qr=new queryrun(query);
while(qr.next())
{
_SMAServiceOrderLine=qr.get(tablenum(SMAServiceOrderLine));
_SMAServiceOrderTable=qr.get(tablenum(SMAServiceOrderTable));
_SMAGSTempserviceObject.ServiceObjectId=_SMAServiceOrderTable.Responsible;
_SMAGSTempserviceObject.descripcion= _SMAServiceOrderTable.ServiceResponsibleName();
_SMAGSTempserviceObject.doInsert();
}
myLookup.addLookupField(fieldnum(SMAGSTempserviceObject,ServiceObjectId));
myLookup.addLookupField(fieldnum(SMAGSTempserviceObject,descripcion));
myLookup.parmTmpBuffer(_SMAGSTempserviceObject);
myLookup.performFormLookup();
}
LookUp Programado Con Rango de fechas y query
server static void lookupOT(object cont,FormDataSource fds,date fecha_Inicio,date fecha_fin)
{
SysTableLookup myLookup =
SysTableLookup::newParameters(tablenum(SMAServiceOrderTable),cont);
Query query = new Query();
QueryBuildDataSource qbds;
QueryBuildRange qbr;
str rangos;
SMAServiceOrderTable _SMAServiceOrderTable;
;
rangos = strfmt("%1..%2",Date2StrXpp(fecha_Inicio)+" 12:00:00 am",Date2StrXpp(fecha_fin)+" 11:59:50 pm");
qbds = query.AddDataSource(tablenum(SMAServiceOrderTable));
qbds.addRange(fieldnum(SMAServiceOrderTable,ServiceDateTime)).value(rangos);
qbds.addGroupByField(fieldnum(SMAServiceOrderTable,Serviceorderid));
qbds.addGroupByField(fieldnum(SMAServiceOrderTable,Description));
myLookup.addLookupField(fieldnum(SMAServiceOrderTable,Serviceorderid));
myLookup.addLookupField(fieldnum(SMAServiceOrderTable,Description));
myLookup.parmQuery(query);
myLookup.performFormLookup();
}
{
SysTableLookup myLookup =
SysTableLookup::newParameters(tablenum(SMAServiceOrderTable),cont);
Query query = new Query();
QueryBuildDataSource qbds;
QueryBuildRange qbr;
str rangos;
SMAServiceOrderTable _SMAServiceOrderTable;
;
rangos = strfmt("%1..%2",Date2StrXpp(fecha_Inicio)+" 12:00:00 am",Date2StrXpp(fecha_fin)+" 11:59:50 pm");
qbds = query.AddDataSource(tablenum(SMAServiceOrderTable));
qbds.addRange(fieldnum(SMAServiceOrderTable,ServiceDateTime)).value(rangos);
qbds.addGroupByField(fieldnum(SMAServiceOrderTable,Serviceorderid));
qbds.addGroupByField(fieldnum(SMAServiceOrderTable,Description));
myLookup.addLookupField(fieldnum(SMAServiceOrderTable,Serviceorderid));
myLookup.addLookupField(fieldnum(SMAServiceOrderTable,Description));
myLookup.parmQuery(query);
myLookup.performFormLookup();
}
Registrar lineas de servicio
SMAServiceFunctionLine serviceFunction;
Args args;
SMAServiceOrderLine Buffer2;
;
//// selecciona varias lineas
while select * from Buffer2 where Buffer2.ServiceOrderId==ot.text()
&& Buffer2.ServiceOrderStatus==SMAServiceOrderStatus::Created
&& Buffer2.TransactionType==SMATransactionType::Item
&& Buffer2.SignOff==noyes::Yes
{
SMAServiceOrderLineSurtidas_ds.markRecord(buffer2,1);
}
args= new Args();
args.caller(element);
args.record(SMAServiceOrderLineSurtidas);
args.parmEnum(SMAServiceFunctionType::Transfer);
serviceFunction = SMAServiceFunctionLine::construct(args);
serviceFunction.initDefaults(args);
/// // if (serviceFunction.checkSetup() && serviceFunction.prompt() /////Con dialogo
if (serviceFunction.checkSetup() ) ///sin dialogo
{
serviceFunction.run();
}
Args args;
SMAServiceOrderLine Buffer2;
;
//// selecciona varias lineas
while select * from Buffer2 where Buffer2.ServiceOrderId==ot.text()
&& Buffer2.ServiceOrderStatus==SMAServiceOrderStatus::Created
&& Buffer2.TransactionType==SMATransactionType::Item
&& Buffer2.SignOff==noyes::Yes
{
SMAServiceOrderLineSurtidas_ds.markRecord(buffer2,1);
}
args= new Args();
args.caller(element);
args.record(SMAServiceOrderLineSurtidas);
args.parmEnum(SMAServiceFunctionType::Transfer);
serviceFunction = SMAServiceFunctionLine::construct(args);
serviceFunction.initDefaults(args);
/// // if (serviceFunction.checkSetup() && serviceFunction.prompt() /////Con dialogo
if (serviceFunction.checkSetup() ) ///sin dialogo
{
serviceFunction.run();
}
Mandar E-mail
static void EnviarMail(Args _args)
{
SysMailer mail;
;
///Inicializar objeto SysMailer
mail = new SysMailer();
mail.SMTPRelayServer("ServidorSMTP.com",25,"CuentaMail","ContraseñaMail");
mail.fromAddress("CuantaMail");
mail.tos().appendAddress("CuantaMailDestino");
// Construir mensaje
mail.htmlBody(strfmt("Mensaje"));
mail.subject(strfmt("Asunto"));
mail.attachments().add("Ruta del archivo a Adjuntar");
mail.sendMail();
}
{
SysMailer mail;
;
///Inicializar objeto SysMailer
mail = new SysMailer();
mail.SMTPRelayServer("ServidorSMTP.com",25,"CuentaMail","ContraseñaMail");
mail.fromAddress("CuantaMail");
mail.tos().appendAddress("CuantaMailDestino");
// Construir mensaje
mail.htmlBody(strfmt("Mensaje"));
mail.subject(strfmt("Asunto"));
mail.attachments().add("Ruta del archivo a Adjuntar");
mail.sendMail();
}
Suscribirse a:
Entradas (Atom)