ORKESTRA

ORKESTRA

  orkestra orkestra.com.tr
  Sohbet   İndirme Merkezi

E-Fatura Betik Kodları ( Orkestra Scripts )

2. Birim Eklemek için


String malzRef = line.getItemField("stockrefItemsLink.reference");

if (StringUtil.length(malzRef)>0){
Object sorguBirim = createSql("SELECT A.CONVFACT1,A.CONVFACT2,B.CODE FROM $SN$LG_$F$_ITMUNITA A LEFT OUTER JOIN $SN$LG_$F$_UNITSETL B ON A.UNITLINEREF=B.LOGICALREF WHERE A.ITEMREF="+malzRef+" AND A.UNITLINEREF="+line.getItemField("uomref"));
Object rowBirim = executeSql(sorguBirim);
if (rowBirim != null){
Console.println("Orj Birim : "+rowBirim.buildPairString(",",false));
Object digerBirim = createSql("SELECT A.CONVFACT1,A.CONVFACT2,B.CODE FROM $SN$LG_$F$_ITMUNITA A LEFT OUTER JOIN $SN$LG_$F$_UNITSETL B ON A.UNITLINEREF=B.LOGICALREF WHERE A.ITEMREF="+malzRef+" AND A.UNITLINEREF!="+line.getItemField("uomref"));
Object rowBirim2 = executeSql(digerBirim);
if (rowBirim2 != null){
BigDecimal a1 = rowBirim.getBigDecimal("CONVFACT1");
BigDecimal a2 = rowBirim.getBigDecimal("CONVFACT2");
BigDecimal b1 = rowBirim2.getBigDecimal("CONVFACT1");
BigDecimal b2 = rowBirim2.getBigDecimal("CONVFACT2");
BigDecimal sifir = MathUtil.bigDecimal(0);
BigDecimal miktar = MathUtil.bigDecimal(line.getItemField("amount"));
Console.println("Diğer Birim : "+rowBirim2.buildPairString(",",false));
if(a1>sifir && b1>sifir && a2>sifir && b2>sifir){
BigDecimal katsayi = b1.multiply(a2).divide(b2.multiply(a1),8,0);

BigDecimal hedefMiktar = miktar*katsayi;
Console.println("Miktar : "+MathUtil.format(miktar,"#,###.00"));
Console.println("Hedef : "+MathUtil.format(hedefMiktar,"#,###.00"));
Console.println("-----------------------------------------------------");
line.setIdentification("manufacturer",MathUtil.format(hedefMiktar,"#,###.##")+" "+rowBirim2.getString("CODE"));
}

}
}
}


String barkod = line.getBarcode(1);
if (StringUtil.length(barkod)>0){
line.appendNote(barkod);
}else{
line.insertNote("");
}

String mysql = "SELECT SPECODE FROM LG_$F$_$P$_STLINE WHERE LOGICALREF="+line.getItemField("reference");
Console.println("sql: "+ mysql);
Object row = executeSql(createSql(mysql));
if (row != null && StringUtil.length(row.getString("SPECODE"))>0){
Console.println("bulundu "+row.getString("SPECODE"));
//line.addNote(row.getString("SPECODE"));
line.setIdentification("buyer",row.getString("SPECODE"));
}