unit U_PrintLabFun;

interface

uses
  ADODB, System.SysUtils, Vcl.Forms;

procedure PrintServerLabel(ADO_Prt: TADOQuery; mSheets, mprintFlag, mprinter: Integer; FFiltration1: string);

procedure PrintServerLabel1(ADO_Prt: TADOQuery; mSheets, mprintFlag, mprinter: Integer; FFiltration1, MLabVolume: string);

procedure PrintServerLabelStkId(ADO_Prt: TADOQuery; mSheets, mprintFlag, mprinter: Integer; FFiltration1: string);

implementation

uses
  U_printPdf, U_RTFun, U_DataLink;

procedure PrintServerLabel1(ADO_Prt: TADOQuery; mSheets, mprintFlag, mprinter: Integer; FFiltration1, MLabVolume: string);
var
  MaxBLCLID, LBName: string;
  WBoolean: Boolean;
  i: Integer;
  Mmessage, MpdfFileId, Mcode: string;
begin

  with ADO_Prt do
  begin
    Close;
    SQL.Clear;
    sql.Add(' exec P_BS_Cloth_Prt2 ');
    SQL.Add(' @Filtration=''' + Trim(FFiltration1) + '''');
    Open;
  end;
  if ADO_Prt.IsEmpty then
  begin
    raise Exception.Create('标签内容未找到!');
  end;

  if Trim(MLabVolume) <> '' then
    LBName := Trim(MLabVolume)
  else
    LBName := Trim(ADO_Prt.fieldbyname('LabVolume').AsString);
  try
    if GetLSNo(ADO_Prt, MaxBLCLID, 'L', 'Bs_Report_Cloud_Log', 4, 1) = False then
    begin

    end;
    with ADO_Prt do
    begin
      Close;
      SQL.Clear;
      sql.Add('select * from Bs_Report_Cloud_Log where 1=2');
      Open;
    end;
    with ADO_Prt do
    begin
      Append;
      FieldByName('BLCLID').Value := MaxBLCLID;
      FieldByName('Filler').Value := dname;
      FieldByName('LMName').Value := LBName;
      FieldByName('LMSql1').Value := 'P_BS_Cloth_Prt2';
      FieldByName('Filtration1').Value := Trim(FFiltration1);
      FieldByName('IsSql1').Value := 0;
      FieldByName('Sheets').Value := mSheets;
      Post;
    end;
    printPdf(Application, 1, PChar('title'), PChar(dcode), PChar(dname), PChar(MaxBLCLID), mSheets, mprintFlag, mprinter, PChar(DConString));
  except
    application.MessageBox(PChar(Exception(ExceptObject).Message), '提示信息', 0);
  end;

end;

procedure PrintServerLabel(ADO_Prt: TADOQuery; mSheets, mprintFlag, mprinter: Integer; FFiltration1: string);
var
  MaxBLCLID, LBName: string;
  WBoolean: Boolean;
  i: Integer;
  Mmessage, MpdfFileId, Mcode: string;
begin

  with ADO_Prt do
  begin
    Close;
    SQL.Clear;
    sql.Add(' EXEC P_Trade_Card_Prt1 ');
    SQL.Add(' @Filtration=''' + Trim(FFiltration1) + '''');
    Open;
  end;
  if ADO_Prt.IsEmpty then
  begin
    raise Exception.Create('标签内容未找到!');
  end;
  LBName := Trim(ADO_Prt.fieldbyname('LabVolume').AsString);
  try
    if GetLSNo(ADO_Prt, MaxBLCLID, 'L', 'Bs_Report_Cloud_Log', 4, 1) = False then
    begin

    end;
    with ADO_Prt do
    begin
      Close;
      SQL.Clear;
      sql.Add('select * from Bs_Report_Cloud_Log where 1=2');
      Open;
    end;
    with ADO_Prt do
    begin
      Append;
      FieldByName('BLCLID').Value := MaxBLCLID;
      FieldByName('Filler').Value := dname;
      FieldByName('LMName').Value := LBName;
      FieldByName('LMSql1').Value := 'P_Trade_Card_Prt1';
      FieldByName('Filtration1').Value := Trim(FFiltration1);
      FieldByName('IsSql1').Value := 0;
      FieldByName('Sheets').Value := mSheets;
      Post;
    end;
    printPdf(Application, 1, PChar('title'), PChar(dcode), PChar(dname), PChar(MaxBLCLID), mSheets, mprintFlag, mprinter, PChar(DConString));
  except
    application.MessageBox(PChar(Exception(ExceptObject).Message), '提示信息', 0);
  end;

end;

procedure PrintServerLabelStkId(ADO_Prt: TADOQuery; mSheets, mprintFlag, mprinter: Integer; FFiltration1: string);
var
  MaxBLCLID, LBName: string;
  WBoolean: Boolean;
  i: Integer;
  Mmessage, MpdfFileId, Mcode: string;
begin

  with ADO_Prt do
  begin
    Close;
    SQL.Clear;
    sql.Add(' EXEC  P_Trade_Cloth_Prt_Lab ');
    SQL.Add(' @Filtration=''' + Trim(FFiltration1) + '''');
    Open;
  end;
  if ADO_Prt.IsEmpty then
  begin
    raise Exception.Create('标签内容未找到!');
  end;
  LBName := Trim(ADO_Prt.fieldbyname('LabVolume').AsString);
  try
    if GetLSNo(ADO_Prt, MaxBLCLID, 'L', 'Bs_Report_Cloud_Log', 4, 1) = False then
    begin

    end;
    with ADO_Prt do
    begin
      Close;
      SQL.Clear;
      sql.Add('select * from Bs_Report_Cloud_Log where 1=2');
      Open;
    end;
    with ADO_Prt do
    begin
      Append;
      FieldByName('BLCLID').Value := MaxBLCLID;
      FieldByName('Filler').Value := dname;
      FieldByName('LMName').Value := LBName;
      FieldByName('LMSql1').Value := 'P_Trade_Cloth_Prt_Lab';
      FieldByName('Filtration1').Value := Trim(FFiltration1);
      FieldByName('IsSql1').Value := 0;
      FieldByName('Sheets').Value := mSheets;
      Post;
    end;
    printPdf(Application, 1, PChar('title'), PChar(dcode), PChar(dname), PChar(MaxBLCLID), mSheets, mprintFlag, mprinter, PChar(DConString));
  except
    application.MessageBox(PChar(Exception(ExceptObject).Message), '提示信息', 0);
  end;

end;

end.

