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

📄 existbilledit.pas

📁 胜天财务进销存2003源代码,SQLSERVER版,目前最完整的财务进销存系统.
💻 PAS
📖 第 1 页 / 共 3 页
字号:
        lblEmploye.Visible := True;
        edtEmploye.Visible := True;
        lblEmploye.Caption := '经 手 人:';
        lblMemo.Visible := True;
        edtMemo.Visible := True;
        lblMemo.Caption := '备   注:';
        lblMemo.Left := lblAddress.Left;
        edtMemo.Left := edtAddress.Left;
        edtMemo.Width := edtMemo.Width * 2;
        lblMemo.Top := lblDepot.Top;
        edtMemo.Top := edtDepot.Top;
        lblDepot.Top := lblEmploye.Top;
        edtDepot.Top := edtEmploye.Top;
        pnlBillTop.Height := 60;
        Panel1.Height := 100; //改变Panel大小
        lOldTop := gridMain.Top;
        gridMain.Top := Panel1.Top + Panel1.Height + 5;
        gridMain.Height := gridMain.Height + (lOldTop - gridMain.Top); //改变表格大小
        edtDepot.TabOrder := 0;
        edtEmploye.TabOrder := 1;
        edtMemo.TabOrder := 2; //设置按钮次序
      end;
    EXIST_GAIN:
      begin
        lblUnit.Visible := True;
        edtUnit.Visible := True;
        lblUnit.Caption := '供 应 商:';
        lblEmploye.Visible := True;
        edtEmploye.Visible := True;
        lblEmploye.Caption := '经 手 人:';
        lblMemo.Visible := True;
        edtMemo.Visible := True;
        lblMemo.Caption := '备   注:';
        lblMemo.Left := lblAddress.Left;
        edtMemo.Left := edtAddress.Left;
        edtMemo.Width := edtMemo.Width * 2;
        lblMemo.Top := lblDepot.Top;
        edtMemo.Top := edtDepot.Top;
        lblDepot.Top := lblEmploye.Top;
        edtDepot.Top := edtEmploye.Top;
        pnlBillTop.Height := 60;
        Panel1.Height := 100; //改变Panel大小
        lOldTop := gridMain.Top;
        gridMain.Top := Panel1.Top + Panel1.Height + 5;
        gridMain.Height := gridMain.Height + (lOldTop - gridMain.Top); //改变表格大小
        edtDepot.TabOrder := 0;
        edtEmploye.TabOrder := 1;
        edtMemo.TabOrder := 2; //设置按钮次序
      end;
    EXIST_ENTER_DEPOT:
      begin
        lblDepot.Visible := True;
        edtDepot.Visible := True;
        lblDepot.Caption := '进 货 仓:';
        lblEmploye.Visible := True;
        edtEmploye.Visible := True;
        lblEmploye.Caption := '经 手 人:';
        lblDepot.Top := lblUnit.Top;
        edtDepot.Top := edtUnit.Top;
        lblBillNum.Visible := True;
        edtBillNum.Visible := True;
        lblBillNum.Caption := '批    号:';
        edtBillNum.DataField := 'BatchNo';
        lblBillNum.Left := lblDepot.Left;
        edtBillNum.Left := edtDepot.Left;
        lblMemo.Visible := True;
        edtMemo.Visible := True;
        lblMemo.Caption := '备    注:';
        lblMemo.Left := lblAddress.Left;
        edtMemo.Left := edtAddress.Left;
        edtMemo.Width := edtMemo.Width * 2;
        edtDepot.TabOrder := 0;
        edtEmploye.TabOrder := 1;
        edtBillNum.TabOrder := 2;
        edtMemo.TabOrder := 3; //设置按钮次序
      end;
    EXIST_CHECK_LIST:
      begin
        lblDepot.Visible := True;
        edtDepot.Visible := True;
        lblDepot.Caption := '货    仓:';
        lblEmploye.Visible := True;
        edtEmploye.Visible := True;
        lblEmploye.Caption := '盘 点 人:';
        lblDepot.Top := lblEmploye.Top;
        edtDepot.Top := edtEmploye.Top;
        pnlBillTop.Height := 35;
        Panel1.Height := 77; //改变Panel大小
        lOldTop := gridMain.Top;
        gridMain.Top := Panel1.Top + Panel1.Height + 5;
        gridMain.Height := gridMain.Height + (lOldTop - gridMain.Top); //改变表格大小
        edtDepot.TabOrder := 0;
        edtEmploye.TabOrder := 1;
        edtMemo.TabOrder := 3; //设置按钮次序
      end;
    EXIST_CHANGE_PRICE:
      begin
        lblEmploye.Visible := True;
        edtEmploye.Visible := True;
        lblEmploye.Caption := '经 手 人:';
        lblEmploye.Left := lblDepot.Left;
        edtEmploye.Left := edtDepot.Left;
        pnlBillTop.Height := 35;
        Panel1.Height := 77; //改变Panel大小
        lOldTop := gridMain.Top;
        gridMain.Top := Panel1.Top + Panel1.Height + 5;
        gridMain.Height := gridMain.Height + (lOldTop - gridMain.Top); //改变表格大小
        edtEmploye.TabOrder := 0;
      end;
    EXIST_OTHER:
      begin
        lblDepot.Visible := True;
        edtDepot.Visible := True;
        lblDepot.Caption := '变动仓库:';
        lblEmploye.Visible := True;
        edtEmploye.Visible := True;
        lblEmploye.Caption := '经 手 人:';
        lblInvoice.Visible := True;
        edtInvoice.Visible := True;
        lblInvoice.Caption := '变动类型:';
        edtInvoice.DataField := 'ChangeType';
        lblAddress.Visible := True;
        edtAddress.Visible := True;
        lblAddress.Caption := '变动信息';
        lblMemo.Visible := True;
        edtMemo.Visible := True;
        lblMemo.Caption := '备    注:';
        lblAddress.Top := lblDepot.Top;
        edtAddress.Top := edtDepot.Top;
        lblMemo.Top := lblDepot.Top;
        edtMemo.Top := edtDepot.Top;
        lblDepot.Top := lblUnit.Top;
        edtDepot.Top := edtUnit.Top;
        pnlBillTop.Height := 60;
        Panel1.Height := 100; //改变Panel大小
        lOldTop := gridMain.Top;
        gridMain.Top := Panel1.Top + Panel1.Height + 5;
        gridMain.Height := gridMain.Height + (lOldTop - gridMain.Top); //改变表格大小
        edtDepot.TabOrder := 0;
        edtEmploye.TabOrder := 1;
        edtInvoice.TabOrder := 2;
        edtAddress.TabOrder := 3;
        edtMemo.TabOrder := 4; //设置按钮次序
      end;
    EXIST_EXCHANGE:
      begin
        lblDepot.Visible := True;
        edtDepot.Visible := True;
        lblDepot.Caption := '调 出 仓:';
        lblDepot2.Visible := True;
        edtDepot2.Visible := True;
        lblDepot2.Caption := '调 入 仓:';
        lblEmploye.Visible := True;
        edtEmploye.Visible := True;
        lblEmploye.Caption := '经 手 人:';
        lblDepot.Top := lblEmploye.Top;
        edtDepot.Top := edtEmploye.Top;
        lblDepot2.Top := lblEmploye.Top;
        edtDepot2.Top := edtEmploye.Top;
        lblEmploye.Left := lblInvoice.Left;
        edtEmploye.Left := edtInvoice.Left;
        pnlBillTop.Height := 35;
        Panel1.Height := 77; //改变Panel大小
        lOldTop := gridMain.Top;
        gridMain.Top := Panel1.Top + Panel1.Height + 5;
        gridMain.Height := gridMain.Height + (lOldTop - gridMain.Top); //改变表格大小
        edtDepot.TabOrder := 0;
        edtDepot2.TabOrder := 1;
        edtEmploye.TabOrder := 2; //设置按钮次序
      end;
    EXIST_PRICE_EXCHANGE:
      begin
        lblDepot.Visible := True;
        edtDepot.Visible := True;
        lblDepot.Caption := '调 出 仓:';
        lblDepot2.Visible := True;
        edtDepot2.Visible := True;
        lblDepot2.Caption := '调 入 仓:';
        lblEmploye.Visible := True;
        edtEmploye.Visible := True;
        lblEmploye.Caption := '经 手 人:';
        lblDepot.Top := lblEmploye.Top;
        edtDepot.Top := edtEmploye.Top;
        lblDepot2.Top := lblEmploye.Top;
        edtDepot2.Top := edtEmploye.Top;
        lblEmploye.Left := lblInvoice.Left;
        edtEmploye.Left := edtInvoice.Left;
        pnlBillTop.Height := 35;
        Panel1.Height := 77; //改变Panel大小
        lOldTop := gridMain.Top;
        gridMain.Top := Panel1.Top + Panel1.Height + 5;
        gridMain.Height := gridMain.Height + (lOldTop - gridMain.Top); //改变表格大小
        edtDepot.TabOrder := 0;
        edtDepot2.TabOrder := 1;
        edtEmploye.TabOrder := 2; //设置按钮次序
      end;
    EXIST_ASSEMBLY:
      begin
        lblDepot.Visible := True;
        edtDepot.Visible := True;
        lblDepot.Caption := '仓    库:';
        lblEmploye.Visible := True;
        edtEmploye.Visible := True;
        lblEmploye.Caption := '经 手 人:';
        lblWare.Visible := True;
        edtWare.Visible := True;
        lblWare.Caption := '商    品:';
        lblPrice.Visible := True;
        edtPrice.Visible := True;
        lblPrice.Caption := '成本单价:';
        lblNumber.Visible := True;
        edtNumber.Visible := True;
        lblNumber.Caption := '数    量:';
        lblTotal.Visible := True;
        edtTotal.Visible := True;
        lblTotal.Caption := '金    额:';
        lblMemo.Visible := True;
        edtMemo.Visible := True;
        lblMemo.Caption := '备    注:';
        lblDepot.Top := lblEmploye.Top;
        edtDepot.Top := edtEmploye.Top;
        lblWare.Top := lblEmploye.Top;
        edtWare.Top := edtEmploye.Top;
        lblWare.Left := lblInvoice.Left;
        edtWare.Left := edtInvoice.Left;
        lblMemo.Left := lblAddress.Left;
        edtMemo.Left := edtAddress.Left;
        edtMemo.Width := edtMemo.Width * 2;
        boxCombin.Visible := True;
        edtDepot.TabOrder := 0;
        edtEmploye.TabOrder := 1;
        edtWare.TabOrder := 2;
        edtPrice.TabOrder := 3;
        edtNumber.TabOrder := 4;
        edtTotal.TabOrder := 5;
        edtMemo.TabOrder := 6; //设置按钮次序
      end;
    MONEY_EXPENSES, MONEY_INCOME, MONEY_DEPOSIT:
      begin
        edtPrice.DataSource := nil;
        edtTotal.DataSource := nil;
        edtNumber.DataSource := nil;
        lblEmploye.Visible := True;
        edtEmploye.Visible := True;
        lblEmploye.Caption := '经 手 人:';
        lblEmploye.Left := lblDepot.Left;
        edtEmploye.Left := edtDepot.Left;
        lblMemo.Visible := True;
        edtMemo.Visible := True;
        lblMemo.Caption := '备    注:';
        lblMemo.Top := edtPrice.Top;
        edtMemo.Top := edtPrice.Top;
        pnlBillTop.Height := 35;
        Panel1.Height := 77; //改变Panel大小
        lOldTop := gridMain.Top;
        gridMain.Top := Panel1.Top + Panel1.Height + 5;
        gridMain.Height := gridMain.Height + (lOldTop - gridMain.Top); //改变表格大小
        edtEmploye.TabOrder := 0;
      end;
  else
    ShowMsg('内部参数出错,请与开发商联系!');
  end;
end;

procedure TfrmExistBillEdit.LoadData;
begin
  OpenDataSet(ADOSetMaster, ReturnSQL(1, lMode, lID));
  if (lID > 0) and ADOSetMaster.IsEmpty then
  begin
    lID := 0;
    OpenDataSet(ADOSetMaster, ReturnSQL(1, lMode, lID));
  end;
  if lID = 0 then
    ADOSetMaster.Append //新增
  else
    DataSetLocate(ADOSetMaster, 'ID', lID); //修改
  if OpenDataSet(ADOSetList, ReturnSQL(2, lMode, lID)) then
  begin
    ADOSetList.Recordset.Properties.Item['unique table'].Value := sUniqueTable;
  end;
  if lID = 0 then
  begin
    ADOSetMaster.FieldByName('BillDate').AsDateTime := SYSStartDate;
    ADOSetMaster.FieldByName('UserCode').AsString := GetAutoSerial(lMode, 0);
    ADOSetMaster.FieldByName('Name').AsString := Caption;
    ADOSetMaster.FieldByName('Finish').AsInteger := 0;
    //ADOSetMaster.FieldByName('EmployeID').AsInteger := LoginEmployeID;//默认经手人
    //edtEmploye.Text := LoginEmployeName;
    ADOSetList.Insert;
  end
  else
  begin
    ADOSetMaster.Edit;
    lID := ADOSetMaster.FieldByName('ID').AsInteger;
  end;
  FieldToEdit;
  ToolShow;
end;

function TfrmExistBillEdit.ReturnSQL(lType, lMode, lBillID: Integer): string;
var
  sSql: string;
begin
  sSql := '';
  if lType = 1 then
  begin
    case lMode of
      MONEY_EXPENSES, MONEY_INCOME, MONEY_DEPOSIT:
        sSql := ' SELECT * FROM BillIndex e where e.mode=' + IntToStr(lMode);
    else sSql := ' SELECT * FROM ExistIndex e where e.mode=' + IntToStr(lMode);
    end;
  end
  else if lType = 2 then
  begin
    case lMode of
      EXIST_DRAW, EXIST_RETURN, EXIST_LOSING, EXIST_INCREASE, EXIST_ENTER_DEPOT,
        EXIST_CHECK_LIST, EXIST_CHANGE_PRICE, EXIST_EXCHANGE, EXIST_ASSEMBLY,
        EXIST_OTHER, EXIST_PRICE_EXCHANGE, EXIST_PRESENT, EXIST_GAIN:
        begin
          sSql := ' SELECT bs.ID,bs.Mode,w.UserCode as WareCode,w.Name as WareName,w.Unit as WareUnit,w.Unit2,w.Scale,w.Model,w.Spec,w.Area,bs.WareID,bs.Number,'
            + ' bs.Price,bs.Price1,bs.ConstPrice, bs.Total, bs.ToNumber,bs.UnNumBer,bs.otherID,bs.Memo, bs.IndexID, bs.Date, bs.BillName, bs.Sum,bs.Type' +
            ' FROM ExistList bs,Ware w WHERE w.ID=bs.WareID and bs.IndexID =' + IntToStr(lBillID);
          sUniqueTable := 'ExistList';
        end;
      MONEY_EXPENSES, MONEY_INCOME, MONEY_DEPOSIT:
        begin
          sSql := ' SELECT BM.ID, BM.IndexID, BM.Date, BM.BillDate, BM.Mode, BM.BillName, BM.WareID,' +
            ' BM.Number, BM.ToNumber, BM.UnNumber, BM.ConstPrice, BM.Price, BM.Total, BM.Sum,' +
            ' BM.OtherID, BM.Memo, BM.Finish, BM.Type, A.UserCode as AUserCode, A.Name as AName' +
            ' FROM BillMoney AS BM INNER JOIN Subject AS A ON BM.WareID = A.ID where bm.IndexID=' + IntToStr(lBillID);
          sUniqueTable := 'BillMoney';
        end;
    end;
  end;
  Result := sSql;
end;

procedure TfrmExistBillEdit.FieldToEdit;
begin
  edtUnit.Text := FieldIdToName('Unit', ADOSetMaster.FieldByName('UnitID').AsString, 'Name');
  edtEmploye.Text := FieldIdToName('Employe', ADOSetMaster.FieldByName('EmployeID').AsString, 'Name');
  edtDepot.Text := FieldIdToName('Depot', ADOSetMaster.FieldByName('DepotID').AsString, 'Name');
  if edtDepot2.Visible then
    edtDepot2.Text := FieldIdToName('Depot', ADOSetMaster.FieldByName('DepotID2').AsString, 'Name');
end;

procedure TfrmExistBillEdit.SaveData(lType: Integer);
var
  lWareID, lDepotID, lDepotID2, lWareIDZZ: Integer;
  dNumber, dConstPrice, dPrice, dPrice1, dTotal, dNumberZZ, dPriceZZ, dTotalZZ: Double;
begin
  BeginTrans; //开始事务
  if (ADOSetMaster.State = dsEdit) or (ADOSetMaster.State = dsInsert) then
  begin
    ADOSetMaster.FieldByName('Mode').AsInteger := lMode;
    ADOSetMaster.FieldByName('Type').AsInteger := lType;
    if rbZh.Checked then ADOSetMaster.FieldByName('isUnite').AsInteger := 1
    else ADOSetMaster.FieldByName('isUnite').AsInteger := 0;
    if lType = 3 then ADOSetMaster.FieldByName('Name').AsString := Caption + '(草稿)'
    else ADOSetMaster.FieldByName('Name').AsString := Caption;
  end;
  if not SaveDataSet(ADOSetMaster, false) then
  begin
    RollbackTrans;
    Exit;
  end;
  lID := ADOSetMaster.FieldByName('ID').AsInteger;
  lDepotID := ADOSetMaster.FieldByName('DepotID').AsInteger;
  lDepotID2 := ADOSetMaster.FieldByName('DepotID2').AsInteger;

  case lMode of
    EXIST_ASSEMBLY:
      begin
        lWareIDZZ := ADOSetMaster.FieldByName('WareID').AsInteger;
        dNumberZZ := ADOSetMaster.FieldByName('Number').AsFloat;
        dPriceZZ := ADOSetMaster.FieldByName('Price').AsFloat;
        dTotalZZ := ADOSetMaster.FieldByName('Total').AsFloat;
        if rbZh.Checked then
        begin
          if not UpdateStock(1, lWareIDZZ, 0, dNumberZz, dPriceZZ, dTotalZZ) then Exit; //组装
        end
        else if not UpdateStock(1, lWareIDZZ, 0, -dNumberZz, dPriceZZ, -dTotalZZ) then Exit; //拆卸
      end;
  end;

⌨️ 快捷键说明

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