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

📄 uunpos.pas

📁 适合行业为眼镜业
💻 PAS
📖 第 1 页 / 共 2 页
字号:
        CdsDetailData.FieldByName('SendPrice').asFloat := fPrice;
      end
      else
      begin
        fQty := StrToFloat(Trim(sgorder.cells[7, iRow]));
        CdsDetailData.FieldByName('nuOutQuantity').asFloat := fQty;
        fPrice := StrToFloat(Trim(sgorder.cells[8, iRow]));
        CdsDetailData.FieldByName('SendPrice').asFloat := fPrice;
      end;
      fTotal := fPrice * fQty;
      CdsDetailData.FieldByName('SendTotal').asFloat := fTotal;
      CdsDetailData.FieldByName('nuCess').asFloat := 0;
      CdsDetailData.FieldByName('nuIncTaxPrice').asFloat := fPrice;
      CdsDetailData.FieldByName('nuTax').asFloat := 0;
      CdsDetailData.FieldByName('NTaxTotal').asFloat := fTotal;
      CdsDetailData.FieldByName('nuCostPrice').asFloat := fPrice;
      CdsDetailData.FieldByName('NCastTotal').asFloat := fTotal;
      CdsDetailData.FieldByName('iUnit').asInteger := iunit;
      CdsDetailData.FieldByName('NRate').asFloat := dRate;
    end;
    PsRst := CdsDetailData.RecordCount;
    if ieditmode=0 then   //写草稿;
    begin
      dmmain.cdsReceipt.close;
      dmmain.cdsReceipt.Open;
      dmmain.cdsReceipt.Append;
      dmmain.cdsReceipt.FieldByName('Receipt_NO').AsString:=Trim(edtbillno.Text);
      dmmain.cdsReceipt.FieldByName('Receipt_Name').AsString:='配送退货单';
      dmmain.cdsReceipt.FieldByName('Copy_Date').AsString:=formatdatetime('yyyy''-''mm''-''dd',date);
      dmmain.cdsReceipt.FieldByName('Proposer').AsString:=Trim(Edtm.Text);
      dmmain.cdsReceipt.FieldByName('Check_Result').Asinteger:=0;
      dmmain.cdsReceipt.FieldByName('Flag_Sign').AsString:='草稿';
      dmmain.cdsReceipt.FieldByName('Condense').AsString:='仓库【'+shopid+'】向仓库【'+EdtSendStock.Text+'】退货';
      dmmain.cdsReceipt.FieldByName('Re_part').AsString:=trim(Handle_Part);
      dmmain.cdsReceipt.Post;
      dmmain.cdsReceipt.ApplyUpdates(-1);
    end;
    mdata:= CdsMasterData.Data;
    Ddata:=CdsDetailData.Data;
    adisp.InsertSendBill(mData,dData,iEditMode, PsRst);

    if PsRst <> 0 then raise Exception.Create('单据保存失败!');
    Result := True;
  except
    on E: Exception do
    begin
      Application.MessageBox(Pchar(E.message), pchar(application.Title), MB_OK + MB_ICONinformation)
    end;
  end;
end;
function TfmUnPosSendBill.ReadBill: Boolean;
var
  iRow: Integer;
  sql:widestring;
begin
//
  Result := False;
  if SEditMode = '' then Exit;
  try
  //---显示数据,并且给相应变量付值------//

    sql:='select a.*,b.*,c.* from sendmastertable as a ,senddetailtable as b, vSelectGoods as c where b.vcSendBillId=a.vcSendBillId and b.vcPtypeid =c.goods_no and c.storage_no= a.vcRecvStockID and a.BillNo='+''''+trim(list_no)+'''';   //5-7 WG EDIT
    dmmain.CDSquery2.Close;
    dmmain.CDSquery2.Data:=null;
    try
    dmmain.CDSquery2.Data:=adisp.resultrecord(sql);
    dmmain.CDSquery2.Open;
    edtbillno.Text:=trim(dmmain.CDSquery2.fieldbyname('billno').AsString);
    //edtsourcno.Text:=trim(dmmain.CDSquery2.fieldbyname('VcSourceId').AsString);
    EdtSendStock.Text:=trim(dmmain.CDSquery2.fieldbyname('vcSendStockID').AsString);
    EdtRecvStock.Text:=trim(dmmain.CDSquery2.fieldbyname('vcRecvStockID').AsString);
    edtm.Text:=trim(dmmain.CDSquery2.fieldbyname('vcListerId').AsString);
    edtg.Text:=trim(dmmain.CDSquery2.fieldbyname('vcEId').AsString);
    edtmemo.Text:=trim(dmmain.CDSquery2.fieldbyname('vcExplain').AsString);
    SendMaster.nuTotalMoney:= dmmain.CDSquery2.fieldbyname('nuTotalMoney').asfloat;
    SendMaster.vcSendStockID:=EdtSendStock.Text;
    SendMaster.vcRecvStockID:=EdtRecvStock.Text;
    SendMaster.BillNo:=edtbillno.Text;
    SendMaster.iBIlltype:=dmmain.CDSquery2.fieldbyname('iBIlltype').AsInteger;
    SendMaster.vcListerId:=edtm.Text;
    SendMaster.vcEId :=edtg.Text;
    SendMaster.vcAssessorId:=edtm.Text;
  //------显示明细数据--------------//
  sgorder.RowCount:=dmmain.CDSquery2.RecordCount+1;
    for iRow := 1 to dmmain.CDSquery2.RecordCount do
    begin
   //
      sgorder.Cells[0, iRow] := IntToStr(dmmain.CDSquery2.RecNo);
      sgorder.Cells[1, iRow]:= trim(dmmain.CDSquery2.fieldbyname('type').AsString);
      sgorder.Cells[2, iRow]:=trim(dmmain.CDSquery2.fieldbyname('vcPtypeid').AsString);//编码
      sgorder.Cells[3, iRow]:=trim(dmmain.CDSquery2.fieldbyname('goods_name').AsString);
      sgorder.Cells[6,iRow] := trim(dmmain.CDSquery2.Fieldbyname('vcGoodUnitId').AsString);
      sgorder.Cells[7,iRow] := trim(dmmain.CDSquery2.Fieldbyname('nuOutQuantity').AsString);
      sgorder.Cells[8,iRow] := trim(dmmain.CDSquery2.Fieldbyname('SendPrice').AsString);
      sgorder.Cells[9,iRow] := trim(dmmain.CDSquery2.Fieldbyname('SendTotal').AsString);
      sgorder.Cells[21,iRow] := trim(dmmain.CDSquery2.Fieldbyname('stock_amount').AsString);
      sgorder.Cells[11,iRow ] := '10';
      dmmain.CDSquery2.Next;
    end;
    except
    end;
    Result := True;
  except
    Result := False;
  end;
end;




/////////////////////////////
procedure TfmUnPosSendBill.Cmd_AddClick(Sender: TObject);
begin
  inherited;
  addgridrows(sgorder);
end;

procedure TfmUnPosSendBill.Cmd_DeleteClick(Sender: TObject);
begin
  inherited;
  deletegridrows(sgorder,prow);
end;

procedure TfmUnPosSendBill.SpeedButton1Click(Sender: TObject);
begin
  inherited;
   dlgselectps:=Tdlgselectps.Create(self);
  dlgselectps.ShowModal;
  if dmmain.CDSdata.IsEmpty  then exit;
  Edtsendstock.Text:=Trim(dmmain.CDSdata.fieldbyname('managerid').AsString);
  SendMaster.vcSendStockID:=Trim(dmmain.CDSdata.fieldbyname('managerid').AsString);
  dmmain.CDSdata.Close;
  dmmain.CDSdata.Data:=null;
  dlgselectps.Free;
end;

procedure TfmUnPosSendBill.BitBtn1Click(Sender: TObject);
begin
  inherited;
  sendmaster.vcListerId:=trim(Handle_Man);
  if not CheckData then Exit;
  if not SaveData then Exit;
  FormIni;
end;

procedure TfmUnPosSendBill.sgorderDblClick(Sender: TObject);
begin
  inherited;
  if trim(EdtsendStock.Text)='' then
  begin
    application.MessageBox('请选择配送仓库!',pchar(application.Title),mb_iconinformation);
    EdtsendStock.SetFocus;
    exit;
  end;
  if (pcol = 1) or (pcol =2) then
  begin
    fmSelgoodCode:= TfmSelgoodCode.Create(nil);
     try
    officeid:=Handle_Part ;
    fmSelgoodCode.show_mode := '配送退货单';
    fmSelgoodCode.billtyped:='501';//申请;
    fmSelgoodCode.storage_no:= trim(EdtsendStock.Text);
    fmSelgoodCode.ShowModal;
    finally
    fmSelgoodCode.Free;
    end;
  end;
end;


procedure TfmUnPosSendBill.BitBtn2Click(Sender: TObject);
begin
  inherited;
  close;
end;

procedure TfmUnPosSendBill.sgorderSelectCell(Sender: TObject; ACol,
  ARow: Integer; var CanSelect: Boolean);
begin
  inherited;
  pcol:=acol;
  prow:=arow;
end;

procedure TfmUnPosSendBill.bitcheckClick(Sender: TObject);
var
  user,s,temp,remarks,ofid:widestring;
  flag,intof:olevariant;
  totals:double;
  i:integer;
begin
  inherited;
  if trim(sBillId)=''then exit;
  if trim(sgorder.Cells[1,1])='' then exit;
  no:=trim(edtbillno.Text);
  s:=trim(EdtSendStock.Text);
  typed:='配送退货单';
  user:=trim(Handle_No);
  flag:=adisp.receipted(no,typed,user,1,Handle_Part);
  if flag='3' then //
  begin
    //////////////
    try
    flag:=ipubtemp.batchstock(no,3);
    //////////////////////////////////////////////////////////////
    except
      application.MessageBox('服务器发生故障!',pchar(application.Title),mb_iconwarning);
      exit;
    end;
    ////////////////////
  end;
  if flag='1' then
  begin
    application.MessageBox('审核成功!',pchar(application.Title),mb_iconinformation);
    close;
    exit;
  end;
  if flag='2' then
  begin
    application.MessageBox('无权进行进行审核',pchar(application.Title),mb_iconinformation);
    exit;
  end;
  if flag='3' then
  begin
    application.MessageBox('审核完毕!',pchar(application.Title),mb_iconinformation);
    close;
    //exit;
  end;
  if flag='4' then
  begin
    application.MessageBox('反审核完毕!',pchar(application.Title),mb_iconinformation);
    exit;
  end;
  if flag='5' then
  begin
    application.MessageBox('反审核成功!',pchar(application.Title),mb_iconinformation);
    exit;
  end;
  if flag='6' then
  begin
    application.MessageBox('单据过帐后,不能进行审核或反审核!',pchar(application.Title),mb_iconinformation);
    exit;
  end;

end;

procedure TfmUnPosSendBill.SpeedButton4Click(Sender: TObject);
begin
  inherited;
  Employe_Check:='';
  Employe_Check:='Storage_Umanage_Fad';
  Employe_Check_Result:='';
  frm_Login_Man:=Tfrm_Login_Man.Create(self);
  frm_Login_Man.Caption:='经手人选择';
  frm_Login_Man.ShowModal;
  SendMaster.vcEId := Employe_Check_Result;
  EdtG.Text := Employe_Check_Result;
  Perform(WM_NEXTDLGCTL, 0, 0);
end;

procedure TfmUnPosSendBill.sgorderKeyPress(Sender: TObject; var Key: Char);
begin
  inherited;
  if (pcol =7)   then
  begin
    if not (key in ['0'..'9',#8]) then    //数量没有小数点
    key:=#0;
    sgorder.Options := sgorder.Options+ [goediting];
  end else
  begin
   sgorder.Options := sgorder.Options - [goediting];

  end;
end;

procedure TfmUnPosSendBill.sgorderMouseMove(Sender: TObject;
  Shift: TShiftState; X, Y: Integer);
var
  i:integer;  
begin
  inherited;
  if prow<>0 then
  begin
    if (trim(sgorder.Cells[7,prow])<>'') and (trim(sgorder.Cells[21,prow])<>'') then
    begin
      if strtoint(sgorder.Cells[7,prow])> strtoint(sgorder.Cells[21,prow]) then
      begin
        sgorder.Cells[7,prow]:='0';
        application.MessageBox('数量已超过配送数量!',pchar(application.Title),mb_iconinformation);
        exit;
      end;
    end;  
  end;

end;

procedure TfmUnPosSendBill.sgorderDrawCell(Sender: TObject; ACol,
  ARow: Integer; Rect: TRect; State: TGridDrawState);
var
  s:string;
  r:TRect;
begin
  inherited;
 with Sender as Tstringgrid do
  begin
  if gdSelected in State then
  Canvas.Brush.Color:= clTeal;  //clBlue; //clyellow;//clRed;
  Canvas.TextRect(Rect,Rect.Left,Rect.Top,' '+Cells[ACol,ARow]);
  if gdFocused in State then
  Canvas.DrawFocusRect(Rect);
  end;

with Sender as Tstringgrid do
begin
  Canvas.FillRect(Rect);
  s:=Cells[ACol,ARow];
  r:=Rect;
  DrawText(Canvas.Handle,PChar(s),Length(s),r,DT_CENTER or DT_SINGLELINE or DT_VCENTER);
end;

end;

end.

⌨️ 快捷键说明

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