Ограничение скидки в кассире
Материал из wiki.standart-n.ru
Вставить текст в тмс кассира "После сканирования ШК":
uses Graphics, Controls, Forms, Dialogs, StdCtrls, ComCtrls, ExtCtrls, ibquery, DB, ChequeList, FR, ScriptRes, Barcode,ZKassa, StrUtils, Windows, Classes, StrUtils, System,SysUtils, IBDataBase, Buttons; var iq: tibquery; i,j: Integer; procedure SetDsc; begin iq := tibquery.create(nil); iq.transaction := CreateRT(CurrDB); iq.transaction.starttransaction; for i := 0 to chequelist.count - 1 do for j := 0 to chequelist[i].count - 1 do begin chequelist[i].p_index := j; iq.active := False; iq.sql.text := 'select 100*iif(price_o=0,1,(price-price_o)/price_o) as nac from parts where id='+ inttostr(chequelist[i].P_id); iq.active := True; if (chequelist[i].P_DscPrc<-3) and (iq.FieldByName('nac').asFloat<=20) then chequelist[i].P_SetDiscount(-chequelist[i].P_Price * chequelist[i].P_Quant*0.03); end; iq.Free; end; begin SetDsc end;
Строки
iq.sql.text := 'select 100*iif(price_o=0,1,(price-price_o)/price_o) as nac from parts where id='+ inttostr(chequelist[i].P_id);
и
if (chequelist[i].P_DscPrc<-3) and (iq.FieldByName('nac').asFloat<=20) then chequelist[i].P_SetDiscount(-chequelist[i].P_Price * chequelist[i].P_Quant*0.03);
меняем в зависимости от пожеланий клиента