Convert Number to alphabet using x++ :
static
void Job22(Args _args)
{
str textTerbilang;
AmountMST nilaiAmount;
;
nilaiAmount = 1250;
textTerbilang = numeralsToTxt(nilaiAmount);
info(textTerbilang);
}
misal
:
// ADD BY TYO
AmountMST Terbilang;
TECcustVendTmpPaymProposalReport =
custVendTmpPaymProposalReport;
select sum(AmountMST) from
TECcustVendTmpPaymProposalReport;
custVendPaymProposalTmp.Terbilang =
Global::numeralsToTxt(abs(TECcustVendTmpPaymProposalReport.AmountMST)) + "
Indonesian rupiah #";
// END BY TYO
public
boolean fetch()
{
boolean ret = true;
Query _Query = new
Query(this.query());
QueryRun _QueryRun;
PurchTable _Purchtable;
PurchLine _PurchLine;
PurchReqTable _PurchReqTable;
VendTable _VendTable;
LogisticsElectronicAddress _LogisticsElectronicAddress;
PurchLineAllVersions _PurchLineAllVersions;
int inwordslength,
inwordslength2; //addbyDaniel
DimensionAttributeValueSetStorage class_dimStorage;
PurchLineAllVersions purchLineAllVersions;
;
_Query.dataSourceTable(tablenum(VendPurchOrderJour)).addRange(fieldNum(VendPurchOrderJour,
PurchId)).value(_getRecordVendPurchOrderJour.PurchId);
_Query.dataSourceTable(tableNum(VendPurchOrderJour)).addRange(fieldNum(VendPurchOrderJour,
PurchOrderDocNum)).value(_getRecordVendPurchOrderJour.PurchOrderDocNum);
_QueryRun = new QueryRun(_Query);
while(_QueryRun.next())
{
if(_QueryRun.changed(tableNum(VendPurchOrderJour)))
{
_getRecordVendPurchOrderJour =
_QueryRun.get(tableNum(VendPurchOrderJour));
No_PO =
_getRecordVendPurchOrderJour.PurchId;
Supplier_Code =
PurchTable::find(_getRecordVendPurchOrderJour.PurchId).OrderAccount;
Date_PO =
PurchTable::find(_getRecordVendPurchOrderJour.PurchId).DeliveryDate;
//Ref_No =
//Date_Ref =
_VendName =
VendTable::find(_getRecordVendPurchOrderJour.OrderAccount).name();
Address =
VendTable::find(_getRecordVendPurchOrderJour.OrderAccount).postalAddress().Address;
Contact =
VendTable::find(_getRecordVendPurchOrderJour.OrderAccount).ContactPerson().phone();
_Phone =
VendTable::find(_getRecordVendPurchOrderJour.OrderAccount).phone();
select _VendTable where
_VendTable.AccountNum ==
_getRecordVendPurchOrderJour.OrderAccount;
Contact = DirParty::primaryElectronicAddress(_VendTable.Party,
LogisticsElectronicAddressMethodType::Phone).Description;
Name_Ship_To = CompanyInfo::find().Name;
Address_Ship_To =
CompanyInfo::find().postalAddress().Address;
Contact_Ship_To =
DirParty::primaryElectronicAddress(CompanyInfo::find().RecId,
LogisticsElectronicAddressMethodType::Phone).Description;
Phone_Ship_To = CompanyInfo::find().phone();
_Purchtable = PurchTable::find(_getRecordVendPurchOrderJour.PurchId);
class_dimStorage=
DimensionAttributeValueSetStorage::find(_purchTable.DefaultDimension);
departmentID =
class_dimStorage.getDisplayValueByDimensionAttribute(DimensionAttribute::findByName('Department').RecId);
departmentName = (select Name from DimAttributeOMDepartment
where DimAttributeOMDepartment.value == departmentID).name;
payment =
PaymTerm::find(PurchTable::find(_getRecordVendPurchOrderJour.PurchId).Payment).Description;
//Kd_Buyer =
PurchTable::find(_getRecordVendPurchOrderJour.PurchId).ItemBuyerGroupId;
permission = new
InteropPermission(InteropKind::ClrInterop);
permission.assert();
Kd_Buyer = System.Environment::get_UserName();
Delivery =
PurchTable::find(_getRecordVendPurchOrderJour.PurchId).DlvMode;
Qty =
PurchLine::find(_getRecordVendPurchOrderJour.PurchId).PurchQty;
Price =
PurchLine::find(_getRecordVendPurchOrderJour.PurchId).PurchPrice;
SubTotal += Qty * Price;
Discount =
PurchLine::find(_getRecordVendPurchOrderJour.PurchId).DiscPercent / 100 *
SubTotal;
PPN = SubTotal/10;
Totalamount = SubTotal - Discount + PPN;
inwordslength = strLen(numeralsToTxt(TotalAmount));
inwordslength2 = inwordslength - 10;
Inwords2 = subStr(numeralsToTxt(TotalAmount), 1,
inwordslength2);
Inwords = strRem(Inwords2, "*");
Remarks =
ReasonTableRef::find(PurchTable::find(_getRecordVendPurchOrderJour.PurchId).ReasonTableRef).ReasonComment;
element.send(_getRecordVendPurchOrderJour);
}
if(_QueryRun.changed(tableNum(PurchLine)))
{
_PurchLine = _QueryRun.get(tableNum(PurchLine));
select _PurchReqTable where
_PurchReqTable.PurchReqId == _PurchLine.PurchReqId;
Indent_Date =
_PurchReqTable.TransDate;
Indent_No = _PurchLine.PurchReqId;
Description = _PurchLine.Name;
UOM =
_PurchLine.PurchUnit;
Quantity = _PurchLine.PurchQty;
Price =
_PurchLine.PurchPrice;
Amount =
_PurchLine.LineAmount;
Total_Value += Amount;
switch
(_PurchLine.TaxItemGroup)
{
case "PPN 10%":
PPN_Lines += Amount / 10;
break;
case "PPH":
PPH_Lines += Amount * 0.02;
break;
}
PPN = PPN_Lines;
PPH = PPH_Lines;
SubTotal = Quantity * Price;
Total += SubTotal;
Discount = _PurchLine.DiscPercent / 100 * Total;
Totalamount = Total - Discount + PPN + PPH;
inwordslength = strLen(numeralsToTxt(TotalAmount));
inwordslength2 = inwordslength - 10;
Inwords2 = subStr(numeralsToTxt(TotalAmount), 1,
inwordslength2);
Inwords = strRem(Inwords2, "*");
element.send(_PurchLine);
}
}
return ret;
}
0 comments:
Post a Comment