📄 jgbbztsh.pas
字号:
Ary0[i] := temp[32 + i];
result := DM.F_Zfgjjtjb_Save(Jtb_Ny, Ary, Ary0);
end;
procedure TFormJGBbZtsh.Getdata8;
var
Ary: array of double;
Xh, Dwmc, Xmmc, Lxspjg, Dkhth, Ffrq: string;
Dkqx, i: integer;
procedure SetCellD(const row: smallint; Ary: array of double);
begin
cell1.DoSetCellData(0, row, xh);
cell1.DoSetCellData(1, row, dwmc);
cell1.DoSetCellData(2, row, xmmc);
cell1.DoSetCellData(3, row, lxspjg);
cell1.DoSetCellData(4, row, dkhth);
cell1.DoSetCellData(5, row, Ary[0]);
cell1.DoSetCellData(6, row, Ary[1]);
cell1.DoSetCellData(7, row, Ffrq);
cell1.DoSetCellData(8, row, Dkqx);
cell1.DoSetCellData(9, row, Ary[2]);
cell1.DoSetCellData(10, row, Ary[3]);
cell1.DoSetCellData(11, row, Ary[4]);
cell1.DoSetCellData(12, row, Ary[5]);
cell1.DoSetCellData(13, row, Ary[6]);
end;
begin
setlength(Ary, 7);
with DM do
begin
P_Xmdkb(Jtb_Ny);
cds_LR.First;
i := 0;
while not cds_LR.Eof do
begin
Xh := trim(cds_LR.FieldByName('XH').AsString);
Dwmc := trim(cds_LR.FieldByName('DWMC').AsString);
Xmmc := trim(cds_LR.FieldByName('XMMC').AsString);
Lxspjg := trim(cds_LR.FieldByName('LXSPJG').AsString);
Dkhth := trim(cds_LR.FieldByName('DKHTH').AsString);
Ffrq := trim(cds_LR.FieldByName('FFRQ').AsString);
Dkqx := cds_LR.FieldByName('DKQX').AsInteger;
Ary[0] := cds_LR.FieldByName('DKJE').AsFloat;
Ary[1] := cds_LR.FieldByName('FFJE').AsFloat;
Ary[2] := cds_LR.FieldByName('DKLL').AsFloat;
Ary[3] := cds_LR.FieldByName('QCYE').AsFloat;
Ary[4] := cds_LR.FieldByName('BQHS').AsFloat;
Ary[5] := cds_LR.FieldByName('QMYE').AsFloat;
Ary[6] := cds_LR.FieldByName('QZYQ').AsFloat;
i := i + 1;
SetCellD(i + 3, Ary);
cds_LR.Next;
end;
cell1.DoSetFormula(5, 16, 'sum(F5:F16)');
cell1.DoSetFormula(6, 16, 'sum(G5:G16)');
cell1.DoSetFormula(10, 16, 'sum(K5:K16)');
cell1.DoSetFormula(11, 16, 'sum(L5:L16)');
cell1.DoSetFormula(12, 16, 'sum(M5:M16)');
cell1.DoSetFormula(13, 16, 'sum(N5:N16)');
end;
end;
function TFormJGBbZtsh.Setdata8: smallint;
var
temp: array of Olevariant;
Ary: array of double;
j: smallint;
Xh, Dwmc, Xmmc, Lxspjg, Dkhth, Ffrq: string;
Dkqx: smallint;
begin
setlength(temp, 14);
setlength(Ary, 7);
result := 5;
with DM do
begin
for j := 1 to 12 do
begin
cell1.DoGetCellData(0, 3 + j, temp[0]);
cell1.DoGetCellData(1, 3 + j, temp[1]);
cell1.DoGetCellData(2, 3 + j, temp[2]);
cell1.DoGetCellData(3, 3 + j, temp[3]);
cell1.DoGetCellData(4, 3 + j, temp[4]);
cell1.DoGetCellData(5, 3 + j, temp[5]);
cell1.DoGetCellData(6, 3 + j, temp[6]);
cell1.DoGetCellData(7, 3 + j, temp[7]);
cell1.DoGetCellData(8, 3 + j, temp[8]);
cell1.DoGetCellData(9, 3 + j, temp[9]);
cell1.DoGetCellData(10, 3 + j, temp[10]);
cell1.DoGetCellData(11, 3 + j, temp[11]);
cell1.DoGetCellData(12, 3 + j, temp[12]);
cell1.DoGetCellData(13, 3 + j, temp[13]);
xh := temp[0];
Dwmc := temp[1];
Xmmc := temp[2];
lxspjg := temp[3];
dkhth := temp[4];
Ffrq := temp[7];
Dkqx := temp[8];
Ary[0] := temp[5];
Ary[1] := temp[6];
Ary[2] := temp[9];
Ary[3] := temp[10];
Ary[4] := temp[11];
Ary[5] := temp[12];
Ary[6] := temp[13];
if (trim(dwmc) = '') or (trim(Xmmc) = '') or (trim(dkhth) = '') then continue;
if not IsNum(xh) then
begin
showmessage('序号请输入数字字符');
result := 5;
break;
end;
result := F_Xmdkb_Save(Jtb_Ny, Xh, Dwmc, Xmmc, Lxspjg, Dkhth, Ffrq, Dkqx, Ary);
if result <> 0 then break;
end;
end;
end;
procedure TFormJGBbZtsh.FormCreate(Sender: TObject);
begin
cell1.DoLogin('北京金天鹏软件科技有限公司', 363, '00FD18FF080193035CFE09FF9908');
LoadFunction;
LoadCellRelation(cell1);
cell1.DoSetShowFormulaState(1);
end;
procedure TFormJGBbZtsh.ToolButton10Click(Sender: TObject);
begin
close;
end;
procedure TFormJGBbZtsh.FormActivate(Sender: TObject);
var
i, j, k: smallint;
Ary: array of double;
begin
DM.P_BbmlInfo;
DM.cds_SD.First;
DT.Date := date();
for k := 1 to 8 do
begin
bbfilename := ExtractFilePath(Paramstr(0)) + BbFileGS + '0' + inttostr(k) + '.cll';
if not fileexists(bbfilename) then
begin
showmessage('报表文件:0' + inttostr(k) + ' 不存在,请确定报表位置!');
exit;
end;
for i := 0 to cell1.Cols - 1 do
for j := 0 to cell1.Rows - 1 do
cell1.DoClearCell(i, j, 0);
if (strtoint(DM.cds_SD.FieldByName('bbbh').AsString) >= 1) and
(strtoint(DM.cds_SD.FieldByName('bbbh').AsString) <= 8) then
cell1.DoAppendPage(DM.cds_SD.fieldbyname('bbmc').AsString, 1);
cell1.DoOpenFile(bbfilename);
cell1.PageLabelVisible := true;
cell1.HScrollVisible := false;
DecodeDate(DT.Date, nY, nM, nD);
Jtb_Ny := trim(inttostr(nY)) + padl(trim(inttostr(nM)), 2, '0');
with DM do
begin
case k of
1:
begin
setlength(Ary, 35);
P_ZcfzbGjj(Jtb_Ny, Ary);
GetData1(Ary);
end;
2:
begin
setlength(Ary, 16);
P_ZzsybGjj(Jtb_Ny, Ary);
GetData2(Ary);
end;
3:
begin
setlength(Ary, 14);
P_ZzsyfpbGjj(copy(Jtb_Ny, 1, 4), Ary);
GetData3(Ary);
end;
4:
begin
setlength(Ary, 32);
P_ZcfzbJf(Jtb_Ny, Ary);
GetData4(Ary);
end;
5:
begin
setlength(Ary, 14);
P_JfszbJf(Jtb_Ny, Ary);
GetData5(Ary);
end;
6:
begin
setlength(Ary, 4);
//P_Zhksyeb(Jtb_Ny,Zhmc,Khyh,Yhzh,Ary);
GetData6(Ary);
end;
7:
begin
GetData7;
end;
8:
begin
GetData8;
end;
end;
end;
cell1.DoCopyPage(k, 0);
DM.cds_SD.Next;
end;
cell1.DoRedrawAll;
cell1.DoDeletePage(0, 1);
end;
procedure TFormJGBbZtsh.Cell1ExecuteUserFunc(Sender: TObject;
const name: WideString; rettype, paranum: Smallint;
var paratype: Integer; var funcResult: OleVariant);
var
// para0,para1,para2,para3:OleVariant;
dp0, dp1: Double;
cp0: string;
funcret: olevariant;
bbdate, BbNumber, DptNumber: string;
begin
bbdate := dtoc(DT.Date);
case cell1.DoGetCurrentPage of
0: BbNumber := '01';
1: BbNumber := '02';
2: BbNumber := '03';
3: BbNumber := '04';
4: BbNumber := '05';
5: BbNumber := '06';
6: BbNumber := '07';
7: BbNumber := '08';
end;
DptNumber := ' ';
funcret := 0;
if uppercase(name) = 'GJDATA' then
begin
dp0 := cell1.DoFetchFuncDoubleParameter(0);
dp1 := cell1.DoFetchFuncDoubleParameter(1);
cell1.DoGetCellData(trunc(dp0), trunc(dp1), funcret);
end
else if uppercase(name) = 'GJGET' then
begin
dp0 := cell1.DoFetchFuncDoubleParameter(0);
dp1 := cell1.DoFetchFuncDoubleParameter(1);
cp0 := cell1.DoFetchFuncStringParameter(2);
if cp0 = '' then cp0 := BbNumber;
cell1.DoGetPageCellData(trunc(dp0), trunc(dp1), strtoint(cp0) - 1, funcret);
end;
funcresult := funcret;
end;
procedure TFormJGBbZtsh.ApplicationEvents1Exception(Sender: TObject;
E: Exception);
begin
if E is ESOAPHTTPException then
//showmessage('Something is wrong!')
else
Application.ShowException(E);
end;
procedure TFormJGBbZtsh.ToolButton5Click(Sender: TObject);
begin
RichEdit1.Visible := True;
end;
procedure TFormJGBbZtsh.ToolButton6Click(Sender: TObject);
begin
RichEdit1.Visible := False;
end;
procedure TFormJGBbZtsh.ToolButton4Click(Sender: TObject);
var
v1, v2: OleVariant;
iNo, ir, i: smallint;
C1, C2, cRelL, cRel, cRelR, BbNumber: string;
lRight: Boolean;
begin
RichEdit1.Clear;
RichEdit1.Visible := True;
for i := 1 to 8 do
begin
cell1.DoSetCurrentPage(i-1);
case cell1.DoGetCurrentPage of
0: BbNumber := '01';
1: BbNumber := '02';
2: BbNumber := '03';
3: BbNumber := '04';
4: BbNumber := '05';
5: BbNumber := '06';
6: BbNumber := '07';
7: BbNumber := '08';
end;
DM.pQryRelation(BbNumber);
ir := Cell1.Rows;
cell1.Rows := ir + 1;
with DM.cds_SD do
begin
while not Eof do
begin
lRight := False;
cRelL := trim(FieldByName('bbrelationl').AsString);
cRel := trim(FieldByName('bbrelation').AsString);
cRelR := trim(FieldByName('bbrelationr').AsString);
iNo := FieldByName('relationno').AsInteger;
next;
Cell1.DoSetFormula(0, ir, cRelL);
Cell1.DoSetFormula(1, ir, cRelR);
Cell1.DoCalculateAll;
Cell1.DoGetCellData(0, ir, v1);
Cell1.DoGetCellData(1, ir, v2);
// Cell1.DoCalculateExpr(cRelL,iRet,v1);
// Cell1.DoCalculateExpr(cRelR,iRet,v2);
C1 := FTOS(v1, 16, 3);
C2 := FTOS(v2, 16, 3);
if cRel = '=' then
begin
if C1 = C2 then
begin
lRight := True;
end;
end
else if cRel = '>' then
begin
if C1 > C2 then
lRight := True;
end
else if cRel = '>=' then
begin
if C1 >= C2 then
lRight := True;
end
else if cRel = '<' then
begin
if C1 < C2 then
lRight := True;
end
else if cRel = '<=' then
begin
if C1 <= C2 then
lRight := True;
end;
if not lRight then
begin
RichEdit1.Lines.Add('不满足' + itos(iNo, 4) + ' 号勾稽公式:');
RichEdit1.Lines.Add(' ' + cRelL + cRel + cRelR);
RichEdit1.Lines.Add(' 公式左=' + trim(FtoS(Double(v1), 16, 2)) + ';公式右=' + trim(FtoS(Double(v2), 16, 2)));
end;
end;
end;
cell1.Rows := ir;
end;
cell1.DoSetCurrentPage(0);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -