procedure TVetriebsmitarbiterAbrechnung.SelectVpPartner;
var
von, bis, sEmonat,sEJahr:
String;
sVoNr,sStorno,sAirTime, szip, sname, sforename, saddress, stotal, scity:
String;
iStornoPercent, iAirTimePercent: Integer;
begin
sEmonat:=ComboBoxMonat.Text;
sEJahr:= EditJahr.Text;
von:= DBLookupComboBoxVoNrVon.Text;
bis:= DBLookupComboBoxVoNrBis.Text;
DMVPAP.ZEmployees.Close;
DMVPAP.ZEmployees.SQL.Text:= '
SELECT COUNT(*) AS total, employees.airtime_percet, employees.storno_percent,';
DMVPAP.ZEmployees.SQL.Add('
employees.air_time, employees.employee_storno, employees.vo_nr, employees.name,');
DMVPAP.ZEmployees.SQL.Add('
employees.forename, employees.address, employees.zip, employees.city');
DMVPAP.ZEmployees.SQL.Add('
FROM employees, orders');
DMVPAP.ZEmployees.SQL.Add('
WHERE');
DMVPAP.ZEmployees.SQL.Add('
MONTH(activation_date)="'+sEmonat+'
"');
DMVPAP.ZEmployees.SQL.Add('
AND YEAR(activation_date)="'+sEJahr+'
"');
DMVPAP.ZEmployees.SQL.Add('
AND employees.vo_nr');
DMVPAP.ZEmployees.SQL.Add('
BETWEEN "'+ von +'
"');
DMVPAP.ZEmployees.SQL.Add('
AND "'+bis+'
"');
DMVPAP.ZEmployees.SQL.Add('
AND orders.state = "aktiv"');
DMVPAP.ZEmployees.SQL.Add('
AND orders.vo_nr = employees.vo_nr');
DMVPAP.ZEmployees.SQL.Add('
GROUP BY orders.vo_nr');
DMVPAP.ZEmployees.Open;
while NOT DMVPAP.ZEmployees.Eof
do
begin
stotal:= DMVPAP.ZEmployees['
total'];
iAirTimePercent:= DMVPAP.ZEmployees['
airtime_percet'];
iStornoPercent:= DMVPAP.ZEmployees['
storno_percent'];
sAirTime:= DMVPAP.ZEmployees['
air_time'];
sStorno:= DMVPAP.ZEmployees['
employee_storno'];
sVoNr:= DMVPAP.ZEmployees['
vo_nr'];
sname:= DMVPAP.ZEmployees['
name'];
sforename:= DMVPAP.ZEmployees['
forename'];
saddress:= DMVPAP.ZEmployees['
address'];
szip:= DMVPAP.ZEmployees['
zip'];
scity:= DMVPAP.ZEmployees['
city'];
MemoAbrechung.Lines.Add('
query:'+ stotal+'
,'+szip+'
,'+sVoNr+'
+');
end;
end;