PHP код:
static void ip_vkul_testado(Args _args)
{
#CCADO
CCADOConnection cn = new CCADOConnection() ;
CCADORecordset adoRecordset = new CCADORecordset();
InventTable inventTable;
DKL_InventTable dklinventTable;
DKL_BaseRetailPrices baseprice;
DKL_InventClassVarTable invclass;
VendTable vendor;
CustTable cust;
DKL_BrandTable brand;
InventLocation sklad;
str descr;
int KATEGORIAKOD,GRUPPAKOD,PODGRUPPAKOD,countrec,recCnt,skltype;
real maksskidka,koefret;
int bool,bool2,i,vendorid;
Map invClassId = new map(Types::String, Types::Integer);
SysOperationProgress progr = new SysOperationProgress();
;
cn = new CCADOConnection();
select count(recid) from invclass;
select count(recid) from vendor;
select count(recid) from cust;
select count(recid) from brand;
select count(recid) from inventTable;
select count(recid) from dklinventTable;
select count(recid) from baseprice;
recCnt = invclass.RecId + vendor.RecId + cust.RecId + brand.RecId + inventTable.RecId + dklinventTable.RecId + baseprice.RecId;
cn.open("Provider=MSDASQL.1;Persist Security Info=False;User ID=sysdba;Data Source=iptmp");
/*
progr.setTotal(recCnt);
progr.setCaption('?????????????');
//?????????????
while select invclass
{
progr.incCount();
invClassId.insert(invClass.InventClassVarId,invClass.RecId);
descr = strdel(invclass.Description,55,200);
maksskidka = invclass.DiscLimit / 100;
koefret = invclass.RetailPricePctKoeff / 100;
if (invclass.LMA_LevelNum == 1)
{
adoRecordset = new CCADORecordset();
adoRecordset.open(strfmt("select id from z_kategoria where id = %1",CNN::quoted(invclass.RecId)),cn, #adOpenForwardOnly, #adLockReadOnly);
if (adoRecordset.EOF())
cn.execute(strfmt("INSERT INTO Z_KATEGORIA (KATEGORIA,ID,KOEFPRODAJ,MAKSSKIDKA) VALUES (%1,%2,%3,%4)",CNN::quoted(Descr),CNN::quoted(invclass.RecId),CNN::quoted(koefret),CNN::quoted(maksskidka)));
else
cn.execute(strfmt("UPDATE Z_KATEGORIA SET KATEGORIA=%1,KOEFPRODAJ=%3,MAKSSKIDKA=%4 WHERE ID = %2",CNN::quoted(Descr),CNN::quoted(invclass.RecId),CNN::quoted(koefret),CNN::quoted(maksskidka)));
adoRecordset.close();
}
if (invclass.LMA_LevelNum == 2)
{
adoRecordset = new CCADORecordset();
adoRecordset.open(strfmt("select id from Z_GRUPPA where id = %1",CNN::quoted(invclass.RecId)),cn, #adOpenForwardOnly, #adLockReadOnly);
if (adoRecordset.EOF())
cn.execute(strfmt("INSERT INTO Z_GRUPPA (GRUPPA,ID,KOEFPRODAJ,MAKSSKIDKA) VALUES (%1,%2,%3,%4)",CNN::quoted(Descr),CNN::quoted(invclass.RecId),CNN::quoted(koefret),CNN::quoted(maksskidka)));
else
cn.execute(strfmt("UPDATE Z_GRUPPA SET GRUPPA=%1,KOEFPRODAJ=%3,MAKSSKIDKA=%4 WHERE ID = %2",CNN::quoted(Descr),CNN::quoted(invclass.RecId),CNN::quoted(koefret),CNN::quoted(maksskidka)));
adoRecordset.close();
}
if (invclass.LMA_LevelNum == 3)
{
adoRecordset = new CCADORecordset();
adoRecordset.open(strfmt("select id from Z_PODGRUPPA where id = %1",CNN::quoted(invclass.RecId)),cn, #adOpenForwardOnly, #adLockReadOnly);
if (adoRecordset.EOF())
cn.execute(strfmt("INSERT INTO Z_PODGRUPPA (PODGRUPPA,ID,KOEFPRODAJ,MAKSSKIDKA) VALUES (%1,%2,%3,%4)",CNN::quoted(Descr),CNN::quoted(invclass.RecId),CNN::quoted(koefret),CNN::quoted(maksskidka)));
else
cn.execute(strfmt("UPDATE Z_PODGRUPPA SET PODGRUPPA=%1,KOEFPRODAJ=%3,MAKSSKIDKA=%4 WHERE ID = %2",CNN::quoted(Descr),CNN::quoted(invclass.RecId),CNN::quoted(koefret),CNN::quoted(maksskidka)));
adoRecordset.close();
}
}
progr.setCaption('??????????');
//??????????
while select vendor