⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sal_enter_saleplanofsaler.pas

📁 一个MRPII系统源代码版本
💻 PAS
字号:
unit Sal_Enter_SalePlanOfSaler;

Interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Base_Outer, Menus, ExtPrintReport, Db, ActnList, AdODB, Grids, DBGridEh,
  StdCtrls, ExtCtrls, ComCtrls, ToolWin, jpeg;

Type
  TFrm_Sal_Enter_SalePlanOfSaler = Class(TFrm_Base_Outer)
    AdoQry_Mainid: TAutoIncField;
    AdoQry_MaInPlanYear: TIntegerField;
    AdoQry_MaInPlansum_Year: TFloatField;
    AdoQry_Mainrationsum_Year: TFloatField;
    AdoQry_MaInPlansum_1: TFloatField;
    AdoQry_Mainrationsum_1: TFloatField;
    AdoQry_MaInPlansum_2: TFloatField;
    AdoQry_Mainrationsum_2: TFloatField;
    AdoQry_MaInPlansum_3: TFloatField;
    AdoQry_Mainrationsum_3: TFloatField;
    AdoQry_MaInPlansum_4: TFloatField;
    AdoQry_Mainrationsum_4: TFloatField;
    AdoQry_MaInPlansum_5: TFloatField;
    AdoQry_Mainrationsum_5: TFloatField;
    AdoQry_MaInPlansum_6: TFloatField;
    AdoQry_Mainrationsum_6: TFloatField;
    AdoQry_MaInPlansum_7: TFloatField;
    AdoQry_Mainrationsum_7: TFloatField;
    AdoQry_MaInPlansum_8: TFloatField;
    AdoQry_Mainrationsum_8: TFloatField;
    AdoQry_MaInPlansum_9: TFloatField;
    AdoQry_Mainrationsum_9: TFloatField;
    AdoQry_MaInPlansum_10: TFloatField;
    AdoQry_Mainrationsum_10: TFloatField;
    AdoQry_MaInPlansum_11: TFloatField;
    AdoQry_Mainrationsum_11: TFloatField;
    AdoQry_MaInPlansum_12: TFloatField;
    AdoQry_Mainrationsum_12: TFloatField;
    AdoQry_Mainuser_Create: TStringField;
    AdoQry_Mainuser_CreateName: TStringField;
    AdoQry_Maindatetime_Create: TDateTimeField;
    AdoQry_Mainuser_edit: TStringField;
    AdoQry_Mainuser_editName: TStringField;
    AdoQry_Maindatetime_Edit: TDateTimeField;
    AdoQry_MainSaleEmployeeCode: TStringField;
    AdoQry_MainEmployeeName: TStringField;
    procedure FormDestroy(Sender: TObject);
    procedure Act_DeleteExecute(Sender: TObject);
  private
    { Private declarations }
  public
    procedure InitForm(AdOConnection:TAdOConnection;ReadOnly:Boolean);Override;
    function SetDeleteSql:String;Override;
    { Public declarations }
  end;

var
  Frm_Sal_Enter_SalePlanOfSaler: TFrm_Sal_Enter_SalePlanOfSaler;

implementation
uses Sal_Enter_SalePlanOfSaler_D,Sys_Global;
{$R *.DFM}

{ TFrm_Ar_Enter_Gathering }

procedure TFrm_Sal_Enter_SalePlanOfSaler.InitForm(AdOConnection: TAdOConnection;
  ReadOnly: Boolean);
begin
  Application.ProcessMessages;
  extendCaption:=False;
  Inherited;
  selectfromsql:=' select id,           '
                + '        PlanYear,                          '
                + '        Sal_SalePlan_Saler.SaleEmployeeCode,        '
                + '        e3.EmployeeName,                          '
              //   '        Sal_SalePlan_Saler.DeptCode+' '+DeptName as Deptflag,
                + '        Plansum_Year,        '
                + '        rationsum_Year,      '
                + '        Plansum_1,           '
                + '        rationsum_1,         '
                + '        Plansum_2,           '
                + '        rationsum_2,         '
                + '        Plansum_3,           '
                + '        rationsum_3,         '
                + '        Plansum_4,           '
                + '        rationsum_4,         '
                + '        Plansum_5,           '
                + '        rationsum_5,         '
                + '        Plansum_6,           '
                + '        rationsum_6,         '
                 +'        Plansum_7,           '
                + '        rationsum_7,         '
                + '        Plansum_8,           '
                + '        rationsum_8,         '
                + '        Plansum_9,           '
                + '        rationsum_9,         '
                + '        Plansum_10,          '
                + '        rationsum_10,        '
                + '        Plansum_11,          '
                + '        rationsum_11,        '
                + '        Plansum_12,          '
                + '        rationsum_12,        '
                + '        user_Create,         '
                + '        e1.EmployeeName as user_CreateName,    '
            //     '        user_Create+' '+e1.EmployeeName as user_Createflag,
                + '        datetime_Create,      '
                + '        user_edit,            '
                + '        e2.EmployeeName as user_editName,    '
               //  '        user_edit+' '+e2.EmployeeName as user_editflag,
                + '        datetime_Edit         '
                + ' from       Sal_SalePlan_Saler '
                + ' left join Employee e3 on Sal_SalePlan_Saler.SaleEmployeeCode=e3.EmployeeCode         '
                 +' left join Employee e1 on Sal_SalePlan_Saler.user_Create=e1.EmployeeCode  '
                + ' left join Employee e2 on Sal_SalePlan_Saler.user_edit=e2.EmployeeCode    ';
               // +' where PlanYear='+formatdatetime('yyyy',strtodatetime(GetServerDateTime(dbconnect)));
  condition:='PlanYear='+formatdatetime('yyyy',strtodatetime(GetServerDateTime(dbconnect)));
  AdoQry_Main.Connection:=AdOConnection;
  Orderbyfields:='PlanYear,SaleEmployeeCode';
  getdata;
  lbl_Condition.Caption:='年份:'+formatdatetime('yyyy',strtodatetime(GetServerDateTime(dbconnect)));  
  Frm_Sys_Detail:=TFrm_Sal_Enter_SalePlanOfSaler_D.Create(Application);
end;

procedure TFrm_Sal_Enter_SalePlanOfSaler.FormDestroy(Sender: TObject);
begin
  inherited;
  Frm_Sal_Enter_SalePlanOfSaler:=nil;
end;

function TFrm_Sal_Enter_SalePlanOfSaler.SetDeleteSql: String;
begin
  Result:='delete from Sal_SalePlan_Saler '
         +' where PlanYear='+AdoQry_Main.fieldbyname('PlanYear').asstring
         +'   and SaleEmployeeCode='+quotedstr(AdoQry_Main.fieldbyname('SaleEmployeeCode').asstring);
end;

procedure TFrm_Sal_Enter_SalePlanOfSaler.Act_DeleteExecute(Sender: TObject);
begin
  if AdoQry_Main.RecordCount=0 then exit;
  if DispInfo(' 真的删除当前记录吗? ',2)<>'y' then exit;
  try
    dbconnect.beginTrans;
    AdoQry_Tmp.Close;
    AdoQry_Tmp.SQL.Text:=SetDeleteSql;
    AdoQry_Tmp.ExecSQL;
    AdoQry_Main.Delete;
    dbconnect.CommitTrans;
  except
    if dbconnect.InTransaction then dbconnect.RollBackTrans;
    DispInfo(' 无法删除当前记录,可能已经被其他数据表引用!',1);
    Abort;
  end;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -