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

📄 editbillunit.~pas

📁 工商收费系统,主要是管理非税收收入的费用的管理
💻 ~PAS
字号:
unit EditBillUnit;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Mask, jpeg, ExtCtrls, DB, ADODB, DBCtrls, Buttons,
  dxCntner, dxExEdtr, dxEdLib, ComCtrls;

type
  TEditBillUnit = class(TForm)
    SBSave: TSpeedButton;
    SBAbort: TSpeedButton;
    SBExit: TSpeedButton;
    pnl1: TPanel;
    Label1: TLabel;
    dbedtID: TDBEdit;
    DSObject: TDataSource;
    AQeyObject: TADOQuery;
    adoConnMain: TADOConnection;
    Image1: TImage;
    SBData: TSpeedButton;
    SBBizmanId: TSpeedButton;
    SBFeeData: TSpeedButton;
    SpeedButton1: TSpeedButton;
    YearEdt: TMaskEdit;
    MouthEdt: TMaskEdit;
    DayEdt: TMaskEdit;
    DBEdtBizmanId: TDBEdit;
    DBEditBizmanName: TDBEdit;
    DBEdtFeeData: TDBEdit;
    ComboBox1: TComboBox;
    ComboBox2: TComboBox;
    ComboBox3: TComboBox;
    DBEdtFee1: TDBEdit;
    DBEdtFee2: TDBEdit;
    DBEdtFee3: TDBEdit;
    DBEdtQuantity1: TDBEdit;
    DBEdtQuantity2: TDBEdit;
    DBEdtQuantity3: TDBEdit;
    MoneyEdt: TEdit;
    DBEdtNote: TDBEdit;
    ListBoxDirector: TListBox;
    ListBoxPayee: TListBox;
    ChBxNoCon: TdxCheckEdit;
    SpeedButton2: TSpeedButton;
    SpeedButton3: TSpeedButton;
    SpeedButton4: TSpeedButton;
    SpeedButton5: TSpeedButton;
    xjEdt1: TEdit;
    Edit1: TEdit;
    Edit2: TEdit;
    Edit3: TEdit;
    MonthCalendar1: TMonthCalendar;
    procedure SpeedButton1Click(Sender: TObject);
    procedure SBDataClick(Sender: TObject);
    procedure MonthCalendar1Click(Sender: TObject);
    procedure YearEditExit(Sender: TObject);
    procedure MouthEditExit(Sender: TObject);
    procedure DayEditExit(Sender: TObject);
    procedure YearEditClick(Sender: TObject);
    procedure MouthEditClick(Sender: TObject);
    procedure DayEditClick(Sender: TObject); 
    Function ChangeMoneyLowcaseToUppercase(sNum:string):String;
    Function DBEditCheck(edt:TDBEdit):Currency;
    Function EditCheck(ed:TEdit):Currency;


private
    strYear:string;
    strMouth:string;    strDay:string;
    strForSaveMoney:string;
    strForSaveDate:string;
    { Private declarations }
public
    { Public declarations }
end;

var
  //EditBillUnit: TEditBillUnit;

implementation

{$R *.dfm}

procedure TEditBillUnit.SpeedButton1Click(Sender: TObject);
begin
  var strTmp:string;
    xjEdt1.SetFocus;   strTmp:=currtostr((DBEditCheck(DBEdtFee1)*DBEdtQuantity1);   //=(strtoint(DBEdtFee1.Text)*(strtoint(DBEdtQuantity1.Text))    if strTmp<>'0' then      xjEdt1.text:=strTmp;    xjEdt2.SetFocus;    strTmp:=currtostr((DBEditCheck(DBEdtFee2))*DBEdtQuantity2);    if strTmp<>'0' then      xjEdt2.text:=strTmp;    xjEdt3.SetFocus;    strTmp:=currtostr((DBEditCheck(DBEdtFee3))*DBEdtQuantity3);    if strTmp<>'0' then      xjEdt3.text:=strTmp;  //以下计算合计     strMoney:=currtostr(EditCheck(xjEdt1)+EditCheck(xjEdt2)                  +EditCheck(xjEdt3));    if strMoney<>'0' then      xjEdt.text:=strMoney;    if ChangeMoneyLowcaseToUppercase(strMoney)='-1' then     begin         Application.MessageBox('金额输入错误!请重新输入',                '提示',MB_OK+MB_DefButton1+MB_IconInformation+MB_ApplModal);         moneyEdt.SetFocus;         exit;     end;    strForSaveMoney:=strMoney;    MoneyEdt.Text:= ChangeMoneyLowcaseToUppercase(strMoney);    setexitcolor(MoneyEdt);end;

procedure TEditBillUnit.SBDataClick(Sender: TObject);
var
   WordYear:Word;   WordMouth:Word;   WordDay:Word;begin   MonthCalendar1.Left :=152;   MonthCalendar1.Top :=64;   MonthCalendar1.Visible:=not MonthCalendar1.Visible;   if  not MonthCalendar1.Visible  then      begin         DecodeDate(MonthCalendar1.Date,WordYear,WordMouth,WordDay);         YearEdt.Text :=IntToStr(WordYear);         MouthEdt.Text :=IntToStr(WordMouth);         DayEdt.Text :=IntToStr(WordDay);      end   else      begin         try            MonthCalendar1.Date :=EncodeDate(StrToInt(YearEdt.Text),                                  StrToInt(trim(MouthEdt.Text)),                                  StrToInt(trim(DayEdt.Text)));         except            Application.MessageBox('开票日期填写有错误,请检查填写内容',                       '提示',MB_OK+MB_DefButton1+MB_IconInformation+MB_ApplModal);            yearEdt.SetFocus;         end;      end;   if Length(Trim(MouthEdt.Text))=1 then      MouthEdt.Text:= '0'+Trim(MouthEdt.Text);   strMouth:=MouthEdt.Text;   if Length(Trim(DayEdt.Text))=1 then      DayEdt.Text:= '0'+Trim(DayEdt.Text);   strDay:=DayEdt.Text;   strYear:=YearEdt.Text;begin

end;


end.
  ////////////////////////////////////////////////
//将人民币小写转换成大写//输入变量:sNum-人民币小写//输出变量:''-表示无,'-1'—表示格式错误,其他表示人民币大写//编制人:宫俊//编制日期:2001-09-28//修改人:陈宇//修改日期:2001-11-30//修改人:郝志远//修改日期:2002-5-9////////////////////////////////////////////////Function ChangeMoneyLowcaseToUppercase(sNum:string):String;var   i:integer;   intPosition:integer;//小数点的位置   TempStr:string;//临时变量   strTemp:string;//临时变量   strLeft:string;//小数点左边的变量   strRight:string;//小数点右边的变量begin   if Trim(sNum)='' then      begin         Result:='';         Exit;      end;   intPosition:=Pos('.',sNum);   if intPosition<>0 then      begin         strLeft:=Copy(sNum,1,intPosition-1);         strRight:=Copy(sNum,intPosition+1,Length(sNum)-intPosition);         if Length(strRight)=1 then            strRight:=strRight+'0';      end   else      begin         strLeft:=sNum;         strRight:='';      end;    try       //i:=StrToInt(strLeft);       //郝志远       //2002-01-10       i:=StrToInt64(strLeft);       if strRight<>'' then          i:=StrToInt(strRight);       if Length(strRight)>2 then          begin             Result:='-1';             Exit;          end;    except       Result:='-1';       Exit;    end;   if  Length(strRight)>3 then      begin         Result:='-1';         Exit;      end;   if strLeft<>'' then    begin         for i:=1 to length(strLeft) do           begin                TempStr:=UpperNumber(strLeft,i);                if (tempStr<>'') and (tempStr<>'零') then begin                    if (i=9) and (Copy(Result,1,2)='万') then                       Delete(Result,1,2);                    TempStr:=TempStr+gMoneyUpperCase[i-1];                end;//                if ( TempStr='零' ) and ( Copy(Result,1,2)<>'零' ) then                if ( TempStr='零' ) and (Result<>'')                   and (Copy(Result,1,2)<>'零')                   and (Copy(Result,1,2)<>'万')                then                   Result:='零'+Result;                if ( TempStr='零' ) and ( i=5 )  then                   Result:='万'+Result;                ///////////////////////////                //修改人:郝志远                //修改时间:2002-5-9                if ( TempStr='零' ) and ( i=9 )  then                   begin                     if copy(Result,1,2)='万' then                       delete(Result,1,2);                     Result:='亿'+Result;                   end;                ///////////////////////////                if ( TempStr<>'零' ) then                   Result:=TempStr+Result;           end;//         if Copy(sNum,Length(sNum),1)='0' then           if (Result<>'') and (Copy(strLeft,Length(strLeft),1)='0') then             Result:=Result+'元';    end;   if (strRight<>'') and (strRight<>'00') then    begin         strTemp:='';         for i:=1 to length(strRight) do           begin                TempStr:=UpperNumber(strRight,i);                if (TempStr<>'') and (TempStr<>'零') then                    TempStr:=TempStr+gMoneyLowerCase[i-1];                if not ((TempStr='零') and (strTemp='')) then                   strTemp:=TempStr+strTemp;           end;         if(strLeft<>'0')and(Copy(strLeft,Length(strLeft),1)='0')and(TempStr<>'零') then            strTemp:='零'+strTemp;    end;    Result:=Result+strTemp;    if  (Result<>'') and (Copy(Result,Length(Result)-1,2)<>'分') then         Result:=Result+'整';    if Result='' then Result:='零元整';end;Function DBEditCheck(edt:TDBEdit):Currency;
begin   if trim(edt.Text)='' then      result:=0   else     result:=strtocurr(trim(edt.text));end;Function EditCheck(ed:TEdit):Currency;begin   if trim(ed.Text)='' then      result:=0   else     result:=strtocurr(trim(ed.text));end;
procedure YearEditExit(Sender: TObject);
begin   if Length(Trim(YearEdt.Text))<4 then      begin         Application.MessageBox('请按2001格式输入!','错误',mb_OK+mb_IconStop);         YearEdt.SetFocus ;         Exit;      end;   if Trim(MouthEdt.Text) ='' then      begin         MouthEdt.SetFocus ;         strYear:=YearEdt.Text;         Exit;      end;   if Trim(DayEdt.Text) ='' then      begin         DayEdt.SetFocus ;         strYear:=YearEdt.Text;         Exit;      end;   try      EncodeDate(StrToInt(YearEdt.Text),StrToInt(MouthEdt.Text),                 StrToInt(DayEdt.Text));   except      begin         Application.MessageBox('日期范围错误!','错误',mb_OK+mb_IconStop);         DayEdt.SetFocus ;         Exit;      end;   end;   strYear:=YearEdt.Text;end;procedure MouthEditExit(Sender: TObject);Var   intMonth:integer;begin   if Length(Trim(MouthEdt.Text))=1 then      MouthEdt.Text:= '0'+Trim(MouthEdt.Text);   intMonth:=strToInt(Trim(MouthEdt.Text));   if (intMonth>12) or  (intMonth<1 ) then      begin         Application.MessageBox('月份范围错误!','错误',mb_OK+mb_IconStop);         MouthEdt.Text :='';         MouthEdt.SetFocus ;         Exit;      end;   if Trim(YearEdt.Text) ='' then      begin         YearEdt.SetFocus ;         strMouth:=MouthEdt.Text;         Exit;      end;   if Trim(MouthEdt.Text) ='' then      begin         MouthEdt.SetFocus ;         strMouth:=MouthEdt.Text;         Exit;      end;   if Trim(DayEdt.Text) ='' then      begin         DayEdt.SetFocus ;         strMouth:=MouthEdt.Text;         Exit;      end;   try      EncodeDate(StrToInt(YearEdt.Text),StrToInt(MouthEdt.Text),                 StrToInt(DayEdt.Text));   except      begin         Application.MessageBox('日期范围错误!','错误',mb_OK+mb_IconStop);         DayEdt.SetFocus ;         Exit;      end;   end;   strMouth:=MouthEdt.Text;end;procedure DayEditExit(Sender: TObject);begin   if Trim(YearEdt.Text) ='' then      begin         YearEdt.SetFocus ;         strDay:=DayEdt.Text;         Exit;      end;   if Trim(MouthEdt.Text) ='' then      begin         MouthEdt.SetFocus ;         strDay:=DayEdt.Text;         Exit;      end;   if Trim(DayEdt.Text) ='' then      begin         DayEdt.SetFocus ;         strDay:=DayEdt.Text;         Exit;      end;   if Length(Trim(DayEdt.Text))=1 then      DayEdt.Text:= '0'+Trim(DayEdt.Text);   try      EncodeDate(StrToInt(YearEdt.Text),StrToInt(MouthEdt.Text),                 StrToInt(DayEdt.Text));   except      begin         Application.MessageBox('日期范围错误!','错误',mb_OK+mb_IconStop);         DayEdt.SetFocus ;         Exit;      end;   end;   strDay:=DayEdt.Text;end;procedure YearEditClick(Sender: TObject);var   WordYear:Word;   WordMouth:Word;   WordDay:Word;begin   if trim(YearEdt.Text) ='' then      begin         DecodeDate(Date,WordYear,WordMouth,WordDay);         YearEdt.Text :=IntToStr(WordYear);      end;end;procedure MouthEditClick(Sender: TObject);var   WordYear:Word;   WordMouth:Word;   WordDay:Word;begin   if trim(MouthEdt.Text) ='' then      begin         DecodeDate(Date,WordYear,WordMouth,WordDay);         MouthEdt.Text :=IntToStr(WordMouth);      end;end;procedure DayEditClick(Sender: TObject);var   WordYear:Word;   WordMouth:Word;   WordDay:Word;begin   if trim(DayEdt.Text) ='' then      begin         DecodeDate(Date,WordYear,WordMouth,WordDay);         DayEdt.Text :=IntToStr(WordDay);      end;end;

⌨️ 快捷键说明

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