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

📄 unit_productmanage.pas

📁 用友ERP功能扩展
💻 PAS
📖 第 1 页 / 共 2 页
字号:

    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 + -