?? unit_productmanage.pas
字號:
Form_Data.SQL.Close;
Form_Data.SQL.SQL.Clear;
Form_Data.SQL.SQL.Add('SELECT cCusCode, SUM(iQuantity) From SaleDealList ');
Form_Data.SQL.SQL.Add('WHERE cInvCode = '''+ cProductCode +'''');
Form_Data.SQL.SQL.Add('AND dDate >= '''+ dStartDate +'''');
Form_Data.SQL.SQL.Add('AND dDate <= '''+ dEndDate +'''');
Form_Data.SQL.SQL.Add('GROUP BY cCusCode ');
Form_Data.SQL.Open;
IF (Form_Data.SQL.RecordCount <> 0) Then
Begin
cCustCode := '' ;
While Form_Data.SQL.Eof = False do
Begin
IF cCustCode = '' Then cCustCode := '''' + Form_Data.SQL.FieldValues['cCusCode'] + ''''
Else cCustCode := cCustCode + ',''' + Form_Data.SQL.FieldValues['cCusCode'] + '''';
Form_Data.SQL.Next;
end;
Form_Data.SQL.Close;
Form_Data.SQL.SQL.Clear;
Form_Data.SQL.SQL.Add('UPDATE a__Plans');
Form_Data.SQL.SQL.Add('SET PLstate = 1');
Form_Data.SQL.SQL.Add('WHERE PBNO = '+ IntToStr(PBNO) +'');
Form_Data.SQL.SQL.Add('AND PLCustID In ('+ cCustCode +')');
Form_Data.SQL.ExecSQL;
End;
Form_Data.SQL_Plan.Active := False ;
Form_Data.SQL_Plan.Active := True ;
Form_Data.SQL_Plans.Active := False ;
Form_Data.SQL_Plans.Active := True ;
Form_Data.SQL_Plan.Locate('計劃序號',PBNO,[]);
Showmessage('計劃進度更新完畢!');
end;
procedure TForm_ProductManage.N12Click(Sender: TObject);
begin
IF Form_Data.Table_Manage.Lookup('MName',UserName,'M006') = 0 Then
Begin
Showmessage('你無權執行此項操作,請咨詢系統管理員!');
Exit;
End;
Form_OrderCheck.Show;
end;
procedure TForm_ProductManage.N13Click(Sender: TObject);
begin
Form_ReturnCheck.Show;
end;
procedure TForm_ProductManage.N33Click(Sender: TObject);
begin
IF Form_Data.Table_Manage.Lookup('MName',UserName,'M005') = 0 Then
Begin
Showmessage('你無權執行此項操作,請咨詢系統管理員!');
Exit;
End;
Form_PlanCustList.Show;
end;
procedure TForm_ProductManage.PopupMenu_PlanPopup(Sender: TObject);
begin
IF Form_Data.SQL_Plan.RecordCount = 0 Then
Begin
N19.Enabled := False ;
N33.Enabled := False ;
N24.Enabled := False ;
N16.Enabled := False ;
N17.Enabled := False ;
N26.Enabled := False ;
End Else Begin
N19.Enabled := True ;
N33.Enabled := True ;
N24.Enabled := True ;
N16.Enabled := True ;
N17.Enabled := True ;
N26.Enabled := True ;
End;
end;
procedure TForm_ProductManage.N6Click(Sender: TObject);
begin
IF Form_Data.SQL_Plan.RecordCount = 0 Then
Begin
N27.Enabled := False ;
N32.Enabled := False ;
N29.Enabled := False ;
N20.Enabled := False ;
N21.Enabled := False ;
N31.Enabled := False ;
End Else Begin
N27.Enabled := True ;
N32.Enabled := True ;
N29.Enabled := True ;
N20.Enabled := True ;
N21.Enabled := True ;
N31.Enabled := True ;
End;
end;
procedure TForm_ProductManage.N35Click(Sender: TObject);
begin
IF Form_Data.Table_Manage.Lookup('MName',UserName,'M008') = 0 Then
Begin
Showmessage('你無權執行此項操作,請咨詢系統管理員!');
Exit;
End;
Form_PrintSetup.Show;
end;
procedure TForm_ProductManage.N10Click(Sender: TObject);
begin
Form_Inventory.Show;
end;
procedure TForm_ProductManage.N37Click(Sender: TObject);
Var
PBNO: Integer;
dStartDate,dEndDate,cProductCode,cCustCode: string;
B1,B2,B3: Boolean;
begin
IF Form_Data.Table_Manage.Lookup('MName',UserName,'M003') = 0 Then
Begin
Showmessage('你無權執行此項操作,請咨詢系統管理員!');
Exit;
End;
Form_Data.SQL_Plan.First;
While Form_Data.SQL_Plan.Eof = False do
Begin
B1 := Form_Data.SQL_Plan.FieldByName('計劃止日').AsDateTime > Now() ;
B2 := Form_Data.SQL_Plan.FieldByName('已計劃').AsInteger > 0 ;
B3 := Form_Data.SQL_Plan.FieldByName('已完成').AsInteger < Form_Data.SQL_Plan.FieldByName('已計劃').AsInteger ;
IF (( B1 = True ) AND ( B2 = True ) AND ( B3 = True )) Then
Begin
PBNO := Form_Data.SQL_Plan.FieldValues['計劃序號'];
dStartDate := Form_Data.SQL_Plan.FieldValues['計劃起日'];
dEndDate := Form_Data.SQL_Plan.FieldValues['計劃止日'];
cProductCode := Form_Data.SQL_Plan.FieldValues['商品代碼'];
Form_Data.SQL.Close;
Form_Data.SQL.SQL.Clear;
Form_Data.SQL.SQL.Add('SELECT cCusCode, SUM(iQuantity) From SaleDealList ');
Form_Data.SQL.SQL.Add('WHERE cInvCode = '''+ cProductCode +'''');
Form_Data.SQL.SQL.Add('AND dDate >= '''+ dStartDate +'''');
Form_Data.SQL.SQL.Add('AND dDate <= '''+ dEndDate +'''');
Form_Data.SQL.SQL.Add('GROUP BY cCusCode ');
Form_Data.SQL.Open;
IF (Form_Data.SQL.RecordCount <> 0) Then
Begin
cCustCode := '' ;
While Form_Data.SQL.Eof = False do
Begin
IF cCustCode = '' Then cCustCode := '''' + Form_Data.SQL.FieldValues['cCusCode'] + ''''
Else cCustCode := cCustCode + ',''' + Form_Data.SQL.FieldValues['cCusCode'] + '''';
Form_Data.SQL.Next;
end;
Form_Data.SQL.Close;
Form_Data.SQL.SQL.Clear;
Form_Data.SQL.SQL.Add('UPDATE a__Plans');
Form_Data.SQL.SQL.Add('SET PLstate = 1');
Form_Data.SQL.SQL.Add('WHERE PBNO = '+ IntToStr(PBNO) +'');
Form_Data.SQL.SQL.Add('AND PLCustID In ('+ cCustCode +')');
Form_Data.SQL.ExecSQL;
End;
End;
Form_Data.SQL_Plan.Next;
End;
Form_Data.SQL_Plan.Active := False ;
Form_Data.SQL_Plan.Active := True ;
Form_Data.SQL_Plans.Active := False ;
Form_Data.SQL_Plans.Active := True ;
Showmessage('計劃進度更新完畢!');
end;
procedure TForm_ProductManage.BitBtn_CancelClick(Sender: TObject);
begin
Close;
end;
procedure TForm_ProductManage.BitBtn_OKClick(Sender: TObject);
begin
IF ((LCB_User.Text <> '') AND (Edit_Pass.Text <> '')) Then
Begin
IF Form_Data.Table_User.Locate('UserCode;Password',varArrayof([LCB_User.Text,Edit_Pass.Text]),[])= True Then
Begin
Form_Data.Table_Manage.Locate('MCode',LCB_User.Text,[]);
DBGrid_Plan.Visible := True ;
N2.Visible := True;
N4.Visible := True;
N6.Visible := True;
N11.Visible := True;
N34.Visible := True;
N39.Enabled := True;
N41.Enabled := True;
GroupBox_Login.Visible := False;
UserName := Form_Data.Table_User.fieldByName('UserName').AsString;
StatusBar_Sys.Panels[0].Text := '歡迎登陸商品管理系統';
StatusBar_Sys.Panels[1].Text := '日期 ' + FormatDatetime('YYYY-MM-DD',Now());
StatusBar_Sys.Panels[2].Text := '用戶 ' + UserName;
End Else Showmessage ('用戶代碼或密碼錯誤 ,登陸失敗!');
end Else Showmessage ('用戶代碼或密碼為空,登陸失敗!');
end;
procedure TForm_ProductManage.N41Click(Sender: TObject);
begin
IF Form_Data.Table_Manage.Lookup('MName',UserName,'M009') = 0 Then
Begin
Showmessage('你無權執行此項操作,請咨詢系統管理員!');
Exit;
End;
Form_UserManage.show;
end;
procedure TForm_ProductManage.N39Click(Sender: TObject);
Var
S1,S2: String;
begin
S1:=InputBox('修改密碼','請輸入新密碼:','');
S2:=InputBox('修改密碼','請確認新密碼:','');
IF ((S1<>'') AND(S1=S2)) Then
Begin
Form_Data.SQL.Close;
Form_Data.SQL.SQL.Clear;
Form_Data.SQL.SQL.Add('UPDATE a__R_User');
Form_Data.SQL.SQL.Add('SET Password = '''+ S1 +'''');
Form_Data.SQL.SQL.Add('WHERE (UserName ='''+ Username +''')');
Form_Data.SQL.ExecSQL;
Form_Data.Table_User.Active :=False;
Form_Data.Table_User.Active :=True;
ShowMessage('密碼修改成功!');
End
Else
Begin
ShowMessage('密碼輸入錯誤,修改不成功!');
Exit;
End;
end;
procedure TForm_ProductManage.N43Click(Sender: TObject);
begin
Form_Data.Table__Productlable.Active := False ;
Form_Data.Table__ProductSupply.Active := False ;
Form_Data.Table__ProductType.Active := False ;
Form_Data.Table__Inventory.Active := False ;
Form_Data.Table__SA_CusUPrice.Active := False ;
Form_Data.Table__ComputationGroup.Active := False ;
Form_Data.Table__ComputationUnit.Active := False ;
Form_Data.Table__Plan.Active := False ;
Form_Data.Table__Plans.Active := False ;
Form_Data.SQL_Plan.Active := False ;
Form_Data.SQL_Plans.Active := False ;
Form_Data.SQL_Person.Active := False ;
Form_Data.Table__WeiSDJ.Active := False ;
Form_Data.Table__WeiSDJs.Active := False ;
Form_Data.Table__WeiSRD.Active := False ;
Form_Data.Table__WeiSRDs.Active := False ;
Form_Data.Table__PlanPerson.Active := False ;
Form_Data.Table__PlanCustLevel.Active := False ;
Form_Data.SQL_PlanCustList.Active := False ;
Form_Data.SQL_PlanCustLists.Active := False ;
Form_Data.Table__SaleSUM.Active := False ;
Form_Data.Table__ListType.Active := False ;
Form_Data.Table_SalePrint.Active := False ;
Form_Data.Table_SalePrints.Active := False ;
Form_Data.Table__InventoryForCust.Active := False ;
Form_Data.SQL_Price.Active := False ;
Form_Data.Table__ProductForCust.Active := False ;
Form_Data.Table__Price.Active := False ;
Form_Data.Table__Prices.Active := False ;
Form_Data.Table_User.Active := False ;
Form_Data.Table_Manage.Active := False ;
Form_Data.tPriceType.Active := False ;
Form_Data.Table__Productlable.Active := True ;
Form_Data.Table__ProductSupply.Active := True ;
Form_Data.Table__ProductType.Active := True ;
Form_Data.Table__Inventory.Active := True ;
Form_Data.Table__SA_CusUPrice.Active := True ;
Form_Data.Table__ComputationGroup.Active := True ;
Form_Data.Table__ComputationUnit.Active := True ;
Form_Data.Table__Plan.Active := True ;
Form_Data.Table__Plans.Active := True ;
Form_Data.SQL_Plan.Active := True ;
Form_Data.SQL_Plans.Active := True ;
Form_Data.SQL_Person.Active := True ;
Form_Data.Table__WeiSDJ.Active := True ;
Form_Data.Table__WeiSDJs.Active := True ;
Form_Data.Table__WeiSRD.Active := True ;
Form_Data.Table__WeiSRDs.Active := True ;
Form_Data.Table__PlanPerson.Active := True ;
Form_Data.Table__PlanCustLevel.Active := True ;
Form_Data.SQL_PlanCustList.Active := True ;
Form_Data.SQL_PlanCustLists.Active := True ;
Form_Data.Table__SaleSUM.Active := True ;
Form_Data.Table__ListType.Active := True ;
Form_Data.Table_SalePrint.Active := True ;
Form_Data.Table_SalePrints.Active := True ;
Form_Data.Table__InventoryForCust.Active := True ;
Form_Data.SQL_Price.Active := True ;
Form_Data.Table__ProductForCust.Active := True ;
Form_Data.Table__Price.Active := True ;
Form_Data.Table__Prices.Active := True ;
Form_Data.Table_User.Active := True ;
Form_Data.Table_Manage.Active := True ;
Form_Data.tPriceType.Active := True ;
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -