void MostrarInfoOV()
{
;
info("OV"+' '+SalesTable.SalesId,' ',SysInfoAction_TableField::newBuffer(SalesTable));
}
miércoles, 26 de febrero de 2014
Ax 2012 Crear Orden de Venta con precios manuales
//////encabezado
NumberSeq NumberSeq;
SalesId sid;
;
NumberSeq =NumberSeq::newGetNum(SalesParameters::numRefSalesId() , true);
NumberSeq.used();
sid=NumberSeq.num();
salesTable.SalesId = sid;
salesTable.initValue();
salesTable.CustAccount = CustTable.AccountNum;
salesTable.initFromCustTable();
salesTable.CurrencyCode = CurrencyCode;
if (!salesTable.validateWrite())
{
throw Exception::Error;
}
salesTable.insert();
///lineas
salesLine.clear();
salesLine.SalesId =salesTable.SalesId;
salesLine.ItemId =GsRemSalesLineTmp.ItemId;
salesLine.initName();
salesLine.initFromItemOrCategory(salesLine.ItemId, salesLine.SalesCategory, salesLine.Name);
salesLine.initFromSalesTable(salesTable);
salesLine.SalesQty =GsRemSalesLineTmp.SalesQty;
salesLine.SalesPrice =GsRemSalesLineTmp.SalesPrice;
salesLine.SalesUnit =GsRemSalesLineTmp.SalesUnit;
salesLine.CurrencyCode =GsRemSalesLineTmp.CurrencyCode;
salesLine.LineAmount =salesLine.calcLineAmountForced();
salesLine.setPriceDiscChangePolicy(PriceDiscSystemSource::ManualEntry);
salesLine.createLine(true, true, false, true, true, false);
///lo que esta es rojo es el tip
NumberSeq NumberSeq;
SalesId sid;
;
NumberSeq =NumberSeq::newGetNum(SalesParameters::numRefSalesId() , true);
NumberSeq.used();
sid=NumberSeq.num();
salesTable.SalesId = sid;
salesTable.initValue();
salesTable.CustAccount = CustTable.AccountNum;
salesTable.initFromCustTable();
salesTable.CurrencyCode = CurrencyCode;
if (!salesTable.validateWrite())
{
throw Exception::Error;
}
salesTable.insert();
///lineas
salesLine.clear();
salesLine.SalesId =salesTable.SalesId;
salesLine.ItemId =GsRemSalesLineTmp.ItemId;
salesLine.initName();
salesLine.initFromItemOrCategory(salesLine.ItemId, salesLine.SalesCategory, salesLine.Name);
salesLine.initFromSalesTable(salesTable);
salesLine.SalesQty =GsRemSalesLineTmp.SalesQty;
salesLine.SalesPrice =GsRemSalesLineTmp.SalesPrice;
salesLine.SalesUnit =GsRemSalesLineTmp.SalesUnit;
salesLine.CurrencyCode =GsRemSalesLineTmp.CurrencyCode;
salesLine.LineAmount =salesLine.calcLineAmountForced();
salesLine.setPriceDiscChangePolicy(PriceDiscSystemSource::ManualEntry);
salesLine.createLine(true, true, false, true, true, false);
///lo que esta es rojo es el tip
miércoles, 19 de febrero de 2014
Ax 2012 Obtener impuesto de una linea
Tax::calcTaxAmount(this.TaxGroup,
this.TaxItemGroup,
this.InvoiceDate,
this.CurrencyCode,
this.LineAmount,
TaxModuleType::Sales,
this.Qty,
this.SalesUnit,
this.ItemId,
TaxDirection::OutgoingTax);
this.TaxItemGroup,
this.InvoiceDate,
this.CurrencyCode,
this.LineAmount,
TaxModuleType::Sales,
this.Qty,
this.SalesUnit,
this.ItemId,
TaxDirection::OutgoingTax);
jueves, 6 de febrero de 2014
Ax 2012 Copiar Cliente
static server void CopiarCliente(CustTable _CustTable)
{
CustTable newCusttable;
DirPartyTable DirPartyTable;
DirPartyPostalAddressView DirPartyPostalAddressView;
DirPartyPostalAddressView DirPartyPostalAddressViewNew;
LogisticsPostalAddressView LogisticsPostalAddressView;
#define.F('F')
#define.R('R')
DirParty DirParty;
DirParty DirPartyOld;
DirPartyContactInfoView DirPartyContactInfoView;
DirPartyContactInfoView DirPartyContactInfoViewNew;
LogisticsElectronicAddress LogisticsElectronicAddress;
;
if(_CustTable)
{
try
{
ttsBegin;
newCusttable.clear();
newCusttable.data(_CustTable);
newCusttable.Party =0;
newCusttable.initFromCustGroup(CustGroup::find(_CustTable.CustGroup));
newCusttable.AccountNum =strReplace(_CustTable.AccountNum,#F,#R) ;
newCusttable.insert();
///////
DirParty =DirParty::constructFromPartyRecId(newCusttable.Party);
DirPartyOld =DirParty::constructFromPartyRecId(_CustTable.Party);
//////Agregar nombre
DirPartyTable =DirPartyTable::findRec(newCusttable.Party,true);
DirPartyTable.initFromDirParty(DirPartyOld);
ttsBegin;
DirPartyTable.update();
ttsCommit;
///agregar direcciones
while select * from DirPartyPostalAddressView
where DirPartyPostalAddressView.Party==_CustTable.Party
{
///inicializar la vista con la direccion
LogisticsPostalAddressView.initFromPartyPostalAddressView(DirPartyPostalAddressView);
///inicializar la direccion
DirPartyPostalAddressViewNew.initFromPostalAddressView(LogisticsPostalAddressView);
//insertar la direccion
DirParty.createOrUpdatePostalAddress(DirPartyPostalAddressViewNew);
}
DirParty =DirParty::constructFromPartyRecId(newCusttable.Party);
///agregar Contacto
while select * from DirPartyContactInfoView
where DirPartyContactInfoView.Party==_CustTable.Party
{
///inicializar la vista con la direccion
LogisticsElectronicAddress=LogisticsElectronicAddress::findRecId(DirPartyContactInfoView.ElectronicAddress);
DirPartyContactInfoViewNew.Locator = LogisticsElectronicAddress.Locator;
DirPartyContactInfoViewNew.Type = LogisticsElectronicAddress.Type;
DirPartyContactInfoViewNew.LocatorExtension = LogisticsElectronicAddress.LocatorExtension;
DirPartyContactInfoViewNew.CountryRegionCode = LogisticsElectronicAddress.CountryRegionCode;
DirPartyContactInfoViewNew.IsPrimary = LogisticsElectronicAddress.IsPrimary;
DirPartyContactInfoViewNew.IsPrivate = LogisticsElectronicAddress.IsPrivate;
DirPartyContactInfoViewNew.IsMobilePhone = LogisticsElectronicAddress.IsMobilePhone;
DirPartyContactInfoViewNew.IsInstantMessage = LogisticsElectronicAddress.IsInstantMessage;
//DirPartyContactInfoViewNew.LocationName = LogisticsElectronicAddress.LocationName;
//LogisticsElectronicAddress =LogisticsElectronicAddress::findRecId(DirPartyContactInfoView.ElectronicAddress);
//DirPartyContactInfoViewNew.initFromElectronicAddress(LogisticsElectronicAddress);
//insertar la direccion
DirParty.createOrUpdateContactInfo(DirPartyContactInfoViewNew);
}
ttsCommit;
}
catch
{
throw(error("Error"));
}
}
}
{
CustTable newCusttable;
DirPartyTable DirPartyTable;
DirPartyPostalAddressView DirPartyPostalAddressView;
DirPartyPostalAddressView DirPartyPostalAddressViewNew;
LogisticsPostalAddressView LogisticsPostalAddressView;
#define.F('F')
#define.R('R')
DirParty DirParty;
DirParty DirPartyOld;
DirPartyContactInfoView DirPartyContactInfoView;
DirPartyContactInfoView DirPartyContactInfoViewNew;
LogisticsElectronicAddress LogisticsElectronicAddress;
;
if(_CustTable)
{
try
{
ttsBegin;
newCusttable.clear();
newCusttable.data(_CustTable);
newCusttable.Party =0;
newCusttable.initFromCustGroup(CustGroup::find(_CustTable.CustGroup));
newCusttable.AccountNum =strReplace(_CustTable.AccountNum,#F,#R) ;
newCusttable.insert();
///////
DirParty =DirParty::constructFromPartyRecId(newCusttable.Party);
DirPartyOld =DirParty::constructFromPartyRecId(_CustTable.Party);
//////Agregar nombre
DirPartyTable =DirPartyTable::findRec(newCusttable.Party,true);
DirPartyTable.initFromDirParty(DirPartyOld);
ttsBegin;
DirPartyTable.update();
ttsCommit;
///agregar direcciones
while select * from DirPartyPostalAddressView
where DirPartyPostalAddressView.Party==_CustTable.Party
{
///inicializar la vista con la direccion
LogisticsPostalAddressView.initFromPartyPostalAddressView(DirPartyPostalAddressView);
///inicializar la direccion
DirPartyPostalAddressViewNew.initFromPostalAddressView(LogisticsPostalAddressView);
//insertar la direccion
DirParty.createOrUpdatePostalAddress(DirPartyPostalAddressViewNew);
}
DirParty =DirParty::constructFromPartyRecId(newCusttable.Party);
///agregar Contacto
while select * from DirPartyContactInfoView
where DirPartyContactInfoView.Party==_CustTable.Party
{
///inicializar la vista con la direccion
LogisticsElectronicAddress=LogisticsElectronicAddress::findRecId(DirPartyContactInfoView.ElectronicAddress);
DirPartyContactInfoViewNew.Locator = LogisticsElectronicAddress.Locator;
DirPartyContactInfoViewNew.Type = LogisticsElectronicAddress.Type;
DirPartyContactInfoViewNew.LocatorExtension = LogisticsElectronicAddress.LocatorExtension;
DirPartyContactInfoViewNew.CountryRegionCode = LogisticsElectronicAddress.CountryRegionCode;
DirPartyContactInfoViewNew.IsPrimary = LogisticsElectronicAddress.IsPrimary;
DirPartyContactInfoViewNew.IsPrivate = LogisticsElectronicAddress.IsPrivate;
DirPartyContactInfoViewNew.IsMobilePhone = LogisticsElectronicAddress.IsMobilePhone;
DirPartyContactInfoViewNew.IsInstantMessage = LogisticsElectronicAddress.IsInstantMessage;
//DirPartyContactInfoViewNew.LocationName = LogisticsElectronicAddress.LocationName;
//LogisticsElectronicAddress =LogisticsElectronicAddress::findRecId(DirPartyContactInfoView.ElectronicAddress);
//DirPartyContactInfoViewNew.initFromElectronicAddress(LogisticsElectronicAddress);
//insertar la direccion
DirParty.createOrUpdateContactInfo(DirPartyContactInfoViewNew);
}
ttsCommit;
}
catch
{
throw(error("Error"));
}
}
}
Suscribirse a:
Entradas (Atom)