📄 sal_enter_saleplanofitem.pas
字号:
unit Sal_Enter_SalePlanOfItem;
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_SalePlanOfItem = 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_MainItemCode: TStringField;
AdoQry_MainItemName: 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_SalePlanOfItem: TFrm_Sal_Enter_SalePlanOfItem;
implementation
uses Sal_Enter_SalePlanOfItem_D,Sys_Global;
{$R *.DFM}
{ TFrm_Ar_Enter_Gathering }
procedure TFrm_Sal_Enter_SalePlanOfItem.InitForm(AdOConnection: TAdOConnection;
ReadOnly: Boolean);
begin
Application.ProcessMessages;
extendCaption:=False;
Inherited;
selectfromsql:=' select id, '
+ ' PlanYear, '
+ ' Sal_SalePlan_Item.ItemCode, '
+ ' ItemName, '
// ' Sal_SalePlan_Item.ItemCode+' '+ItemName as Itemflag,
+ ' 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_Item '
+ ' left join Item on Sal_SalePlan_Item.ItemCode=Item.ItemCode '
+' left join Employee e1 on Sal_SalePlan_Item.user_Create=e1.EmployeeCode '
+ ' left join Employee e2 on Sal_SalePlan_Item.user_edit=e2.EmployeeCode ';
condition:='PlanYear='+formatdatetime('yyyy',strtodatetime(GetServerDateTime(dbconnect)));
AdoQry_Main.Connection:=AdOConnection;
Orderbyfields:='PlanYear,ItemCode';
getdata;
lbl_Condition.Caption:='年份:'+formatdatetime('yyyy',strtodatetime(GetServerDateTime(dbconnect)));
Frm_Sys_Detail:=TFrm_Sal_Enter_SalePlanOfItem_D.Create(Application);
end;
procedure TFrm_Sal_Enter_SalePlanOfItem.FormDestroy(Sender: TObject);
begin
inherited;
Frm_Sal_Enter_SalePlanOfItem:=nil;
end;
function TFrm_Sal_Enter_SalePlanOfItem.SetDeleteSql: String;
begin
Result:='delete from Sal_SalePlan_Item '
+' where PlanYear='+AdoQry_Main.fieldbyname('PlanYear').asstring
+' and ItemCode='+quotedstr(AdoQry_Main.fieldbyname('ItemCode').asstring);
end;
procedure TFrm_Sal_Enter_SalePlanOfItem.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 + -