static void BIT_StrFind(Args _args)
{
str a, b, c, d;
int pos1, pos2, pos3;
;
a = ".000-10.00000280";
pos1 = strfind(a, '.', 1, strlen(a));
b = strdel(a,pos1, 1);
pos2 = strfind(b, '-', 1, strlen(b));
c = strdel(b, pos2, 1);
pos3 = strfind(c, '.', 1, strlen(c));
d = strdel(c, pos3, 1);
info(strfmt("%1", d));
}
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;
TaxItemGroupHeading _TaxItemGroupHeading;
TaxOnItem _TaxOnItem;
;
_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;
if(_PurchLine.TaxItemGroup == _purchline.TaxGroup)
{
_TaxItemGroupHeading = TaxItemGroupHeading::find(_purchline.TaxItemGroup);
Select _TaxOnItem where _TaxOnItem.TaxItemGroup == _TaxItemGroupHeading.TaxItemGroup;
switch (_PurchLine.TaxItemGroup)
{
case "PPN 10%":
PPN_Lines += Amount * (_TaxOnItem.showTaxValue()/100);
break;
case "PPH 23":
PPH_Lines += Amount * (_TaxOnItem.showTaxValue()/100);
break;
}
}
else
{
PPN_Lines = 0;
PPH_Lines = 0;
}
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;
}
{
str a, b, c, d;
int pos1, pos2, pos3;
;
a = ".000-10.00000280";
pos1 = strfind(a, '.', 1, strlen(a));
b = strdel(a,pos1, 1);
pos2 = strfind(b, '-', 1, strlen(b));
c = strdel(b, pos2, 1);
pos3 = strfind(c, '.', 1, strlen(c));
d = strdel(c, pos3, 1);
info(strfmt("%1", d));
}
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;
TaxItemGroupHeading _TaxItemGroupHeading;
TaxOnItem _TaxOnItem;
;
_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;
if(_PurchLine.TaxItemGroup == _purchline.TaxGroup)
{
_TaxItemGroupHeading = TaxItemGroupHeading::find(_purchline.TaxItemGroup);
Select _TaxOnItem where _TaxOnItem.TaxItemGroup == _TaxItemGroupHeading.TaxItemGroup;
switch (_PurchLine.TaxItemGroup)
{
case "PPN 10%":
PPN_Lines += Amount * (_TaxOnItem.showTaxValue()/100);
break;
case "PPH 23":
PPH_Lines += Amount * (_TaxOnItem.showTaxValue()/100);
break;
}
}
else
{
PPN_Lines = 0;
PPH_Lines = 0;
}
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;
}
Its like you read my mind! You seem to know so much about this, like you wrote the book in it or something.
ReplyDeleteI think that you could do with some pics to drive the
message home a bit, but other than that, this is magnificent
blog. A fantastic read. I'll certainly be back.