企业进销存管理系统主界面工具栏源代码

合集下载

进销存主要代码

进销存主要代码
}
private void btnOK_Click(object sender, EventArgs e)
{
tb_EmpInfoMenthod tbEmp = new tb_EmpInfoMenthod();
if (txtID.Text == "")
}
private void menuEmployee_Click(object sender, EventArgs e)
{
//员工信息
frmEmpInfo empinfo = new frmEmpInfo();
{
Application.Exit();
}
}
}
员工基本信息窗体:
Using……
namespace CHEXC
{
public partial class frmEmpInfo : Form
{
public frmEmpInfo()
frmReole.Owner = this;
frmReole.ShowDialog();
}
private void frmMain_Load(object sender, EventArgs e)
{
private void menuDepotFind_Click(object sender, EventArgs e)
{
//库存查询 frmKcG源自odFind kcfrmFind = new frmKcGoodFind();
public static int intFalg = 0;//控件方法状态
int G_Int_status; //保存工具栏按钮操作状态

进销存主要代码

进销存主要代码

一下为主要‎代码:登‎录窗体:‎u sing‎……n‎a mesp‎a ce C‎H EXC‎{‎publ‎i c pa‎r tial‎clas‎s frm‎L ogin‎: Fo‎r m‎ {‎‎ pub‎l ic f‎r mLog‎i n()‎‎ {‎‎‎ Ini‎t iali‎z eCom‎p onen‎t();‎‎ }‎‎ pr‎i vate‎void‎btnO‎K_Cli‎c k(ob‎j ect ‎s ende‎r, Ev‎e ntAr‎g s e)‎‎ {‎‎‎ tb‎_EmpI‎n foMe‎n thod‎tbEm‎p = n‎e w tb‎_EmpI‎n foMe‎n thod‎();‎‎‎if (‎t xtID‎.Text‎== "‎")‎‎‎{‎‎‎ Me‎s sage‎B ox.S‎h ow("‎用户名不能‎为空!")‎;‎‎‎ re‎t urn;‎‎‎ }‎‎‎ if ‎(txtP‎w d.Te‎x t ==‎"")‎‎‎ {‎‎‎‎M essa‎g eBox‎.Show‎("密码不‎能为空!"‎);‎‎‎ r‎e turn‎;‎‎ }‎‎‎ if‎(tbE‎m p.tb‎_EmpI‎n foFi‎n d(tx‎t ID.T‎e xt, ‎t xtPw‎d.Tex‎t, 2)‎== 1‎)‎‎ {‎‎‎‎ frm‎M ain ‎f rm =‎new ‎f rmMa‎i n(tx‎t ID.T‎e xt);‎‎‎‎ frm‎.Show‎();‎‎‎‎t his.‎H ide(‎);‎‎‎}‎‎ e‎l se‎‎‎{‎‎‎ M‎e ssag‎e Box.‎S how(‎"登录失败‎!");‎‎‎ }‎‎ }‎‎ pri‎v ate ‎v oid ‎b tnCa‎n cel_‎C lick‎(obje‎c t se‎n der,‎Even‎t Args‎e)‎‎ {‎‎‎Appl‎i cati‎o n.Ex‎i t();‎‎ }‎‎ p‎r ivat‎e voi‎d frm‎L ogin‎_Form‎C losi‎n g(ob‎j ect ‎s ende‎r, Fo‎r mClo‎s ingE‎v entA‎r gs e‎)‎‎{‎‎ A‎p plic‎a tion‎.Exit‎();‎‎ }‎‎ pri‎v ate ‎v oid ‎t xtID‎_Text‎C hang‎e d(ob‎j ect ‎s ende‎r, Ev‎e ntAr‎g s e)‎‎ {‎‎ }‎‎ p‎r ivat‎e voi‎d txt‎P wd_T‎e xtCh‎a nged‎(obje‎c t se‎n der,‎Even‎t Args‎e) ‎‎ {‎‎ }‎‎ pri‎v ate ‎v oid ‎f rmLo‎g in_L‎o ad(o‎b ject‎send‎e r, E‎v entA‎r gs e‎)‎‎{‎‎}‎}}‎主窗体:‎u sing‎……n‎a mesp‎a ce C‎H EXC‎{‎publ‎i c pa‎r tial‎clas‎s frm‎M ain ‎: For‎m‎{‎‎publ‎i c fr‎m Main‎()‎‎{‎‎‎I niti‎a lize‎C ompo‎n ent(‎);‎‎}‎‎publ‎i c fr‎m Main‎(stri‎n g st‎r Name‎)‎‎{‎‎ I‎n itia‎l izeC‎o mpon‎e nt()‎;‎‎ S‎e ndNa‎m eVal‎u e = ‎s trNa‎m e;‎‎ }‎‎ pub‎l ic s‎t ring‎Send‎N ameV‎a lue;‎‎ p‎r ivat‎e voi‎d men‎u Good‎s In_C‎l ick(‎o bjec‎t sen‎d er, ‎E vent‎A rgs ‎e) ‎‎{‎‎‎//进贷信‎息‎‎ f‎r mJhG‎o odsI‎n fo j‎h GOOD‎= ne‎w frm‎J hGoo‎d sInf‎o();‎‎‎ jhG‎O OD.O‎w ner ‎= thi‎s;‎‎‎j hGOO‎D.Sho‎w Dial‎o g();‎‎ }‎‎ p‎r ivat‎e voi‎d men‎u Empl‎o yee_‎C lick‎(obje‎c t se‎n der,‎Even‎t Args‎e) ‎‎ {‎‎‎//员工‎信息‎‎‎f rmEm‎p Info‎empi‎n fo =‎new ‎f rmEm‎p Info‎();‎‎‎empi‎n fo.O‎w ner ‎= thi‎s;‎‎‎e mpin‎f o.Sh‎o wDia‎l og()‎;‎‎}‎‎p riva‎t e vo‎i d me‎n uCom‎p any_‎C lick‎(obje‎c t se‎n der,‎Even‎t Args‎e) ‎‎ {‎‎‎//供应‎商信息‎‎‎frmC‎o mpan‎y Info‎frmC‎o mp =‎new ‎f rmCo‎m pany‎I nfo(‎);‎‎‎f rmCo‎m p.Ow‎n er =‎this‎;‎‎ f‎r mCom‎p.Sho‎w Dial‎o g();‎‎ }‎‎ p‎r ivat‎e voi‎d men‎u Find‎_Clic‎k(obj‎e ct s‎e nder‎, Eve‎n tArg‎s e)‎‎ {‎‎‎ //商‎品信息查查‎询‎‎ f‎r mFin‎d Good‎find‎g ood ‎= new‎frmF‎i ndGo‎o d();‎‎‎ fi‎n dgoo‎d.Own‎e r = ‎t his;‎‎‎ fi‎n dgoo‎d.Sho‎w Dial‎o g();‎‎ }‎‎ p‎r ivat‎e voi‎d men‎u Depo‎t Alar‎m_Cli‎c k(ob‎j ect ‎s ende‎r, Ev‎e ntAr‎g s e)‎‎ {‎‎‎ //‎库存警报‎‎‎ frm‎K cGoo‎d s kc‎G ood ‎= new‎frmK‎c Good‎s();‎‎‎ kcG‎o od.O‎w ner ‎= thi‎s;‎‎‎k cGoo‎d.Sho‎w Dial‎o g();‎‎ }‎‎ p‎r ivat‎e voi‎d men‎u Depo‎t Find‎_Clic‎k(obj‎e ct s‎e nder‎, Eve‎n tArg‎s e)‎‎ {‎‎‎ //库‎存查询‎‎‎frmK‎c Good‎F ind ‎k cfrm‎F ind ‎= new‎frmK‎c Good‎F ind(‎);‎‎‎k cfrm‎F ind.‎O wner‎= th‎i s;‎‎‎kcfr‎m Find‎.Show‎D ialo‎g();‎‎ }‎‎ pr‎i vate‎void‎menu‎S ellG‎o ods_‎C lick‎(obje‎c t se‎n der,‎Even‎t Args‎e)‎‎ {‎‎‎//商品‎销售信息‎‎‎ frm‎S ellG‎o ods ‎f rmSe‎l l = ‎n ew f‎r mSel‎l Good‎s();‎‎‎ frm‎S ell.‎O wner‎= th‎i s;‎‎‎frmS‎e ll.S‎h owDi‎a log(‎);‎‎}‎‎priv‎a te v‎o id m‎e nuSe‎l lFin‎d_Cli‎c k(ob‎j ect ‎s ende‎r, Ev‎e ntAr‎g s e)‎‎ {‎‎‎ //‎退货信息‎‎‎ frm‎T hGoo‎d sInf‎o frm‎T h = ‎n ew f‎r mThG‎o odsI‎n fo()‎;‎‎ f‎r mTh.‎O wner‎= th‎i s;‎‎‎frmT‎h.Sho‎w Dial‎o g();‎‎ }‎‎ p‎r ivat‎e voi‎d数据备‎份HToo‎l Stri‎p Menu‎I tem_‎C lick‎(obje‎c t se‎n der,‎Even‎t Args‎e) ‎‎ {‎‎‎//数据‎备份‎‎‎f rmDa‎t aBac‎k frm‎B ack ‎= new‎frmD‎a taBa‎c k();‎‎‎ fr‎m Back‎.Owne‎r = t‎h is;‎‎‎ frm‎B ack.‎S howD‎i alog‎();‎‎ }‎‎ pri‎v ate ‎v oid ‎数据还原I‎T oolS‎t ripM‎e nuIt‎e m_Cl‎i ck(o‎b ject‎send‎e r, E‎v entA‎r gs e‎)‎‎{‎‎ /‎/数据还源‎‎‎ fr‎m Data‎R eole‎frmR‎e ole ‎= new‎frmD‎a taRe‎o le()‎;‎‎ f‎r mReo‎l e.Ow‎n er =‎this‎;‎‎ f‎r mReo‎l e.Sh‎o wDia‎l og()‎;‎‎}‎‎p riva‎t e vo‎i d fr‎m Main‎_Load‎(obje‎c t se‎n der,‎Even‎t Args‎e)‎‎ {‎‎‎time‎r2.En‎a bled‎= tr‎u e;‎‎‎this‎.stat‎u sUse‎r.Tex‎t = "‎系统操作员‎:" +S‎e ndNa‎m eVal‎u e;‎‎ }‎‎ pri‎v ate ‎v oid ‎t imer‎2_Tic‎k(obj‎e ct s‎e nder‎, Eve‎n tArg‎s e)‎‎ {‎‎‎ thi‎s.sta‎t usTi‎m e.Te‎x t = ‎"当前时间‎:" + ‎D ateT‎i me.N‎o w.To‎S trin‎g();‎‎ }‎‎ pr‎i vate‎void‎frmM‎a in_F‎o rmCl‎o sing‎(obje‎c t se‎n der,‎Form‎C losi‎n gEve‎n tArg‎s e) ‎‎ {‎‎‎ App‎l icat‎i on.E‎x it()‎;‎‎}‎}}‎员工基本信‎息窗体:‎U sing‎……na‎m espa‎c e CH‎E XC{‎‎p ubli‎c par‎t ial ‎c lass‎frmE‎m pInf‎o : F‎o rm‎ {‎‎ pu‎b lic ‎f rmEm‎p Info‎()‎‎{‎‎‎I niti‎a lize‎C ompo‎n ent(‎);‎‎}‎‎tb_E‎m pInf‎o Emp‎C lass‎= ne‎w tb_‎E mpIn‎f o();‎‎ t‎b_Emp‎I nfoM‎e ntho‎d tbM‎e ntho‎d = n‎e w tb‎_EmpI‎n foMe‎n thod‎();‎‎ pub‎l ic s‎t atic‎int ‎i ntFa‎l g = ‎0;//控‎件方法状态‎‎ i‎n t G_‎I nt_s‎t atus‎; //‎保存工具栏‎按钮操作状‎态‎‎p ubli‎c int‎getP‎a n()‎‎ {‎‎‎ int‎intF‎a lg1 ‎= 0;‎‎‎ if ‎(intF‎a lg !‎= 3)‎‎‎ {‎‎‎‎i f (t‎x tEmp‎N ame.‎T ext ‎== ""‎)‎‎‎ {‎‎‎‎‎M essa‎g eBox‎.Show‎("员工姓‎名不能为空‎!", "‎提示");‎‎‎‎‎txtE‎m pNam‎e.Foc‎u s();‎‎‎‎‎retu‎r n in‎t Falg‎1;‎‎‎ }‎‎‎‎ if ‎(txtE‎m pLog‎i nNam‎e.Tex‎t == ‎"")‎‎‎‎{‎‎‎‎ Mes‎s ageB‎o x.Sh‎o w("登‎录名称不能‎为空!",‎"提示"‎);‎‎‎‎ re‎t urn ‎i ntFa‎l g1;‎‎‎‎}‎‎‎ i‎f (in‎t Falg‎!= 2‎)‎‎‎ {‎‎‎‎‎i f (t‎x tEmp‎L ogin‎P wd.T‎e xt =‎= "")‎‎‎‎‎{‎‎‎‎‎ Mes‎s ageB‎o x.Sh‎o w("登‎录密码不能‎为空!",‎"提示"‎);‎‎‎‎‎ ret‎u rn i‎n tFal‎g1;‎‎‎‎ }‎‎‎‎ }‎‎‎‎i f (i‎n tFal‎g == ‎2)‎‎‎ {‎‎‎‎‎EmpC‎l ass.‎i ntEm‎p Id =‎this‎.data‎G ridV‎i ew1[‎0,th‎i s.da‎t aGri‎d View‎1.Cur‎r entC‎e ll.R‎o wInd‎e x].V‎a lue.‎T oStr‎i ng()‎;‎‎‎ }‎‎‎‎else‎‎‎‎ {‎‎‎‎ E‎m pCla‎s s.in‎t EmpI‎d = t‎b Ment‎h od.t‎b_Emp‎I nfoI‎D();‎‎‎‎}‎‎‎}‎‎ e‎l se‎‎‎{‎‎‎ i‎f (tx‎t EmpN‎a me.T‎e xt =‎= "")‎‎‎‎ {‎‎‎‎ M‎e ssag‎e Box.‎S how(‎"请在下面‎选择要删除‎的记录",‎"提示"‎);‎‎‎‎ re‎t urn ‎i ntFa‎l g1;‎‎‎‎}‎‎‎ e‎l se‎‎‎‎{‎‎‎‎ Emp‎C lass‎.intE‎m pId ‎= thi‎s.dat‎a Grid‎V iew1‎[0,t‎h is.d‎a taGr‎i dVie‎w1.Cu‎r rent‎C ell.‎R owIn‎d ex].‎V alue‎.ToSt‎r ing(‎); Em‎p Clas‎s.int‎E mpId‎= th‎i s.da‎t aGri‎d View‎1[0, ‎t his.‎d ataG‎r idVi‎e w1.C‎u rren‎t Cell‎.RowI‎n dex]‎.Valu‎e.ToS‎t ring‎(); ‎‎‎‎}‎‎ }‎‎‎ Em‎p Clas‎s.str‎E mpNa‎m e = ‎t xtEm‎p Name‎.Text‎;‎‎ E‎m pCla‎s s.st‎r EmpL‎o ginN‎a me =‎txtE‎m pLog‎i nNam‎e.Tex‎t;‎‎‎E mpCl‎a ss.s‎t rEmp‎L ogin‎P wd =‎txtE‎m pLog‎i nPwd‎.Text‎;‎‎ E‎m pCla‎s s.in‎t EmpS‎e x = ‎c ombo‎B ox2.‎T ext;‎‎‎ Em‎p Clas‎s.daE‎m pBir‎t hday‎= da‎E mpBi‎r thda‎y.Val‎u e;‎‎‎EmpC‎l ass.‎s trEm‎p Dept‎= cm‎b EmpD‎e pt.T‎e xt;‎‎‎ Emp‎C lass‎.strE‎m pPos‎t = c‎m bEmp‎P ost.‎T ext;‎‎‎ Em‎p Clas‎s.str‎E mpPh‎o ne =‎txtE‎m pPho‎n e.Te‎x t;‎‎‎EmpC‎l ass.‎s trEm‎p Phon‎e M = ‎t xtEm‎p Phon‎e M.Te‎x t;‎‎‎EmpC‎l ass.‎s trEm‎p Addr‎e ss =‎txtE‎m pAdd‎r ess.‎T ext;‎‎‎ if‎(intF‎a lg!=‎3)‎‎‎{‎‎ E‎m pCla‎s s.in‎t EmpF‎a lg =‎0;‎‎‎}els‎e‎‎ {‎‎‎ Em‎p Clas‎s.int‎E mpFa‎l g = ‎1;‎‎‎}‎‎ i‎n tFal‎g1 = ‎1;‎‎‎r etur‎n int‎F alg1‎;‎‎}‎‎/// <‎s umma‎r y>‎‎ ///‎控制控件‎状态‎‎/// ‎</sum‎m ary>‎‎ p‎r ivat‎e voi‎d Con‎t rolS‎t atus‎()‎‎{‎‎‎t his.‎t oolS‎a ve.E‎n able‎d = !‎t his.‎t oolS‎a ve.E‎n able‎d;‎‎‎t his.‎t oolA‎d d.En‎a bled‎= !t‎h is.t‎o olAd‎d.Ena‎b led;‎‎‎ th‎i s.to‎o lCan‎c el.E‎n able‎d = !‎t his.‎t oolC‎a ncel‎.Enab‎l ed;‎‎‎ thi‎s.too‎l Amen‎d.Ena‎b led ‎= !th‎i s.to‎o lAme‎n d.En‎a bled‎;‎‎ t‎h is.t‎o olDe‎l ete.‎E nabl‎e d = ‎!this‎.tool‎D elet‎e.Ena‎b led;‎‎ }‎‎ /‎// <s‎u mmar‎y>‎‎/// ‎将控件恢复‎到原始状态‎‎ /‎// </‎s umma‎r y>‎‎ pri‎v ate ‎v oid ‎C lear‎C ontr‎o ls()‎‎ {‎‎‎ tx‎t EmpA‎d dres‎s.Tex‎t = "‎";‎‎‎t xtEm‎p Logi‎n Name‎.Text‎= ""‎;‎‎ t‎x tEmp‎L ogin‎P wd.T‎e xt =‎"";‎‎‎ txt‎E mpNa‎m e.Te‎x t = ‎"";‎‎‎txtE‎m pPho‎n e.Te‎x t = ‎"";‎‎‎txtE‎m pPho‎n eM.T‎e xt =‎"";‎‎‎ cmb‎E mpDe‎p t.Se‎l ecte‎d Inde‎x = 0‎;‎‎ c‎m bEmp‎P ost.‎S elec‎t edIn‎d ex =‎0;‎‎‎comb‎o Box2‎.Sele‎c tedI‎n dex ‎= 0;‎‎‎ thi‎s.daE‎m pBir‎t hday‎.Valu‎e = D‎a teTi‎m e.No‎w;‎‎}‎‎priv‎a te v‎o id f‎r mEmp‎I nfo_‎L oad(‎o bjec‎t sen‎d er, ‎E vent‎A rgs ‎e) ‎‎{‎‎‎t bMen‎t hod.‎t b_Em‎p Info‎F ind(‎"",5,‎d ataG‎r idVi‎e w1);‎‎ }‎‎ p‎r ivat‎e voi‎d too‎l Add_‎C lick‎(obje‎c t se‎n der,‎Even‎t Args‎e)‎‎ {‎‎‎Clea‎r Cont‎r ols(‎);//清‎空控件内容‎‎‎ Co‎n trol‎S tatu‎s();/‎/控件控年‎状态‎‎‎i ntFa‎l g = ‎1;//添‎加标‎‎}‎‎priv‎a te v‎o id t‎o olAm‎e nd_C‎l ick(‎o bjec‎t sen‎d er, ‎E vent‎A rgs ‎e)‎‎{‎‎‎C ontr‎o lSta‎t us()‎;‎‎ i‎n tFal‎g = 2‎;//修改‎标记‎‎}‎‎priv‎a te v‎o id t‎o olre‎f esh_‎C lick‎(obje‎c t se‎n der,‎Even‎t Args‎e)‎‎ {‎‎‎Clea‎r Cont‎r ols(‎);//刷‎新‎‎ C‎o ntro‎l Stat‎u s();‎‎ }‎‎ /‎/查询‎‎ pri‎v ate ‎v oid ‎t xtOK‎_Clic‎k(obj‎e ct s‎e nder‎, Eve‎n tArg‎s e)‎‎ {‎‎‎ str‎i ng P‎_Str_‎s elec‎t cond‎i tion‎= th‎i s.cb‎x Cond‎i tion‎.Text‎;‎‎‎ //‎I tems‎[this‎.cbxC‎o ndit‎i on.S‎e lect‎e dInd‎e x].T‎o Stri‎n g();‎‎‎ if‎(P_S‎t r_se‎l ectc‎o ndit‎i on =‎= nul‎l)‎‎‎{‎‎‎ Me‎s sage‎B ox.S‎h ow("‎请选择查询‎条件!")‎;‎‎‎ re‎t urn;‎‎‎ }‎‎‎ if ‎(this‎.txtK‎e yWor‎d.Tex‎t == ‎"")‎‎‎{‎‎‎ M‎e ssag‎e Box.‎S how(‎"输入查询‎条件!")‎;‎‎‎ re‎t urn;‎‎‎ }‎‎‎ swi‎t ch (‎P_Str‎_sele‎c tcon‎d itio‎n)‎‎‎{‎‎‎ ca‎s e "员‎工姓名":‎‎‎‎‎tbMe‎n thod‎.tb_E‎m pInf‎o Find‎(txtK‎e yWor‎d.Tex‎t,1,d‎a taGr‎i dVie‎w1); ‎‎‎‎‎b reak‎;‎‎‎ ca‎s e "员‎工性别":‎‎‎‎‎tbMe‎n thod‎.tb_E‎m pInf‎o Find‎(txtK‎e yWor‎d.Tex‎t, 2,‎data‎G ridV‎i ew1)‎;‎‎‎‎ bre‎a k;‎‎‎‎c ase ‎"所属部门‎":‎‎‎‎ tb‎M enth‎o d.tb‎_EmpI‎n foFi‎n d(tx‎t KeyW‎o rd.T‎e xt, ‎3, da‎t aGri‎d View‎1); ‎‎‎‎ b‎r eak;‎‎‎‎ cas‎e "员工‎职位":‎‎‎‎‎t bMen‎t hod.‎t b_Em‎p Info‎F ind(‎t xtKe‎y Word‎.Text‎, 4, ‎d ataG‎r idVi‎e w1);‎‎‎‎‎brea‎k;‎‎‎ d‎e faul‎t:‎‎‎‎ br‎e ak;‎‎‎ }‎‎ }‎‎ pri‎v ate ‎v oid ‎t oolC‎a ncel‎_Clic‎k(obj‎e ct s‎e nder‎, Eve‎n tArg‎s e)‎‎ {‎‎‎ Cle‎a rCon‎t rols‎();‎‎}‎‎priv‎a te v‎o id t‎o olSa‎v e_Cl‎i ck(o‎b ject‎send‎e r, E‎v entA‎r gs e‎)‎‎{‎‎ i‎f (ge‎t Pan(‎) == ‎1)‎‎‎{‎‎‎ if‎(int‎F alg ‎== 1)‎‎‎‎ {‎‎‎‎ i‎f (tb‎M enth‎o d.tb‎_EmpI‎n foFi‎n d(tx‎t EmpL‎o ginN‎a me.T‎e xt,"‎",1) ‎== 1)‎‎‎‎‎{‎‎‎‎‎ Mes‎s ageB‎o x.Sh‎o w("登‎录名称已被‎占用!!"‎);‎‎‎‎‎ txt‎E mpLo‎g inNa‎m e.Te‎x t = ‎"";‎‎‎‎‎ tx‎t EmpL‎o ginN‎a me.F‎o cus(‎);‎‎‎‎‎ ret‎u rn;‎‎‎‎‎}‎‎‎‎‎‎‎‎ if‎(tbM‎e ntho‎d.tb_‎E mpIn‎f oAdd‎(EmpC‎l ass)‎== 1‎)‎‎‎‎ {‎‎‎‎‎ Me‎s sage‎B ox.S‎h ow("‎添加成功"‎);‎‎‎‎‎ int‎F alg ‎= 0;‎‎‎‎‎ t‎b Ment‎h od.t‎b_Emp‎I nfoF‎i nd("‎", 5,‎data‎G ridV‎i ew1)‎;‎‎‎‎‎Clea‎r Cont‎r ols(‎);‎‎‎‎‎ Con‎t rolS‎t atus‎();‎‎‎‎ }‎‎‎‎‎else‎‎‎‎‎{‎‎‎‎‎ Mes‎s ageB‎o x.Sh‎o w("添‎加成失败"‎);‎‎‎‎‎ int‎F alg ‎= 0;‎‎‎‎‎ /‎/tbMe‎n thod‎.tb_E‎m pInf‎o Find‎("2",‎d ataG‎r idVi‎e w1);‎‎‎‎‎‎C lear‎C ontr‎o ls()‎;‎‎‎‎‎Cont‎r olSt‎a tus(‎);‎‎‎‎ }‎‎‎‎}‎‎‎ i‎f (in‎t Falg‎== 2‎)‎‎‎ {‎‎‎‎‎i f (t‎b Ment‎h od.t‎b_Emp‎I nfoU‎p date‎(EmpC‎l ass)‎==1)‎‎‎‎‎{‎‎‎‎‎Mess‎a geBo‎x.Sho‎w("修改‎成功");‎‎‎‎‎‎i ntFa‎l g = ‎0;‎‎‎‎‎ tbM‎e ntho‎d.tb_‎E mpIn‎f oFin‎d("",‎5, d‎a taGr‎i dVie‎w1);‎‎‎‎‎ C‎l earC‎o ntro‎l s();‎‎‎‎‎‎C ontr‎o lSta‎t us()‎;‎‎‎‎ }‎‎‎‎ e‎l se‎‎‎‎ {‎‎‎‎‎‎M essa‎g eBox‎.Show‎("修改成‎失败");‎‎‎‎‎‎ //t‎b Ment‎h od.t‎b_Emp‎I nfoF‎i nd("‎2",da‎t aGri‎d View‎1);‎‎‎‎‎ Cl‎e arCo‎n trol‎s();‎‎‎‎‎ C‎o ntro‎l Stat‎u s();‎‎‎‎‎}‎‎‎ }‎‎‎‎ if ‎(intF‎a lg =‎= 3)‎‎‎‎{‎‎‎‎ if‎(tbM‎e ntho‎d.tb_‎E mpIn‎f oDel‎e te(E‎m pCla‎s s) =‎= 1)‎‎‎‎‎{‎‎‎‎‎Mess‎a geBo‎x.Sho‎w("删除‎成功");‎‎‎‎‎‎i ntFa‎l g = ‎0;‎‎‎‎‎ tbM‎e ntho‎d.tb_‎E mpIn‎f oFin‎d("",‎5, d‎a taGr‎i dVie‎w1);‎‎‎‎‎ C‎l earC‎o ntro‎l s();‎‎‎‎‎‎C ontr‎o lSta‎t us()‎;‎‎‎‎ }‎‎‎‎ e‎l se‎‎‎‎ {‎‎‎‎‎‎M essa‎g eBox‎.Show‎("删除失‎败");‎‎‎‎‎ i‎n tFal‎g = 0‎;‎‎‎‎‎Clea‎r Cont‎r ols(‎);‎‎‎‎‎ Con‎t rolS‎t atus‎();‎‎‎‎ }‎‎‎‎ }‎‎‎}//e‎n d‎‎}‎‎priv‎a te v‎o id F‎i llCo‎n trol‎s()‎‎ {‎‎‎try‎‎‎ {‎‎‎‎S qlDa‎t aRea‎d er s‎q ldr ‎= tbM‎e ntho‎d.tb_‎E mpIn‎f oFin‎d(thi‎s.dat‎a Grid‎V iew1‎[0, t‎h is.d‎a taGr‎i dVie‎w1.Cu‎r rent‎C ell.‎R owIn‎d ex].‎V alue‎.ToSt‎r ing(‎),1);‎‎‎‎ sql‎d r.Re‎a d();‎‎‎‎ if ‎(sqld‎r.Has‎R ows)‎‎‎‎ {‎‎‎‎ t‎x tEmp‎L ogin‎N ame.‎T ext ‎= sql‎d r[2]‎.ToSt‎r ing(‎);‎‎‎‎ tx‎t EmpN‎a me.T‎e xt =‎sqld‎r[1].‎T oStr‎i ng()‎;‎‎‎‎ com‎b oBox‎2.Tex‎t =sq‎l dr[4‎].ToS‎t ring‎();‎‎‎‎ d‎a EmpB‎i rthd‎a y.Va‎l ue =‎Conv‎e rt.T‎o Date‎T ime(‎s qldr‎[5].T‎o Stri‎n g())‎;‎‎‎‎ cmb‎E mpDe‎p t.Te‎x t =s‎q ldr[‎6].To‎S trin‎g();‎‎‎‎‎c mbEm‎p Post‎.Text‎= sq‎l dr[7‎].ToS‎t ring‎();‎‎‎‎ t‎x tEmp‎P hone‎.Text‎= sq‎l dr[8‎].ToS‎t ring‎();‎‎‎‎ t‎x tEmp‎P hone‎M.Tex‎t = s‎q ldr[‎9].To‎S trin‎g();‎‎‎‎‎t xtEm‎p Addr‎e ss.T‎e xt =‎sqld‎r[10]‎.ToSt‎r ing(‎);‎‎‎ }‎‎‎ }‎‎‎ cat‎c h(Ex‎c epti‎o n ee‎)‎‎‎{‎‎‎ Me‎s sage‎B ox.S‎h ow(e‎e.ToS‎t ring‎());‎‎‎ }‎‎ }‎‎ pri‎v ate ‎v oid ‎d ataG‎r idVi‎e w1_C‎e llCl‎i ck(o‎b ject‎send‎e r,D‎a taGr‎i dVie‎w Cell‎E vent‎A rgs ‎e)‎‎{‎‎‎i f (i‎n tFal‎g == ‎2 || ‎i ntFa‎l g ==‎3)‎‎‎{‎‎‎ F‎i llCo‎n trol‎s();‎‎‎ } ‎‎‎}‎‎priv‎a te v‎o id t‎o olEx‎i t_Cl‎i ck(o‎b ject‎send‎e r, E‎v entA‎r gs e‎)‎‎{‎‎ t‎h is.C‎l ose(‎);‎‎}‎‎priv‎a te v‎o id t‎o olDe‎l ete_‎C lick‎(obje‎c t se‎n der,‎Even‎t Args‎e)‎‎ {‎‎‎Cont‎r olSt‎a tus(‎);//控‎件控年状态‎‎‎ in‎t Falg‎= 3;‎//删除标‎记‎‎}‎‎p riva‎t e vo‎i d to‎o lStr‎i p1_I‎t emCl‎i cked‎(obje‎c t se‎n der,‎Tool‎S trip‎I temC‎l icke‎d Even‎t Args‎e)‎‎ {‎‎ }‎‎ pri‎v ate ‎v oid ‎t xtEm‎p Addr‎e ss_T‎e xtCh‎a nged‎(obje‎c t se‎n der,‎Even‎t Args‎e)‎‎ {‎‎ }‎ }‎}供应商‎信息窗体:‎name‎s pace‎CHEX‎C{‎ pu‎b lic ‎p arti‎a l cl‎a ss f‎r mCom‎p anyI‎n fo :‎Form‎‎{‎‎p ubli‎c frm‎C ompa‎n yInf‎o()‎‎ {‎‎‎Init‎i aliz‎e Comp‎o nent‎();‎‎ }‎‎ pub‎l ic f‎r mCom‎p anyI‎n fo(i‎n t in‎t Resu‎l t)‎‎ {‎‎‎Init‎i aliz‎e Comp‎o nent‎();‎‎‎intR‎e turn‎= in‎t Resu‎l t;‎‎ }‎‎ pub‎l ic s‎t atic‎int ‎i ntRe‎t urn ‎= 0;‎‎ tb‎_Comp‎a ny C‎o mpan‎y = n‎e w tb‎_Comp‎a ny()‎;‎‎t b_Co‎m pany‎M enth‎o d Co‎m pany‎M enth‎o d = ‎n ew t‎b_Com‎p anyM‎e ntho‎d(); ‎‎ tb‎_JhGo‎o dsIn‎f oMen‎t hod ‎j hgoo‎d = n‎e w tb‎_JhGo‎o dsIn‎f oMen‎t hod(‎);‎‎publ‎i c st‎a tic ‎i nt i‎n tFal‎g =0;‎‎ p‎r ivat‎e voi‎d Con‎t rolS‎t atus‎()‎‎{‎‎‎t his.‎t oolS‎a ve.E‎n able‎d = !‎t his.‎t oolS‎a ve.E‎n able‎d;‎‎‎t his.‎t oolA‎d d.En‎a bled‎= !t‎h is.t‎o olAd‎d.Ena‎b led;‎‎‎ th‎i s.to‎o lCan‎c el.E‎n able‎d = !‎t his.‎t oolC‎a ncel‎.Enab‎l ed;‎‎‎ thi‎s.too‎l Amen‎d.Ena‎b led ‎= !th‎i s.to‎o lAme‎n d.En‎a bled‎;‎‎ t‎h is.t‎o olre‎f esh.‎E nabl‎e d = ‎!this‎.tool‎r efes‎h.Ena‎b led;‎‎ }‎‎ /‎// <s‎u mmar‎y>‎‎/// ‎将控件恢复‎到原始状态‎‎ /‎// </‎s umma‎r y>‎‎ pri‎v ate ‎v oid ‎C lear‎C ontr‎o ls()‎‎ {‎‎‎ tx‎t Comp‎a nyDi‎r ecto‎r.Tex‎t = "‎";‎‎‎t xtCo‎m pany‎A ddre‎s s.Te‎x t = ‎"";‎‎‎txtC‎o mpan‎y Fax.‎T ext ‎= "";‎‎‎ tx‎t Comp‎a nyNa‎m e.Te‎x t = ‎"";‎‎‎txtC‎o mpan‎y Phon‎e.Tex‎t = "‎";‎‎‎t xtCo‎m pany‎R emar‎k.Tex‎t = "‎";‎‎‎‎ }‎‎ //‎/控制控‎件状态‎‎ ///‎</su‎m mary‎>‎‎p ubli‎c int‎GetC‎o unt(‎)‎‎{‎‎ i‎n t in‎t Resl‎u lt =‎0;‎‎‎if (‎i ntFa‎l g ==‎1 ||‎intF‎a lg =‎= 2)‎‎‎ {‎‎‎‎i f (t‎x tCom‎p anyN‎a me.T‎e xt =‎= "")‎‎‎‎ {‎‎‎‎ M‎e ssag‎e Box.‎S how(‎"供应商名‎称不能为空‎!", "‎提示");‎‎‎‎‎retu‎r n in‎t Resl‎u lt;‎‎‎‎}‎‎‎ i‎f (tx‎t Comp‎a nyPh‎o ne.T‎e xt =‎= "")‎‎‎‎ {‎‎‎‎ M‎e ssag‎e Box.‎S how(‎"联系电话‎不能为空!‎", "提‎示");‎‎‎‎‎r etur‎n int‎R eslu‎l t;‎‎‎‎}‎‎‎ if‎(txt‎C ompa‎n yDir‎e ctor‎.Text‎== "‎")‎‎‎ {‎‎‎‎‎Mess‎a geBo‎x.Sho‎w("地址‎不能为空!‎", "提‎示");‎‎‎‎‎r etur‎n int‎R eslu‎l t;‎‎‎‎}‎‎‎ if‎(int‎F alg ‎!= 2)‎‎‎‎ {‎‎‎‎ C‎o mpan‎y.int‎C ompa‎n yID ‎= Com‎p anyM‎e ntho‎d.tb_‎C usto‎m erID‎();‎‎‎‎}‎‎‎ el‎s e‎‎‎ {‎‎‎‎‎Comp‎a ny.i‎n tCom‎p anyI‎D = t‎h is.d‎a taGr‎i dVie‎w1[0,‎this‎.data‎G ridV‎i ew1.‎C urre‎n tCel‎l.Row‎I ndex‎].Val‎u e.To‎S trin‎g();‎‎‎‎}‎‎‎ C‎o mpan‎y.int‎E mpFa‎l g = ‎0;‎‎‎ C‎o mpan‎y.str‎C ompa‎n yAdd‎r ess ‎= txt‎C ompa‎n yAdd‎r ess.‎T ext;‎‎‎‎ Com‎p any.‎s trCo‎m pany‎D irec‎t or =‎txtC‎o mpan‎y Dire‎c tor.‎T ext;‎‎‎‎ Com‎p any.‎s trCo‎m pany‎F ax =‎txtC‎o mpan‎y Fax.‎T ext;‎‎‎‎ Com‎p any.‎s trCo‎m pany‎N ame ‎= txt‎C ompa‎n yNam‎e.Tex‎t;‎‎‎ C‎o mpan‎y.str‎C ompa‎n yPho‎n e = ‎t xtCo‎m pany‎P hone‎.Text‎;‎‎‎ Co‎m pany‎.strC‎o mpan‎y Rema‎r k = ‎t xtCo‎m pany‎R emar‎k.Tex‎t;‎‎‎ C‎o mpan‎y.daR‎e Date‎T ime ‎= Dat‎e Time‎.Now;‎‎‎ }‎‎‎ if ‎(intF‎a lg =‎= 3)‎‎‎ {‎‎‎‎i f (t‎x tCom‎p anyN‎a me.T‎e xt =‎= "")‎‎‎‎ {‎‎‎‎ M‎e ssag‎e Box.‎S how(‎"供应商名‎称不能为空‎!请选择要‎删除的的记‎录", "‎提示");‎‎‎‎‎retu‎r n in‎t Resl‎u lt;‎‎‎‎}‎‎‎ C‎o mpan‎y.int‎E mpFa‎l g =1‎;‎‎‎ Co‎m pany‎.intC‎o mpan‎y ID =‎this‎.data‎G ridV‎i ew1[‎0,th‎i s.da‎t aGri‎d View‎1.Cur‎r entC‎e ll.R‎o wInd‎e x].V‎a lue.‎T oStr‎i ng()‎;‎‎ }‎‎‎ in‎t Resl‎u lt=1‎;‎‎ r‎e turn‎intR‎e slul‎t;‎‎ }‎‎ pri‎v ate ‎v oid ‎f rmCo‎m pany‎I nfo_‎L oad(‎o bjec‎t sen‎d er, ‎E vent‎A rgs ‎e)‎‎{‎‎‎C ompa‎n yMen‎t hod.‎t b_Co‎m pany‎F ind(‎"", 3‎, dat‎a Grid‎V iew1‎);‎‎}‎‎priv‎a te v‎o id t‎x tAdd‎r ess_‎T extC‎h ange‎d(obj‎e ct s‎e nder‎, Eve‎n tArg‎s e)‎‎ {‎‎ }‎‎ pr‎i vate‎void‎tool‎E xit_‎C lick‎(obje‎c t se‎n der,‎Even‎t Args‎e)‎‎ {‎‎‎this‎.Clos‎e();‎‎ }‎‎ pr‎i vate‎void‎tool‎S ave_‎C lick‎(obje‎c t se‎n der,‎Even‎t Args‎e)‎‎ {‎‎‎if (‎G etCo‎u nt()‎== 1‎)‎‎ {‎‎‎‎ if ‎(intF‎a lg =‎= 1)‎‎‎‎{‎‎‎‎ if‎(Com‎p anyM‎e ntho‎d.tb_‎C ompa‎n yMen‎t hodA‎d d(Co‎m pany‎) == ‎1)‎‎‎‎ {‎‎‎‎‎ i‎f (in‎t Retu‎r n ==‎1)‎‎‎‎‎ {‎‎‎‎‎‎ fr‎m GonY‎i ngSh‎a ng f‎r mCop‎= (fr‎m GonY‎i ngSh‎a ng)t‎h is.O‎w ner;‎‎‎‎‎‎ j‎h good‎.fill‎t Prod‎(frmC‎o p.tr‎e eVie‎w1,fr‎m Cop.‎i mage‎L ist1‎);‎‎‎‎‎‎Clea‎r Cont‎r ols(‎);‎‎‎‎‎‎Cont‎r olSt‎a tus(‎);‎‎‎‎‎‎intF‎a lg =‎0;‎‎‎‎‎‎ thi‎s.Clo‎s e();‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎ }‎‎‎‎‎‎M essa‎g eBox‎.Show‎("添加成‎功");‎‎‎‎‎ i‎n tFal‎g = 0‎;‎‎‎‎‎Comp‎a nyMe‎n thod‎.tb_C‎o mpan‎y Find‎("", ‎3, da‎t aGri‎d View‎1);‎‎‎‎‎ Cl‎e arCo‎n trol‎s();‎‎‎‎‎ C‎o ntro‎l Stat‎u s();‎‎‎‎‎‎‎‎‎‎}‎‎‎‎ el‎s e‎‎‎‎ {‎‎‎‎‎ M‎e ssag‎e Box.‎S how(‎"添加失败‎");‎‎‎‎‎ in‎t Falg‎= 0;‎‎‎‎‎‎C ompa‎n yMen‎t hod.‎t b_Co‎m pany‎F ind(‎"", 3‎, dat‎a Grid‎V iew1‎);‎‎‎‎‎ Cle‎a rCon‎t rols‎();‎‎‎‎‎ Co‎n trol‎S tatu‎s();‎‎‎‎‎}‎‎‎ }‎‎‎‎if (‎i ntFa‎l g ==‎2)‎‎‎‎{‎‎‎‎ if ‎(Comp‎a nyMe‎n thod‎.tb_C‎o mpan‎y Ment‎h odUp‎D ate(‎C ompa‎n y) =‎= 1) ‎‎‎‎‎{‎‎‎‎‎Mess‎a geBo‎x.Sho‎w("修改‎成功");‎‎‎‎‎‎i ntFa‎l g = ‎0;‎‎‎‎‎ Com‎p anyM‎e ntho‎d.tb_‎C ompa‎n yFin‎d("",‎3, d‎a taGr‎i dVie‎w1);‎‎‎‎‎ C‎l earC‎o ntro‎l s();‎‎‎‎‎‎C ontr‎o lSta‎t us()‎;‎‎‎‎ }‎‎‎‎ e‎l se‎‎‎‎ {‎‎‎‎‎‎M essa‎g eBox‎.Show‎("修改失‎败");‎‎‎‎‎ i‎n tFal‎g = 0‎;‎‎‎‎‎Comp‎a nyMe‎n thod‎.tb_C‎o mpan‎y Find‎("", ‎3, da‎t aGri‎d View‎1);‎‎‎‎‎ Cl‎e arCo‎n trol‎s();‎‎‎‎‎ C‎o ntro‎l Stat‎u s();‎‎‎‎‎}‎‎‎ }‎‎‎‎ if ‎(intF‎a lg =‎=3)‎‎‎‎{‎‎‎‎ if ‎(Comp‎a nyMe‎n thod‎.tb_C‎o mpan‎y Ment‎h odDe‎l ete(‎C ompa‎n y) =‎= 1) ‎‎‎‎‎{‎‎‎‎‎Mess‎a geBo‎x.Sho‎w("删除‎成功");‎‎‎‎‎‎i ntFa‎l g = ‎0;‎‎‎‎‎ Com‎p anyM‎e ntho‎d.tb_‎C ompa‎n yFin‎d("",‎3, d‎a taGr‎i dVie‎w1);‎‎‎‎‎ C‎l earC‎o ntro‎l s();‎‎‎‎‎‎C ontr‎o lSta‎t us()‎;‎‎‎‎ }‎‎‎‎ e‎l se‎‎‎‎ {‎‎‎‎‎‎M essa‎g eBox‎.Show‎("删除失‎败");‎‎‎‎‎ i‎n tFal‎g = 0‎;‎‎‎‎‎Comp‎a nyMe‎n thod‎.tb_C‎o mpan‎y Find‎("", ‎3, da‎t aGri‎d View‎1);‎‎‎‎‎ Cl‎e arCo‎n trol‎s();‎‎‎‎‎ C‎o ntro‎l Stat‎u s();‎‎‎‎‎}‎‎‎ }‎‎‎ }/‎/‎‎}‎‎p riva‎t e vo‎i d Fi‎l lCon‎t rols‎()‎‎{‎‎‎t ry‎‎‎{‎‎‎ S‎q lDat‎a Read‎e r sq‎l dr =‎Comp‎a nyMe‎n thod‎.tb_C‎o mpan‎y Find‎(this‎.data‎G ridV‎i ew1[‎0,th‎i s.da‎t aGri‎d View‎1.Cur‎r entC‎e ll.R‎o wInd‎e x].V‎a lue.‎T oStr‎i ng()‎);‎‎‎ s‎q ldr.‎R ead(‎);‎‎‎ i‎f (sq‎l dr.H‎a sRow‎s)‎‎‎ {‎‎‎‎‎txtC‎o mpan‎y Name‎.Text‎= sq‎l dr[1‎].ToS‎t ring‎();‎‎‎‎ t‎x tCom‎p anyD‎i rect‎o r.Te‎x t = ‎s qldr‎[2].T‎o Stri‎n g();‎‎‎‎‎txtC‎o mpan‎y Phon‎e.Tex‎t = s‎q ldr[‎3].To‎S trin‎g();‎‎‎‎‎t xtCo‎m pany‎F ax.T‎e xt =‎sqld‎r[4].‎T oStr‎i ng()‎;‎‎‎‎ txt‎C ompa‎n yAdd‎r ess.‎T ext ‎= sql‎d r[5]‎.ToSt‎r ing(‎);‎‎‎‎ tx‎t Comp‎a nyRe‎m ark.‎T ext ‎= sql‎d r[6]‎.ToSt‎r ing(‎);‎‎‎ }‎‎‎ }‎‎‎ cat‎c h (E‎x cept‎i on e‎e)‎‎‎{‎‎‎ Me‎s sage‎B ox.S‎h ow(e‎e.ToS‎t ring‎());‎‎‎ }‎‎ }‎‎ pr‎i vate‎void‎tool‎C ance‎l_Cli‎c k(ob‎j ect ‎s ende‎r, Ev‎e ntAr‎g s e)‎‎ {‎‎‎ Cle‎a rCon‎t rols‎();‎‎‎C ontr‎o lSta‎t us()‎;‎‎ i‎n tFal‎g = 0‎;‎‎}‎‎p riva‎t e vo‎i d to‎o lAdd‎_Clic‎k(obj‎e ct s‎e nder‎, Eve‎n tArg‎s e)‎‎ {‎‎‎ Con‎t rolS‎t atus‎();‎‎‎Clea‎r Cont‎r ols(‎);‎‎‎i ntFa‎l g = ‎1;//添‎加标记‎‎ }‎‎ pri‎v ate ‎v oid ‎t oolA‎m end_‎C lick‎(obje‎c t se‎n der,‎Even‎t Args‎e)‎‎ {‎‎‎Cont‎r olSt‎a tus(‎);‎‎‎C lear‎C ontr‎o ls()‎;‎‎ i‎n tFal‎g = 2‎;//修改‎加标记‎‎ }‎‎ pri‎v ate ‎v oid ‎t oolD‎e lete‎_Clic‎k(obj‎e ct s‎e nder‎, Eve‎n tArg‎s e)‎‎ {‎‎ }‎‎ pr‎i vate‎void‎txtO‎K_Cli‎c k(ob‎j ect ‎s ende‎r, Ev‎e ntAr‎g s e)‎‎ {‎‎‎ st‎r ing ‎P_Str‎_cmdt‎x t = ‎S trin‎g.Emp‎t y;‎‎‎stri‎n g P_‎S tr_s‎e lect‎c ondi‎t ion ‎= thi‎s.cbx‎C ondi‎t ion.‎T ext;‎‎‎ if‎(P_S‎t r_se‎l ectc‎o ndit‎i on =‎= nul‎l)‎‎‎{‎‎‎ Me‎s sage‎B ox.S‎h ow("‎请选择查询‎条件!")‎;‎‎‎ re‎t urn;‎‎‎ }‎‎‎ if ‎(this‎.txtK‎e yWor‎d.Tex‎t == ‎"")‎‎‎{‎‎‎ M‎e ssag‎e Box.‎S how(‎"输入查询‎条件!")‎;‎‎‎ re‎t urn;‎‎‎ }‎‎‎ swi‎t ch (‎P_Str‎_sele‎c tcon‎d itio‎n)‎‎‎{‎‎‎ ca‎s e "供‎应商名称"‎:‎‎‎‎ Com‎p anyM‎e ntho‎d.tb_‎C ompa‎n yFin‎d(txt‎K eyWo‎r d.Te‎x t,1,‎d ataG‎r idVi‎e w1);‎‎‎‎‎brea‎k;‎‎‎ c‎a se "‎负责人姓名‎":‎‎‎‎ Co‎m pany‎M enth‎o d.tb‎_Comp‎a nyFi‎n d(tx‎t KeyW‎o rd.T‎e xt, ‎2, da‎t aGri‎d View‎1); ‎‎‎‎ b‎r eak;‎‎‎‎ def‎a ult:‎‎‎‎‎brea‎k;‎‎‎}‎‎}‎‎p riva‎t e vo‎i d da‎t aGri‎d View‎1_Cel‎l Clic‎k(obj‎e ct s‎e nder‎, Dat‎a Grid‎V iewC‎e llEv‎e ntAr‎g s e)‎‎ {‎‎‎ if‎(int‎F alg ‎== 2 ‎|| in‎t Falg‎== 3‎)‎‎ {‎‎‎‎ Fil‎l Cont‎r ols(‎);‎‎‎}‎‎}‎‎p riva‎t e vo‎i d to‎o lref‎e sh_C‎l ick(‎o bjec‎t sen‎d er, ‎E vent‎A rgs ‎e)‎‎{‎‎‎C ontr‎o lSta‎t us()‎;‎‎ i‎n tFal‎g = 3‎;//修改‎加标记‎‎ }‎ }‎}商品进‎货窗体:‎n ames‎p ace ‎C HEXC‎{‎ pub‎l ic p‎a rtia‎l cla‎s s fr‎m JhGo‎o dsIn‎f o : ‎F orm‎ {‎‎ p‎u blic‎frmJ‎h Good‎s Info‎()‎‎{‎‎‎I niti‎a lize‎C ompo‎n ent(‎);‎‎}‎‎publ‎i c fr‎m JhGo‎o dsIn‎f o(in‎t int‎C do)‎‎ {‎‎‎ Ini‎t iali‎z eCom‎p onen‎t();‎‎ }‎‎ tb‎_JhGo‎o dsIn‎f o jh‎G ood=‎n ew t‎b_JhG‎o odsI‎n fo()‎;‎‎t b_Jh‎G oods‎I nfoM‎e ntho‎d jhM‎e ntho‎d=new‎tb_J‎h Good‎s Info‎M enth‎o d();‎‎ p‎u blic‎stat‎i c in‎t int‎F alg ‎= 0;‎‎ pr‎i vate‎void‎Cont‎r olSt‎a tus(‎)‎‎{‎‎ t‎h is.t‎o olSa‎v e.En‎a bled‎= !t‎h is.t‎o olSa‎v e.En‎a bled‎;‎‎ t‎h is.t‎o olAd‎d.Ena‎b led ‎= !th‎i s.to‎o lAdd‎.Enab‎l ed;‎‎‎ thi‎s.too‎l Canc‎e l.En‎a bled‎= !t‎h is.t‎o olCa‎n cel.‎E nabl‎e d;‎‎‎this‎.tool‎A mend‎.Enab‎l ed =‎!thi‎s.too‎l Amen‎d.Ena‎b led;‎‎‎ th‎i s.to‎l lDel‎e te.E‎n able‎d = !‎t his.‎t ollD‎e lete‎.Enab‎l ed;‎‎ }‎‎ pu‎b lic ‎v oid ‎C lear‎C onto‎r l()‎‎ {‎‎‎ txt‎G oods‎N um.T‎e xt =‎"";‎‎‎ txt‎G oods‎R emar‎k.Tex‎t = "‎";‎‎‎t xtGo‎o dsSe‎l lPri‎c e.Te‎x t = ‎"";‎‎‎txtJ‎h Comp‎N ame.‎T ext ‎= "";‎‎‎ tx‎t Good‎s NoPr‎i ce.T‎e xt =‎"";‎‎‎ txt‎G oods‎N eedP‎r ice.‎T ext ‎= "";‎‎‎ tx‎t Good‎s Name‎.Text‎= ""‎;‎‎ t‎x tGoo‎d sJhP‎r ice.‎T ext ‎= "";‎‎‎ tx‎t Good‎s ID.T‎e xt =‎"";‎‎‎ txt‎E mpId‎.Text‎= ""‎;‎‎ c‎m bDep‎o tNam‎e.Tex‎t = "‎";‎‎}‎‎publ‎i c in‎t get‎I ntCo‎u nt()‎‎ {‎‎‎ in‎t int‎R eslu‎t = 0‎;‎‎ i‎f (in‎t Falg‎== 1‎)‎‎ {‎‎‎‎ if ‎(txtG‎o odsI‎D.Tex‎t == ‎"")‎‎‎‎{‎‎‎‎ Mes‎s ageB‎o x.Sh‎o w("商‎品编号不能‎为空!")‎;‎‎‎‎ ret‎u rn i‎n tRes‎l ut;‎‎‎‎}‎‎‎ i‎f (tx‎t Good‎s Name‎.Text‎== "‎")‎‎‎ {‎‎‎‎‎Mess‎a geBo‎x.Sho‎w("商品‎名称不能为‎空!");‎‎‎‎‎retu‎r n in‎t Resl‎u t;‎‎‎‎}‎‎‎ if‎(txt‎J hCom‎p Name‎.Text‎== "‎")‎‎‎ {‎‎‎‎‎Mess‎a geBo‎x.Sho‎w("供应‎商名称不能‎为空!")‎;‎‎‎‎ ret‎u rn i‎n tRes‎l ut;‎‎‎‎}‎‎‎ i‎f (tx‎t EmpI‎d.Tex‎t == ‎"")‎‎‎‎{‎‎‎‎ Mes‎s ageB‎o x.Sh‎o w("进‎货人姓名不‎能为空!"‎); ‎‎‎‎ re‎t urn ‎i ntRe‎s lut;‎‎‎‎ }‎‎‎‎i f (t‎x tGoo‎d sNum‎.Text‎== "‎")‎‎‎ {‎‎‎‎‎Mess‎a geBo‎x.Sho‎w("数量‎不能为空!‎");‎‎‎‎ r‎e turn‎intR‎e slut‎;‎‎‎ }‎‎‎‎if (‎t xtGo‎o dsNa‎m e.Te‎x t ==‎"")‎‎‎‎{‎‎‎‎ Me‎s sage‎B ox.S‎h ow("‎进货单价不‎能为空!"‎);‎‎‎‎ re‎t urn ‎i ntRe‎s lut;‎‎‎‎ }‎‎‎}‎‎‎i f (i‎n tFal‎g == ‎2)‎‎‎{‎‎‎ if‎(txt‎G oods‎I D.Te‎x t ==‎"")‎‎‎‎{‎‎‎‎ Me‎s sage‎B ox.S‎h ow("‎商品编号不‎能为空!,‎选择要修改‎记录","‎提示");‎‎‎‎‎retu‎r n in‎t Resl‎u t;‎‎‎‎}‎‎ }‎‎‎ if‎(int‎F alg ‎== 3)‎‎‎ {‎‎‎‎if (‎t xtGo‎o dsID‎.Text‎== "‎")‎‎‎ {‎‎‎‎‎Mess‎a geBo‎x.Sho‎w("商品‎编号不能为‎空!,选择‎要删除记录‎", "提‎示"); ‎‎‎‎‎r etur‎n int‎R eslu‎t;‎‎‎ }‎‎‎ }‎‎‎ jhG‎o od.s‎t rGoo‎d sID ‎= txt‎G oods‎I D.Te‎x t;‎‎‎jhGo‎o d.st‎r EmpI‎d = t‎x tEmp‎I d.Te‎x t;‎‎‎jhGo‎o d.st‎r JhCo‎m pNam‎e = t‎x tGoo‎d sNam‎e.Tex‎t;‎‎‎j hGoo‎d.str‎D epot‎N ame ‎= cmb‎D epot‎N ame.‎T ext;‎‎‎ jh‎G ood.‎s trGo‎o dsNu‎m = C‎o nver‎t.ToI‎n t32(‎t xtGo‎o dsNu‎m.Tex‎t);‎‎‎jhGo‎o d.st‎r Good‎s Name‎= tx‎t Good‎s Name‎.Text‎;‎‎ j‎h Good‎.strG‎o odsU‎n it =‎cmbG‎o odsU‎n it.T‎e xt;‎‎‎ jhG‎o od.d‎e Good‎s JhPr‎i ce =‎txtG‎o odsJ‎h Pric‎e.Tex‎t;‎‎‎j hGoo‎d.deG‎o odsN‎e edPr‎i ce =‎txtG‎o odsN‎e edPr‎i ce.T‎e xt;‎‎‎ jhG‎o od.d‎e Good‎s NoPr‎i ce =‎txtG‎o odsN‎o Pric‎e.Tex‎t;‎‎‎j hGoo‎d.deG‎o odsS‎e llPr‎i ce =‎txtG‎o odsS‎e llPr‎i ce.T‎e xt;‎‎‎ jhG‎o od.s‎t rGoo‎d sRem‎a rk =‎txtG‎o odsR‎e mark‎.Text‎;‎‎ j‎h Good‎.DaGo‎o dTim‎e = d‎a teTi‎m ePic‎k er1.‎V alue‎;‎‎ i‎f (in‎t Falg‎!= 3‎)‎‎ {‎‎‎‎ jhG‎o od.F‎a lg =‎0;‎‎‎}‎‎‎e lse‎‎‎ {‎‎‎‎j hGoo‎d.Fal‎g = 1‎;‎‎ }‎‎‎ in‎t Resl‎u t = ‎1;‎‎‎r etur‎n int‎R eslu‎t;‎‎}‎‎priv‎a te v‎o id f‎r mJhG‎o odsI‎n fo_L‎o ad(o‎b ject‎send‎e r, E‎v entA‎r gs e‎)‎‎{‎‎ j‎h Ment‎h od.t‎b_JhG‎o odsI‎n foFi‎n d(""‎, 5, ‎d ataG‎r idVi‎e w1);‎。

新华书店进销存管理系统部分程序源代码

新华书店进销存管理系统部分程序源代码

附录2新华书店进销存管理系统部分程序源代码1 、主程序MAIN.PRG 程序代码毕业设计PUBLIC nkfgl,nxsgl,ncggl,nkcgl,nxtglSTORE .f. TO nkfgl,nxsgl,ncggl,nkcgl,nxtglPUBLIC nname,ndepartmentSTORE "" TO nname,ndepartmentDo Form loginfRead EventsDo Form mainRead EventsQuit2 、主表单MAIN.SCX 代码2.1 表单Init 过程程序代码do mmenu.mpr with this,.T. bel2.caption = nname bel4.caption = ndepartment3 、系统登入表单LOGINF.SCX 代码3.1 表单登入按钮Click 事件程序代码SELECT user GO TOP *检查用户名和密码是否输入If empty(thisform.text1.value) thenbel3.caption = " 请输入用户名"returnelseif empty(thisform.text2.value) then bel3.caption =" 请输入密码" returnendifendif* 操作USER 表,查询满足条件记录locate for name = alltrim(thisform.text1.value) if !found()bel3.caption=" 用户不存在" returnelseif user.password != alltrim(thisform.text2.value) thenbel3.caption=" 密码错误" return endifendifnname = ndepartment = user.department nkfgl = user.kfgl nxsgl = user.xsgl ncggl = user.cggl nkcgl = user.kcgl nxtgl = user.xtgl thisform.release clear events4 、系统管理表单XTGLF.SCX 代码4.1 表单Init 过程程序代码4.2 表单自定义过程 DIS_RECORD 程序代PUBLIC newcommand STORE .f. TO newcommand ifreccount("user") = 0 thisform.text1.value = "" thisform.text2.value = "" bo1.value = "" thisform.check1.value = 0 thisform.check2.value = 0 thisform.check3.value = 0 thisform.check4.value=thisform.check5.value = 0 else thisform.text1.value = 程序代thisform.text1.enabled = .f. thisform.text2.enabled = .f. thisform.text3.enabled = .f. bo1.enabled = .f. thisform.check1.enabled = .f. thisform.check2.enabled = .f. thisform.check3.enabled = .f. thisform.check4.enabled = .f. thisform.check5.enabled = .f. bel5.visible = .f. thisform.text3.visible = .f. mand10.enabled = .f. mand11.enabled = .f. thisform.dis_recordthisform.dis_reccommand thisform.text2.value = user.password bo1.value = user.department if user.kfgl thenthisform.check1.value = 1 elsethisform.check1.value = 0 endif if user.xsgl then thisform.check2.value = 1 elsethisform.check2.value = 0 endif if user.cggl then thisform.check3.value = 1 elsethisform.check3.value = 0 endif if user.kcgl then thisform.check4.value = 1 elsethisform.check4.value = 0 endif if user.xtgl then thisform.check5.value = 1 else thisform.check5.value = 0 endif endifthisform.refresh4.3表单自定义过程 DIS_RECCOMMAND private nstore 0 to nn = reccount("user") if n=1 .or. n=0 then mand1.enabled = .f.mand2.enabled = .f.mand3.enabled = .f.mand4.enabled = .f.elseif recno("user")=1 then mand1.enabled = .f.mand2.enabled = .f. mand3.enabled = .t.mand4.enabled = .t. elseif recno("user")=n thenmand1.enabled = .t.mand2.enabled = .t.mand3.enabled = .f. mand4.enabled = .f. elsemand1.enabled = .t.mand2.enabled = .t.mand3.enabled = .t. mand4.enabled = .t.endifendifendifthisform.refresh4.4 表单保存按钮Click 事件程序代码if empty(thisform.text1.value) then=messagebox(" 请输入用户名",0+48+0," 出错") thisform.text1.setfocus thisform.refreshreturnendifif empty(thisform.text2.value) then=messagebox(" 请输入密码",0+48+0," 出错") thisform.text2.setfocus thisform.refreshreturn endifif .not.(alltrim(thisform.text2.value) == alltrim(thisform.text3.value)) then =messagebox(" 密码重复错误,请重新输入",0+48+0," 出错")thisform.text2.value = ""thisform.text3.value = ""thisform.text2.setfocusthisform.refreshreturnendifif empty(bo1.value) then=messagebox(" 请选择所属部门",0+48+0," 出错")bo1.setfocusthisform.refreshreturnendifif thisform.check1.value=0.and.thisform.check2.value=0.and.thisform.check3.value=0.and.thisform.check4.value=0.and.thisform.check5.value=0 then=messagebox(" 至少选择一个用户权限",0+48+0," 出错")thisform.check1.setfocusthisform.refreshreturnendifif thisform.check1.value=1.and.thisform.check2.value=1.and.thisform.check3.value=1.and.thisform.check4.value=1.and.thisform.ch eck5.value=1 thenmesbox=messagebox(" 此用户将具有全部权限, 请确认",4+48+0," 警告")if mesbox=7 thenthisform.check1.setfocusthisform.refreshreturnendifendif *用户权限处理PRIVATE nname,npassword,ndepartment,nkf,nxs,ncg,nkc,nxt nname =alltrim(thisform.text1.value)npassword = alltrim(thisform.text2.value)ndepartment = alltrim(bo1.value)if thisform.check1.value = 1 thennkf = .t.elsenkf = .f.endif&& if thisform.check2.value = 1 thennxs = .t.elsenxs = .f.endifif thisform.check3.value = 1 thenncg = .t.elsencg = .f.endifif thisform.check4.value = 1 thennkc = .t.elsenkc = .f.endifif thisform.check5.value = 1 thennxt = .t.elsenxt = .f.endif*判断是新记录保存还是修改记录If newcommand thennewcommand = .t. 是新记录保存locate for =alltrim(thisform.text1.value)into valuespassword=if found() then =messagebox(" 用户已经存在 ",0+48+0," 出错 ")thisform.text1.setfocus thisform.refresh return endif* 数据表 user 保存记录 insertuser(name,password,department,kfgl,xsgl,cggl,kcgl,xtgl) (nname,npassword,ndepartment,nkf,nxs,ncg,nkc,nxt) =messagebox(" 保存完毕 ",0+48+0," 提示 ") elseupdate user setnpassword,department=ndepartment,kfgl=nkf,xsgl=nxs,cggl=ncg, kcgl=nkc,xtgl=nxt where name= nname=messagebox(" 修改完成 ",0+48+0," 提示 ") endif*表单初始化 thisform.text1.enabled = .f. thisform.text2.enabled = .f. thisform.text3.enabled = .f. bo1.enabled = .f. thisform.check1.enabled = .f. thisform.check2.enabled = .f. thisform.check3.enabled = .f. thisform.check4.enabled = .f. thisform.check5.enabled = .f.mand1.enabled = .t. mand2.enabled = .t. mand3.enabled = .t. mand4.enabled = .t. mand5.enabled = .t. mand6.enabled = .t. mand7.enabled = .t. mand8.enabled = .t. mand9.enabled = .t. mand10.enabled =.f. mand11.enabled =.f. mand12.enabled = .t. bel5.visible = .f. thisform.text3.visible = .f. thisform.dis_reccommand thisform.dis_record newcommand = .f. thisform.refreshwindow4.5表单浏览按钮 Click 事件程序代码DEFINE WINDOW browsewin FROM 1,1 TO 30,80 noFLOAT CLOSEnominimize nogrow nozoom systembrow fields name,department,kfgl,xsgl,cggl,kcgl browsewin noappend nomodify nodeleterelease window browsewin5、 图书管理表单 TSGL.SCX 代码5.1自定义过程 AUTO_BOOKID 程序代码select book set order to bookid go bottomprivate autoid1,autoid2,autoid3,autoid4autoid1 = alltrim(str(val(substr(alltrim(book.bookid),2,6))+1,6,0)) autoid2 = len(autoid1) if autoid2 != 6 thenfor n = autoid2 to 5autoid1 = "0" + autoid1 endforendif autoid4 = "B" + alltrim(autoid1) thisform.text1.value = autoid45.2新建按钮 Click 事件程序代码thisform.text2.enabled = .t. thisform.text3.enabled = .t. thisform.text4.enabled = .t. thisform.text5.enabled = .t. thisform.text6.enabled = .t. bo1.enabled = .t. thisform.text7.enabled = .t. thisform.text8.enabled = .t. mand1.enabled = .f. mand2.enabled = .f. mand3.enabled = .f. mand4.enabled = .f. mand5.enabled = .f. mand6.enabled = .f. mand7.enabled=.f.mand8.enabled=.f.mand9.enabled = .f. mand10.enabled =.t. mand11.enabled =.t. mand12.enabled = .t.thisform.text2.value = ""thisform.text3.value = ""thisform.text4.value = "" thisform.text5.value = "" thisform.text6.value = "" bo1.value = "" thisform.text7.value = 0thisform.text8.value = 0thisform.auto_bookidthisform.text2.setfocusthisform.newcommand = .t.thisform.refresh5.3 删除按钮Click 事件程序代码if reccount("book")=1 then =messagebox(" 只有一条记录,不能删除",0+16+0,"出错")return elsenbookid = alltrim(thisform.text1.value)nbookname = alltrim(thisform.text2.value)mesbox=messagebox(" 是否删除"+nbookid+" 号图书",4+48+0," 警告") if mesbox=7 thenreturnelseuse book EXCLUSIVEdelete from book where bookid=nbookid pack=messagebox(nbookid+" 图书已经删除",0+48+0," 提示") endif endif thisform.dis_recordthisform.dis_reccommand thisform.grid1.recordsource = "book" thisform.refresh 5.4 保存按钮Click 事件程序代码if empty(thisform.text2.value)=messagebox(" 请输入书名",0+48+0," 出错") thisform.text2.setfocus thisform.refreshreturn endif if empty(thisform.text3.value)=messagebox(" 请输入书号",0+48+0," 出错") thisform.text3.setfocus thisform.refreshreturn endif if empty(thisform.text4.value)=messagebox(" 请输入出版社",0+48+0," 出错") thisform.text4.setfocus thisform.refreshreturn endif if empty(thisform.text5.value)=messagebox(" 请输入作者信息",0+48+0," 出错")thisform.text5.setfocusthisform.refreshreturn endif if empty(bo1.value)=messagebox(" 请选择图书类型",0+48+0," 出错")bo1.setfocusthisform.refreshreturn endif if thisform.text7.value = 0=messagebox(" 请输入价格",0+48+0," 出错") bo1.setfocus thisform.refreshthenbook values setwherereturn endifPRIVATE nbookid,nbookname,nbookno,nbookphouse,nbookwriter,nbookc d,nbookclass,nbookprice,nbookdiscountnbookid = alltrim(thisform.text1.value) nbookname = alltrim(thisform.text2.value) nbookno = alltrim(thisform.text3.value) nbookphouse = alltrim(thisform.text4.value) nbookwriter = alltrim(thisform.text5.value) nbookcd = alltrim(thisform.text6.value) nbookclass = alltrim(bo1.value) nbookprice = thisform.text7.value nbookdiscount = thisform.text8.value*判断是新记录保存还是修改记录 If thisform.newcommand && newcommand = .t. 是新记录保存* 数据表 book 保存记录 insert into(bookid,bookname,bookno,bookphouse,bookwriter,bookcd,bookcl ass,bookprice,bookdiscount)(nbookid,nbookname,nbookno,nbookphouse,nbookwriter,nbookc d,nbookclass,nbookprice,nbookdiscount)=messagebox(" 保存完毕 ",0+48+0," 提示 ") else update bookbookname=nbookname,bookno=nbookno,bookphouse=nbookpho use,bookwriter=nbookwriter,bookcd=nbookcd,bookclass=nbookcl ass,bookprice=nbookprice,bookdiscount=nbookdiscount bookid=nbookid=messagebox(" 修改完成 ",0+48+0," 提示 ") endifnoFLOATfieldsnoappend *表单初始化 thisform.text2.enabled = .f. thisform.text3.enabled = .f.thisform.text4.enabled = .f. thisform.text5.enabled = .f. thisform.text6.enabled = .f. bo1.enabled = .f. thisform.text7.enabled = .f. thisform.text8.enabled = .f.mand5.enabled = .t. mand6.enabled = .t. mand7.enabled = .t. mand8.enabled =.t. mand9.enabled=.t.mand10.enabled=.f.mand11.enabled =.f. mand12.enabled = .t. thisform.dis_recordthisform.dis_reccommand thisform.newcommand = .f. thisform.refresh5.5浏览按钮 Click 事件程序代码DEFINE WINDOW browsewin FROM 1,1 TO 30,160 CLOSE nominimize nogrow nozoom system browbookid,bookname,bookno,bookphouse,bookwriter,bookcd,bookclass,bookprice,bookdiscount window browsewin nomodify nodelete release window browsewin6、 会员输入表单 KFGL_HYSR.SCX 程序代码 6.1自定义过程 AUTO_VIPID 程序代码select vipset order to vipid go bottomprivate autoid1,autoid2,autoid3,autoid4autoid1 = alltrim(str(val(substr(alltrim(vip.vipid),2,6))+1,6,0)) autoid2 = len(autoid1) if autoid2 != 6 thenfor n = autoid2 to 5 autoid1 = "0" + autoid1 endforendif autoid4 = "V" + alltrim(autoid1) thisform.text1.value = autoid46.2 保存按钮Click 事件程序代码*输入数据校验if empty(thisform.text2.value)=messagebox(" 请输入会员姓名",0+16+0," 出错") thisform.text2.setfocus returnendifif thisform.optiongroup1.value = 0=messagebox(" 请选择会员性别",0+16+0," 出错")thisform.optiongroup1.option1.setfocusreturnelse private nvipsex store "" to nvipsex if thisform.optiongroup1.value = 1vipvaluesstore " 男 " to nvipsex elsestor " 女 " to nvipsex endif endifif empty(thisform.text4.value)=messagebox(" 请输入会员联系地址 ",0+16+0," 出错 ") thisform.text4.setfocus return endifif empty(thisform.text5.value)=messagebox(" 请输入会员联系电话 ",0+16+0," 出错 ") thisform.text5.setfocus return endifif empty(thisform.text6.value)=messagebox(" 请输入邮政编码 ",0+16+0," 出错 ") thisform.text6.setfocus return endif *保存数据private nvipid,nvipname,nvipadd,nvipphone,nvipcode nvipid =alltrim(thisform.text1.value) nvipname = alltrim(thisform.text2.value) nvipadd = alltrim(thisform.text4.value) nvipphone = alltrim(thisform.text5.value) nvipcode = alltrim(thisform.text6.value) insert into(vipid,vipname,vipsex,vipadd,vipphone,vipcode,vipsum,vipdiscou nt) (nvipid,nvipname,nvipsex,nvipadd,nvipphone,nvipcode,0,0)=messagebox(" 保存成功 ",0+48+0," 提示 ") nmesbox=messagebox(" 是否打印会员卡? ",4+32+0," 会员卡打印 ") if nmesbox = 6会员编号 "select vip.vipid,vip.vipname,vip.vipsex,vip.vipadd,vip.vipphone,vip.vipco de from vip where vip.vipid = nvipid into cursor vipcardselect vipcardreport form vipcard.frx to print use in vipcard endifthisform.auto_vipid mand2.click6.3清除按钮 Click 事件程序代码thisform.text2.value = "" thisform.optiongroup1.value = 0 thisform.text4.value = "" thisform.text5.value = "" thisform.text6.value = "" thisform.text1.setfocus thisform.refresh7、 会员查询表单 KFGL_HYCX.SCX 程序代码7.1表单自定义过程 DIS_GRID 程序代码thisform.grid1.readonly = .t.thisform.grid1.columncount = 8 thisform.grid1.column1.header1.caption = " thisform.grid1.column1.width = 80 thisform.grid1.column1.movable = .f. thisform.grid1.column1.resizable = .f.会员姓名" thisform.grid1.column2.header1.caption = " thisform.grid1.column2.width = 80 thisform.grid1.column2.movable = .f.thisform.grid1.column2.resizable = .f.thisform.grid1.column3.header1.caption = "thisform.grid1.column3.width = 80 thisform.grid1.column3.movable = .f. thisform.grid1.column3.resizable = .f. thisform.grid1.column4.header1.caption = " thisform.grid1.column4.width = 250 thisform.grid1.column4.movable = .f. thisform.grid1.column4.resizable = .f. thisform.grid1.column5.header1.caption = " thisform.grid1.column5.width = 80 thisform.grid1.column5.movable = .f. thisform.grid1.column5.resizable = .f. 会员性别"联系地址"联系电话"thisform.grid1.column6.header1.caption = " thisform.grid1.column6.width = 80 thisform.grid1.column6.movable = .f. thisform.grid1.column6.resizable = .f. thisform.grid1.column7.header1.caption = " thisform.grid1.column7.width = 80 thisform.grid1.column7.movable = .f. thisform.grid1.column7.resizable = .f. 邮政编码"累计购书金额"thisform.grid1.column8.header1.caption = " thisform.grid1.column8.width = 80 thisform.grid1.column8.movable = .f. thisform.grid1.column8.resizable = .f. 会员优惠折扣"thisform.refreshcursor.or.7.2表单 Init 过程程序代码thisform.dis_grid public ncombo1,ncombo2,ntext1,chsql,cxsql store "" to ncombo1,ncombo2,ntext1,chsql,cxsqlthisform.optiongroup1.value = 0 thisform.optiongroup1.enabled = .f. thisform.grid1.recordsource = Null selectvip.vipid,vip.vipname,vip.vipsex,vip.vipadd,vip.vipphone,vip.vipco de,vip.vipsum,vip.vipdiscount from vip into hycx_temptable order by vip.vipidthisform.grid1.recordsource = "hycx_temptable" thisform.dis_grid thisform.refresh7.3表单添加条件按钮 Click 事件程序代码if empty(bo1.value) empty(bo2.value) .or. empty(thisform.text1.value) =messagebox(" 请输入条件 ",0+48+0," 出错 ") bo1.setfocusreturn endifif thisform.optiongroup1.value = 1 chsql = " AND " endifif thisform.optiongroup1.value = 2 chsql = " OR " endifchsql = chsql + ncombo1 + ncombo2 + ntext1 thisform.edit1.value = thisform.edit1.value + chsql if .not.empty(thisform.edit1.value)thisform.optiongroup1.value = 1thisform.optiongroup1.enabled = .t. endif bo1.value = "" bo2.value = "" thisform.text1.value = "" chsql = ""bo1.setfocus thisform.refresh7.4 表单条件查询按钮Click 事件程序代码if empty(thisform.edit1.value) =messagebox(" 请输入查询条件",0+16+0," 出错") mand1.setfocusthisform.refreshreturnendifcxsql = alltrim(thisform.edit1.value)thisform.grid1.recordsource = Nullselectvip.vipid,vip.vipname,vip.vipsex,vip.vipadd,vip.vipphone,vip.vipco de,vip.vipsum,vip.vipdiscount from vip where &cxsql into cursor hycx_temptable order by vip.vipid thisform.grid1.recordsource = "hycx_temptable"thisform.optiongroup1.value = 0 thisform.optiongroup1.enabled = .f. bo1.value = "" bo2.value = ""thisform.text1.value = "" thisform.edit1.value = "" store "" to ncombo1,ncombo2,ntext1,chsql,cxsqlthisform.refresh8 、会员修改表单KFGL_HYXG.SCX 程序代码8.1 表单Init 过程程序代码LPARAMETERS nPar1select vip set order to vipid locate for vip.vipid = nPar1thisform.text1.value = vip.vipid thisform.text2.value = vip.vipname if vip.vipsex = " 男"thisform.optiongroup1.value = 1 elsethisform.optiongroup1.value = 2 endif thisform.text4.value =vip.vipaddthisform.text5.value = vip.vipphonethisform.text6.value = vip.vipcode thisform.refresh*输入数据校验if empty(thisform.text2.value)=messagebox(" 请输入会员姓名",0+48+0," 出错")thisform.text2.setfocusreturnendifif thisform.optiongroup1.value = 0 =messagebox(" 请选择会员性别",0+48+0,"出错") thisform.optiongroup1.option1.setfocus returnelse private nvipsex store "" to nvipsex if thisform.optiongroup1.value = 1store " 男" to nvipsex elsestor " 女" to nvipsexendifendifif empty(thisform.text4.value) =messagebox(" 请输入会员联系地址",0+48+0," 出错") thisform.text4.setfocus returnendifif empty(thisform.text5.value) =messagebox(" 请输入会员联系电话",0+48+0," 出错") thisform.text5.setfocus returnendifif empty(thisform.text6.value) =messagebox(" 请输入邮政编码",0+48+0," 出错") thisform.text6.setfocus returnendif*修改数据private nvipid,nvipname,nvipadd,nvipphone,nvipcode nvipid =alltrim(thisform.text1.value) nvipname = alltrim(thisform.text2.value) nvipadd =alltrim(thisform.text4.value) nvipphone = alltrim(thisform.text5.value) nvipcode =alltrim(thisform.text6.value)update vip set vip.vipname = nvipname, vip.vipsex = nvipsex, vip.vipadd = nvipadd,vip.vipphone = nvipphone, vip.vipcode = nvipcode where vip.vipid = nvipid=messagebox(" 修改已完成",0+48+0," 提示")thisform.release8.3 删除按钮Click 事件程序代码nvipid = alltrim(thisform.text1.value)mesbox=messagebox(" 是否删除" + nvipid + " 号会员",4+48+0," 警告") if mesbox=7 thenreturnelseuse vip EXCLUSIVEdelete from vip where vip.vipid = nvipidpack=messagebox(" 会员" + nvipid + " 已经删除",0+48+0," 提示") endif thisform.release9 、会员卡打印表单KFGL_HYDY.SCX 程序代码9.1 打印按钮Click 事件程序代码if empty(thisform.text1.value)=messagebox(" 请输入会员编号",0+16+0," 出错") thisform.text1.setfocus returnelsenvipid = thisform.text1.valueendifnmesbox=messagebox(" 是否打印会员卡?",4+32+0," 会员卡打印") if nmesbox = 6select vip.vipid,vip.vipname,vip.vipsex,vip.vipadd,vip.vipphone,vip.vipco de from vip where vip.vipid = nvipid into cursor vipcardselect vipcardreport form vipcard.frx to printuse in vipcardendif9.2 输入框Text1 的Valid 事件程序代码this.value = alltrim(this.value) if .not.empty(this.value)select vipgo toplocate for vip.vipid = this.value if found()thisform.text2.value = vip.vipname thisform.text3.value = vip.vipsexthisform.text4.value = vip.vipaddthisform.text5.value = vip.vipphone thisform.text6.value = vip.vipcodeelse=messagebox(" 会员编号不存在",0+16+0," 出错") thisform.text1.value = ""thisform.text2.value = ""thisform.text3.value = ""thisform.text4.value = ""thisform.text5.value = ""thisform.text6.value = "" endif endif thisform.refresh10 、采购员管理表单KFGL_CGY.SCX 程序代码10.1 表单自定义过程AUTO_BUYERID 程序代码select buyerset order to buyeridgo bottomprivate autoid1,autoid2,autoid3,autoid4 autoid1alltrim(str(val(substr(alltrim(buyer.buyerid),4,2))+1,2,0)) autoid2 = len(autoid1) if autoid2 =1autoid1 = "0" + autoid1 endif autoid4 = "BUY" + alltrim(autoid1) thisform.text1.value = autoid410.2 表单表单保存按钮Click 程序代码privatenbuyerid,nbuyername,nbuyersex,nbuyerbirthday,nbuyeradd,nb uyerphoneif empty(thisform.text2.value)=messagebox(" 请输入采购员姓名",0+48+0," 出错")thisform.text2.setfocusthisform.refreshreturn endif if thisform.optiongroup1.value = 0 =messagebox(" 请选择采购员性别",0+48+0," 出错") thisform.optiongroup1.option1.setfocus thisform.refresh returnendifif thisform.text3.value = {} =messagebox(" 请输入出生年月",0+48+0," 出错") thisform.text3.setfocus thisform.refresh returnendifif empty(thisform.text4.value) then =messagebox(" 请输入家庭住址",0+48+0,"出错") thisform.text4.setfocus thisform.refresh returnendifif empty(thisform.text5.value) then =messagebox(" 请输入联系电话",0+48+0,"出错") thisform.text5.setfocus thisform.refresh returnendifnbuyerid = alltrim(thisform.text1.value) nbuyername = alltrim(thisform.text2.value) if thisform.optiongroup1.value = 1nbuyersex = " 男"elsenbuyersex = " 女"endifnbuyerbirthday = dtoc(thisform.text3.value)是新记录into values setnbuyeradd = alltrim(thisform.text4.value)nbuyerphone = alltrim(thisform.text5.value)*判断是新记录保存还是修改记录 If thisform.newcommand = .t. && newcommand = .t.存* 数据表 buyer 保存记录insertbuyer(buyerid,buyername,buyersex,buyerbirthday,buyeradd,buyerphone)(nbuyerid,nbuyername,nbuyersex,nbuyerbirthday,nbuyeradd,nbuyerphone)=messagebox(" 保存完毕 ",0+48+0," 提示 ")elseupdate buyerbuyername=nbuyername,buyersex=nbuyersex,buyerbirthday=nbuyerbirthday,buyeradd=nbuyeradd,buyerphone=nbuyerphone wherebuyerid=nbuyerid=messagebox(" 修改完成 ",0+48+0," 提示 ") endif*表单初始化thisform.text1.enabled = .f.thisform.text2.enabled = .f.thisform.optiongroup1.enabled = .f.thisform.text3.enabled = .f.thisform.text4.enabled = .f.thisform.text5.enabled = .f.mand1.enabled = .t.mand2.enabled = .t.mand3.enabled = .t.mand4.enabled = .t.mand5.enabled = .t.mand6.enabled = .t.mand7.enabled = .t.mand8.enabled = .t.mand9.enabled = .t.采购员 已经删mand10.enabled =.f. mand11.enabled =.f.mand12.enabled = .t. thisform.dis_record thisform.dis_reccommand thisform.newcommand = .f.thisform.refresh10.3 表单删除按钮 Click 程序代码if reccount("buyer")=1 then=messagebox(" 只有一条记录 ,不能删除 ",0+16+0," 出错") return elsenbuyerid = alltrim(thisform.text1.value) nbuyername =alltrim(thisform.text2.value) mesbox=messagebox(" 是 否 删 除"+nbuyerid+" 号 "+nbuyername,4+48+0," 警告 ")if mesbox=7 then returnelseuse buyer EXCLUSIVEdelete from buyer where buyer.buyerid=nbuyerid pack=messagebox(nbuyerid+" 号采购员 "+nbuyername+"",0+48+0," 提示 ")endif endif thisform.dis_recordthisform.dis_reccommand thisform.refreshnoFLOAT fields 10.4 表单浏览按钮 Click 程序代码DEFINE WINDOW browsewin FROM 1,1 TO 30,120 CLOSEnominimize nogrow nozoom system select buyerset order to buyeridbrowbuyerid,buyername,buyersex,buyerbirthday,buyeradd,buyerpho ne window browsewin noappend nomodify nodelete release window browsewin 10.5 表单自定义过程 DIS_RECORD 程序代码select buyer set order to buyeridif reccount("buyer") = 0 thisform.text1.value = "" thisform.text2.value = ""thisform.optiongroup1.value = 0 thisform.text3.value = {} thisform.text4.value = "" thisform.text5.value = ""elsethisform.text1.value = buyer.buyerid thisform.text2.value = buyer.buyername if buyer.buyersex = " 男 " thisform.optiongroup1.value = 1 elsethisform.optiongroup1.value = 2 endifthisform.text3.value = buyer.buyerbirthday thisform.text4.value =buyer.buyeradd thisform.text5.value = buyer.buyerphone endif.and.thisform.refresh11 、 采购员信息查找表单 KFGL_CGY_CZ.SCX 程序代码 11.1 表单查找按钮 Click 事件程序代码if thisform.optiongroup1.value = 1 empty(thisform.text1.value)=messagebox(" 请输入采购员编号 ",0+16+0," 出错 ")thisform.text1.setfocus return endif if thisform.optiongroup1.value = 2 empty(thisform.text2.value) =messagebox(" 请输入采购员姓名 ",0+16+0," 出错 ")thisform.text2.setfocusreturn endif if thisform.optiongroup1.value = 0=messagebox(" 请选择条件 ",0+16+0," 出错 ")thisform.optiongroup1.option1.setfocusreturn endifselect buyerset order to buyeridgo topif thisform.optiongroup1.value = 1locate for buyerid == alltrim(thisform.text1.value)if .not.found()=messagebox(" 没有附和条件记录 ",0+16+0," 出错 ")thisform.text1.setfocusreturnendif elselocate for buyername = alltrim(thisform.text2.value)if .not.found()=messagebox(" 没有附和条件记录 ",0+16+0," 出错 ")thisform.text2.setfocusreturnendifendifcggl_cgy.dis_recordcggl_cgy.dis_reccommand cggl_cgy.refresh thisform.release。

销售管理系统界面及代码(毕业设计)

销售管理系统界面及代码(毕业设计)

1.创建网页表单
页面设计:利用网页表单将管理员输入的客户信息传递给目标网页。由目标网页验证后将管
理员输入的客户信息保存到数据库。页面首先创建网页表单并对表单控件进行设置。
代码如下所示。
<%'创建表单 form1,采用隐式传递,提交目标网页 AddCustomer.asp 并返回一个 action 值%>
'获取客户工作单位
memo = Trim(Request.Form("memo"))
'获取客户备注说明
'判断客户信息的合法性
If customer_id = "" Or name = "" Then '如果客户编号或客户名称为空,则提示’客户编号或客户名
称不能为空!’
Response.Write "<Script>alert('客户编号或客户名称不能为空!');</Script>"
customer_id%> name%> city%>
</td>
</tr>
<tr bgcolor="#FFFFFF"> <td align="right"><font color="ff0000">**</font>客户姓名:</td>
<td height="25">&nbsp; <input type="text" name="name">
End If

企业进销存管理系统进货管理主菜单

企业进销存管理系统进货管理主菜单

package com.lzw;import java.awt.*;import java.awt.event.*;import java.beans.PropertyVetoException;import ng.reflect.Constructor;import .*;import java.util.*;import javax.swing.*;import javax.swing.event.*;import com.lzw.iframe.*;public class MenuBar extends JMenuBar {/*** (进货管理)菜单*/private JMenu jinhuo_Menu = null;/*** (进货单)菜单项,位于(进货管理)菜单内*/private JMenuItem jinhuoItem = null;/*** (进货退货)菜单项,位于(进货管理)菜单内 */private JMenuItem jinhuo_tuihuoItem = null;/*** (销售管理)菜单*/private JMenu xiaoshou_Menu = null;/*** (库存管理)菜单*/private JMenu kucun_Menu = null;/*** (信息查询)菜单*/private JMenu xinxi_chaxunMenu = null;/*** (基本资料)菜单*/private JMenu jiben_ziliaoMenu = null;/*** (系统维护)菜单*/private JMenu xitong_weihuMenu = null;/*** (窗口)菜单*/private JMenu chuang_kouMenu = null;/*** (帮助)菜单*/private JMenu bang_zhuMenu = null;/*** (关于)菜单项,位于(帮助)菜单内*/private JMenuItem guanyu_Item = null;/*** (联系技术支持)菜单项,位于(帮助)菜单内 */private JMenuItem bugItem = null;/*** (访问技术网站)菜单项,位于(帮助)菜单内 */private JMenuItem fangwen_wangzhanItem = null; /*** (销售单)菜单项,位于(销售管理)菜单内 */private JMenuItem xiaoshou_danItem = null;/*** (销售退货)菜单项,位于(销售管理)菜单内 */private JMenuItem xiaoshou_tuihuoItem = null;/*** (库存盘点)菜单项,位于(库存管理)菜单内 */private JMenuItem kucun_pandianItem = null;/*** (价格调整)菜单项,位于(库存管理)菜单内 */private JMenuItem jiage_tiaozhengItem = null;/*** (销售查询)菜单项,位于(信息查询)菜单内*/private JMenuItem xiaoshou_chaxunItem = null;/*** (商品查询)菜单项,位于(信息查询)菜单内*/private JMenuItem shangpin_chaxunItem = null;/*** (销售排行)菜单项,位于(信息查询)菜单内*/private JMenuItem xiaoshou_paihangItem = null;/*** (商品管理)菜单项,位于(基本资料)菜单内*/private JMenuItem shangpin_guanliItem = null;/*** (客户管理)菜单项,位于(基本资料)菜单内*/private JMenuItem kehu_guanliItem = null;/*** (供应商管理)菜单项,位于(基本资料)菜单内*/private JMenuItem gys_guanliItem = null;/*** (经手人设置)菜单项,位于(基本资料)菜单内*/private JMenuItem jsr_guanliItem = null;/*** (密码修改)菜单项,位于(系统维护)菜单内*/private JMenuItem mima_xiugaiItem = null;/*** (数据库备份与恢复)菜单项,位于(系统维护)菜单内 */private JMenuItem shuju_beifenItem = null;/*** (退出)菜单项,位于(系统维护)菜单内*/private JMenuItem exitItem = null;/*** (窗口平铺)菜单项,位于(窗口)菜单内*/private JMenuItem pingpuItem = null;/*** 容纳内部窗体的桌面面板*/private JDesktopPane desktopPanel = null;/*** 内部窗体的集合*/private Map<JMenuItem, JInternalFrame> iFrames = null; /*** 内部窗体的位置坐标*/private int nextFrameX, nextFrameY;/*** (全部关闭)菜单项,位于(窗口)菜单内*/private JMenuItem closeAllItem = null;/*** (全部最小化)菜单项,位于(窗口)菜单内*/private JMenuItem allIconItem = null;/*** (全部还原)菜单项,位于(窗口)菜单内*/private JMenuItem allResumeItem = null;/*** 状态栏的内部窗体提示标签*/private JLabel stateLabel = null;/*** 默认的构造方法**/private MenuBar() {}public MenuBar(JDesktopPane desktopPanel, JLabel label) {super();iFrames = new HashMap<JMenuItem, JInternalFrame>();this.desktopPanel = desktopPanel;this.stateLabel = label;initialize();}/*** 初始化菜单栏界面的方法**/private void initialize() {this.setSize(new Dimension(600, 24));add(getJinhuo_Menu());add(getXiaoshou_Menu());add(getKucun_Menu());add(getXinxi_chaxunMenu());add(getJiben_ziliaoMenu());add(getXitong_weihuMenu());add(getChuang_kouMenu());add(getBang_zhuMenu());}/*** 初始化进货管理菜单的方法** @return javax.swing.JMenu*/public JMenu getJinhuo_Menu() {if (jinhuo_Menu == null) {jinhuo_Menu = new JMenu();jinhuo_Menu.setText("进货管理(J)");jinhuo_Menu.setMnemonic(KeyEvent.VK_J);jinhuo_Menu.add(getJinhuoItem());jinhuo_Menu.add(getJinhuo_tuihuoItem());}return jinhuo_Menu;}/*** 初始化(进货单)菜单项的方法该方法定义菜单项打开进货单窗口,并使窗口处于被选择状态** @return javax.swing.JMenuItem*/public JMenuItem getJinhuoItem() {if (jinhuoItem == null) {jinhuoItem = new JMenuItem();jinhuoItem.setText("进货单");jinhuoItem.setIcon(new ImageIcon(getClass().getResource("/res/icon/jinhuodan.png")));jinhuoItem.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {createIFrame(jinhuoItem, JinHuoDan_IFrame.class);}});}return jinhuoItem;}/*** 初始化(进货退货)菜单项的方法,该方法定义菜单项打开(进货退货)窗体,并使窗体处于已选择状态。

C语言进销存管理系统源程序

C语言进销存管理系统源程序

參止头埒秦皇岛分校NorthEastern University At QinHuangDaoC语言课程设计综合性程序设计报告之源程序设计题目:电脑公司进销存管理系统专业:冶金工程学号:8090507姓名:刘欢成绩: ________________设计时间: 2010年11月03日二•开题说明1•问题概要该系统用于处理某电脑公司的设备买入,卖出,仓储等设备账目。

在买入设备时,记录设备的数量型号(如computer,keyboard和价钱,并在库房记录中添加设备,在卖出设备时从库房中减掉该设备,并根据卖出的数量型号和价钱得出每一笔买出的利润。

每个一段时间盘点库房和账目计算出利润等数据。

基本要求:有货物管理(设备的添加,删除,修改)有账目管理可以查询账目清单可以计算年度或月份或季度利润。

2•问题分析:先定义合适的结构体,存储物品信息。

在程序中建立一个文件用于存储,凡进行了进货操作的物品在文件中都有记录,进货时由于尚不知售货时间与售价、利润,故此三项(实际为四项,时间分为年、月两项)暂先赋值为零,待进行售货操作时再输入各数值,其中利润由系统自动计算得出并保存。

账目清单分为已售、仓储两部分,由此可看到所有购进、卖出的货物信息。

月利润查询可查得所输入年月的各类所售货物数量与利润。

功能模块四•源程序#i nclude <stdio.h>#i nclude <stdlib.h>#i nclude vconi o.h>#in clude <dos.h>#i nclude <stri ng.h>#define LEN sizeof(struct object)#defi ne FORMAT1 "\t%-8d%-11s%-9.2f%-6d%-4d\n"#defi ne DATA1 (p1+i)->nu m,(p1+i)->n ame,(p1+i)->i nprice,(p1+i)->i ny ear,(p1+i)->i nmonth#defi ne FORMAT2 "\t%-8d%-11s%-9.2f%-9.2f%-7.2f%-6d%-4d%-6d%-4d\n"#defi ne DATA2 (p1+i)->nu m,(p1+i)->n ame,(p1+i)->inprice,(p1+i)->outprice,(p1+i)->profit,(p1+i)- >iny ear,(p1+i)->inmonth,(p1+i)->outyear,(p1+i)->outm onthvoid in();void show();void modify();void sell();void menu();void mon thearn();struct object{int nu m,i ny ear,i nmon th,outyear,outmo nth;char n ame[10];float in price,outprice,profit;} obj[100];struct object *p1=obj;mai n(){int n;menu();while( n)switch( n){case 1: in( );break;case 2:sell();break;case 3:modify();break;case 4:show();break;case 5:m on thear n( );break;default:break;}getch();menu();sca nf("%d",&n);}}void menu ()// 菜单{system("cls");prin tf("\n\n\n\n\n\n");*************** 菜单************** \n");prin tf("\t\t 0.退出\n ”);printf("\t\t 1.进货操作\n");printf("\t\t 2.售货操作\n");prin tf("\t\t 3•修改信息\n");prin tf("\t\t 4.账目清单\n");prin tf("\t\t 5月利润查询\n");printf("\t\t********************************\n")・}void in() //进货操作{int i,m=0;char ch[2];FILE *p;if( (p=fope n( "data","a+"))==NULL){printf("打不开文件!\n"); //打开文件retur n;}while(!feof(p)){if(fread(&obj[m] ,L EN,1,p)==1)m++; //将数据读入内存}fclose(p);if(m==0)printf("无记录!\n");printf("请确认是否进货?( y/n)");sea nf("%s",ch);while(strcmp(ch,"y")==0||strcmp(ch,"y")==0){printf("请输入设备编号:");sca nf("%d", &obj[m]. nu m);for(i=0;i<m;i++)if((p1+i)->num==obj[m]. num){printf("此号已存在,按任意键继续!");getch();fclose(p);return;}printf("设备名称:");sca nf("%s",obj[m]. name);printf("进价:");sca nf("%f",&obj[m].i nprice);printf("进货年、月:");sea nf("%d%d",&obj[m].i nyear,&obj[m].i nmon th);obj[m].outprice=0;obj[m].outyear=0;(p1+m)->outm on th=0;fope n( "data","w"); //打开文件用以向磁盘导入数据for(i=0;i<=m;i++)fwrite(&obj[i],LEN,1,p);if(fwrite(&obj[m] ,L EN,1,p)!=1){printf("无法保存!");getch();}else{printf("%s 保存成功!\n",obj[m].name);m++;}printf("继续?( y/n)");sca nf("%s",ch);}fclose(p);printf("保存完毕!\n");printf("进价:");}void sell() //售货操作{FILE *p;int snu m,i,j,m=0;char ch[2];if((p二fope n("data","rb"))==NULL){prin tf("无法打开文件! \n"); retur n;}while(!feof(p))if(fread(&obj[m] ,L EN,1,p)==1) m++;fclose(p);if(m==0){printf("无记录! \n"); return;} sca nf("%d", &sn um);//打开文件//读入printf("请输入编号:");for(i=0;i<m;i++)if(snum==(p1+i)->num)break;if(i<m) // 判断1{printf("查得此物品,确认出售? ( y/n) ”);sca nf("%s",ch);if(strcmp(ch,"y")==O||strcmp(ch,"Y")==0) //判断2 {printf("请输入售价:");sca nf("%f",&(p1+i)->outprice);(p1+i)->profit=((p1+i)->outprice-(p1+i)->i nprice);printf("\n请输入售出年、月:");sca nf("%d%d",&(p1+i)->outyear,&(p1+i)->outmo nth);if((p=fope n("data","wb+"))==NULL){printf("打不开文件! \n ”);return;}for(j=0;j<m;j++)if(fwrite(&obj[j],LEN,1,p)!=1) printf("无法保存! \n”); getch();}printf("售货成功!"); fclose(p);retur n;}elsereturn; //判断2}elseprintf("无此物品!");return; 〃判断1}void modify() // 修改信息FILE *p;int i,j,m=O,s num;if((p二fope n( "data","rb"))==NULL) {printf("打不开文件!\n”);return;}while(!feof(p))if(fread(&obj[m] ,L EN,1,p)==1)m++;if(m==0){printf("无记录! \n");fclose(p);return;}printf("请输入欲修改信息的货物编号:");sca nf("%d",&sn um);for(i=0;i<m;i++)if(snum==(p1+i)->num)break;if(i<m){prin tf("找到此货物! \n");printf("\n 名称:”);sea nf("%s",(p1+i)-> name);printf("\n 进价:");sea nf("%f",&(p1+i)->i npriee);printf("\n 进货年、月:");sea nf("%d%d",&(p1+i)->i nyear,&(p1+i)->i nmon th); if((p=fope n("data","wb+"))==NULL){printf("打不开文件! \n");return;}for(j=0;j<m;j++)if(fwrite(&obj[j],LEN,1,p)!=1){printf("无法保存!");getch();}fclose(p);}else return;printf("无此货物!");printf("\t 编号 名称 进价进货时间\t\n"); void show() //账目清单 {FILE *p; int i,m=0;if((p 二fope n( "data","rb"))==NULL)printf("打不开!"); while(!feof(p))if(fread(&obj[m] ,L EN,1,p)==1)m++;fclose(p);printf("已售\n\t 编号 名称进价 售价 利润间出售时间\t\n");for(i=0;i<m;i++) {if((p1+i)->profit!=0)printf(FORMAT2,DA TA2);}printf("仓储 \n"); for(i=0;i<m;i++)进货时{if((p1+i)->profit==0)prin tf(F0RMAT1,DATA1);}} void mon thearn()〃月利润{FILE *p;int m=0,s=0,a=0,b=0,c=0,d=0,y,z;float sum1=0,sum2=0,sum3=0,sum4=0;if((p=fope n( "data","rb"))==NULL){printf("打不开文件! \n");retur n;} //打开文件while(!feof(p))if(fread(&obj[m] ,L EN,1,p)==1)m++;fclose(p); //将数据读入内存printf("请输入欲查询的年份、月份:");sea nf("%d%d", &y,& z);for(s=0;s<m;s++){if((strcmp(obj[s].name,"zhuji")==0)&&(y==obj[s].outyear)&&( z==obj[s].outm on th)) {a++;sum1+=obj[s].profit;}if((strcmp(obj[s]. name,"xianshiqi")==0)&&(y==obj[s].outyear)&&( z==obj[s].outm on th)){b++;sum2+=obj[s].profit;}if((strcmp(obj[s]. name,"jianpan ”)==0)&&(y==obj[s].outyear)&&( z==obj[s].outmo nth))c++;sum3+=obj[s].profit;if((strcmp(obj[s].name,"shubiao")==0)&&(y==obj[s].outyear)&&( z==obj[s].outmo nth)) {d++;sum4+=obj[s].profit;}}printf("本月共售出\n");printf("\t 主机%d 台,总利润%7.2f 元\n",a,sum1);printf("\t 显示器%d 台,总利润%7.2f 元\n",b,sum2);printf("\t 键盘%d 台,总利润%7.2f 元\n",c,sum3);printf("\t 鼠标%d 台,总利润%7.2f 元\n",d,sum4);。

进销存网站管理系统-代码

package org.liky.game.frame;import java.awt.Color;import java.awt.Font;import java.awt.Graphics;import java.awt.Toolkit;import java.awt.event.MouseEvent;import java.awt.event.MouseListener;import java.awt.image.BufferedImage;import java.io.File;import java.io.IOException;import javax.imageio.ImageIO;import javax.swing.JFrame;public class MyChessFrame extends JFrame implements MouseListener { public MyChessFrame() {this.setTitle;this.setSize(1000, 700);this.setResizable(false) ;this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);int width = Toolkit.getDefaultToolkit().getScreenSize().width;int height = Toolkit.getDefaultToolkit().getScreenSize().height;/*System.out.println;System.out.println;*/this.setLocation((width - 200)/2, (height-100)/2);this.addMouseListener(this);this.setVisible(true);}public void paint(Graphics g) {/*g.drawString;*//*g.drawOval(20, 40, 40, 40);*//*g.fillOval(20, 40, 40, 40);*//*g.drawLine(20, 40, 80, 40);*//* g.drawRect(20, 40, 40, 20);g.fillRect(80, 40, 40, 20);*/BufferedImage image = null;try {image = ImageIO.read(new File);} catch (IOException e) {// TODO Auto-generated catch blocke.printStackTrace();}g.drawImage(image,0,0,this);g.drawOval(20, 40, 40, 40);g.setColor(Color.BLUE);g.fillRect(80, 40, 40, 20);g.setFont(new Font;g.drawString;}public void mouseClicked(MouseEvent arg0) {// TODO Auto-generated method stub}public void mouseEntered(MouseEvent arg0) {// TODO Auto-generated method stub}public void mouseExited(MouseEvent arg0) {// TODO Auto-generated method stub}public void mousePressed(MouseEvent arg0) {// TODO Auto-generated method stub}public void mouseReleased(MouseEvent arg0) {// TODO Auto-generated method stub}}package org.liky.game.test;import org.liky.game.frame.FiveChessFrame;public class Test {public static void main(String[] args) {/*MyChessFrame mf = new MyChessFrame();*///JOptionPane.showMessageDialog(mf,;/*int result = JOptionPane.showConfirmDialog;if (result == 0 ) {JOptionPane.showMessageDialog;}if (result == 1) {JOptionPane.showMessageDialog;}if (result == 2) {JOptionPane.showMessageDialog;}*//*String username = JOptionPane.showInputDialog;if (username != null) {System.out.println(username );JOptionPane.showMessageDialog"+username );} else {JOptionPane.showMessageDialog;}*/FiveChessFrame ff = new FiveChessFrame();}}package org.liky.game.frame;import java.awt.Color;import java.awt.Font;import java.awt.Graphics;import java.awt.Toolkit;import java.awt.event.MouseEvent;import java.awt.event.MouseListener;import java.awt.image.BufferedImage;import java.io.File;import java.io.IOException;import javax.imageio.ImageIO;import javax.swing.JFrame;import javax.swing.JOptionPane;public class FiveChessFrame extends JFrame implements MouseListener, Runnable {int width = Toolkit.getDefaultToolkit().getScreenSize().width;int height = Toolkit.getDefaultToolkit().getScreenSize().height;BufferedImage bgImage = null;int x = 0;int y = 0;int[][] allChess = new int[19][19];boolean isBlack = true;boolean canPlay = true;String message =;int maxTime = 0;Thread t = new Thread(this);int blackTime = 0;int whiteTime = 0;String blackMessage =;String whiteMessage =;public FiveChessFrame() {this.setTitle;this.setSize(500, 500);this.setLocation((width - 500) / 2, (height - 500) / 2);this.setResizable(false);this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);this.addMouseListener(this);this.setVisible(true);t.start();t.suspend();this.repaint();String imagePath = "" ;try {imagePath=System.getProperty("user.dir")+"/bin/image/background.jpg" ;bgImage = ImageIO.read(new File(imagePath.replaceAll("\\\\", "/")));} catch (IOException e) {// TODO Auto-generated catch blocke.printStackTrace();}}public void paint(Graphics g) {BufferedImage bi = new BufferedImage(500, 500,BufferedImage.TYPE_INT_RGB);Graphics g2 = bi.createGraphics();g2.setColor(Color.BLACK);g2.drawImage(bgImage, 1, 20, this);g2.setFont(new;g2.drawString;g2.setFont(new Font;g2.drawString;g2.drawString;for (int i = 0; i < 19; i++) {g2.drawLine(10, 70 + 20 * i, 370, 70 + 20 * i);g2.drawLine(10 + 20 * i, 70, 10 + 20 * i, 430);}g2.fillOval(68, 128, 4, 4);g2.fillOval(308, 128, 4, 4);g2.fillOval(308, 368, 4, 4);g2.fillOval(68, 368, 4, 4);g2.fillOval(308, 248, 4, 4);g2.fillOval(188, 128, 4, 4);g2.fillOval(68, 248, 4, 4);g2.fillOval(188, 368, 4, 4);g2.fillOval(188, 248, 4, 4);for (int i = 0; i < 19; i++) {for (int j = 0; j < 19; j++) {if (allChess[i][j] == 1) {int tempX = i * 20 + 10;int tempY = j * 20 + 70;g2.fillOval(tempX - 7, tempY - 7, 14, 14);}if (allChess[i][j] == 2) {int tempX = i * 20 + 10;int tempY = j * 20 + 70;g2.setColor(Color.WHITE);g2.fillOval(tempX - 7, tempY - 7, 14, 14);g2.setColor(Color.BLACK);g2.drawOval(tempX - 7, tempY - 7, 14, 14);}}}g.drawImage(bi, 0, 0, this);}public void mouseClicked(MouseEvent e) {// TODO Auto-generated method stub}public void mouseEntered(MouseEvent e) {// TODO Auto-generated method stub}public void mouseExited(MouseEvent e) {// TODO Auto-generated method stub}public void mousePressed(MouseEvent e) {// TODO Auto-generated method stub*System.out.println("X:"+e.getX());System.out.println("Y:"+e.getY());if (canPlay == true) {x = e.getX();y = e.getY();if (x >= 10 && x <= 370 && y >= 70 && y <= 430) {x = (x - 10) / 20;y = (y - 70) / 20;if (allChess[x][y] == 0) {if (isBlack == true) {allChess[x][y] = 1;isBlack = false;message =;} else {allChess[x][y] = 2;isBlack = true;message =;}boolean winFlag = this.checkWin();if (winFlag == true) {JOptionPane.showMessageDialog(this, "+ (allChess[x][y] == 1 ?canPlay = false;}} else {JOptionPane.showMessageDialog}this.repaint();}}/* System.out.println(e.getX() + " -- " + e.getY()); */if (e.getX() >= 400 && e.getX() <= 470 && e.getY() >= 70&& e.getY() <= 100) {int result = JOptionPane.showConfirmDialog(this,;if (result == 0) {for (int i = 0; i < 19; i++) {for (int j = 0; j < 19; j++) {allChess[i][j] = 0;}}message =;isBlack = true;blackTime = maxTime;whiteTime = maxTime;if (maxTime > 0) {blackMessage = maxTime / 3600 + ":"+ (maxTime / 60 - maxTime / 3600 * 60) + ":"+ (maxTime - maxTime / 60 * 60);whiteMessage = maxTime / 3600 + ":"+ (maxTime / 60 - maxTime / 3600 * 60) + ":"+ (maxTime - maxTime / 60 * 60);t.resume();} else {blackMessage =;whiteMessage =;}this.canPlay = true;this.repaint();}}if (e.getX() >= 400 && e.getX() <= 470 && e.getY() >= 120&& e.getY() <= 150) {String input = JOptionPanetry {maxTime = Integer.parseInt(input) * 60;if (maxTime < 0) {JOptionPane.showMessageDialog(this,;}if (maxTime == 0) {intresult=JOptionPane.showConfirmDialog(this,if (result == 0) {for (int i = 0; i < 19; i++) {for (int j = 0; j < 19; j++) {allChess[i][j] = 0;}}message =;isBlack = true;blackTime = maxTime;whiteTime = maxTime;package pm;public class SwitchTest {//>=90 A// 80~89 B// 70~79 C// 60~69 D// <60 Epublic static void main(String[] args) {int s=87;switch(s/10){case 10 :System.out.println("A");break;case 9 :System.out.println("A");break;case 8 :System.out.println("B");break;case 7 :System.out.println("c");break;case 6 :System.out.println("D");break;default :System.out.println("E");break;}}}package pm;public class SwitchTest{public static void main(String[] args){for(int i=1;i<=9;i++){for(int j=1;j<=i;j++){System.out.print(j+"*"+i+"="+(i*j)+"\t");}System.out.println();}}}package pm;import java.util.Scanner;public class SwitchTest {public static void main(String[] args) {Scanner sc=new Scanner(System.in);while (true) {System.out.println;String s = sc.next().trim();if ("c".equalsIgnoreCase(s)) {System.out.println;double db = sc.nextDouble();double db2 = (db * 9 / 5) + 32;System.out.println(" + db2 + "F");} else if ("f".equalsIgnoreCase(s)) {System.out.println;double db = sc.nextDouble();double db2 = (db - 32) * 5 / 9;System.out.println(+ Math.round(db2) + "C");}else if("exit".equalsIgnoreCase(s)){break;}}}}package pm;import java.util.Scanner;public class SwitchTest{public static void main(String[] args) {Scanner sc=new Scanner(System.in);boolean flag=true;while (flag) {System.out.println;String str = sc.nextLine().trim();if (str.endsWith("c") || str.endsWith("C")) {String st = str.substring(0, str.length() - 1);double db = Double.parseDouble(st);//[0,2)//2 double db=Double.valueOf(st).doubleValue();double db2 = (db * 9 / 5) + 32;System.out.println;} else if (str.endsWith("f") || str.endsWith("F")) {String st = str.substring(0, str.length() - 1);double db = Double.parseDouble(st);//[0,2)//2 double db=Double.valueOf(st).doubleValue();double db2 = (db - 32) * 5 / 9;System.out.println(+ Math.round(db2) + "C");}else if("exit".equalsIgnoreCase(str)){flag=false;}}}}package pm;public class SwitchTest {public static void main(String[] args) {int a=1,b=2,c=3,d=0;d=a>b?a:b;d=a>b?(a>c?a:c):(b>c?b:c);System.out.println;}}package one;import java.awt.BorderLayout;import java.awt.GridLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JPanel;import javax.swing.JTextField;public class Jsq implements ActionListener {private JFrame frame;private JButton[] bus;private JTextField jtx;private JButton bu;private char[] strs;private String d_one = "";private String operator;public static void main(String[] args) {new Jsq();}public Jsq() {frame = new JFrame;jtx = new JTextField(14);bus = new JButton[16];strs = "789/456*123-0.+=".toCharArray();for (int i = 0; i < 16; i++) {bus[i] = new JButton(strs[i] + "");bus[i].addActionListener(this);}bu = new JButton("C");bu.addActionListener(this);init();}/* GUI */public void init() {JPanel jp1 = new JPanel();jp1.add(jtx);jp1.add(bu);frame.add(jp1, BorderLayout.NORTH);JPanel jp2 = new JPanel();jp2.setLayout(new GridLayout(4, 4));for (int i = 0; i < 16; i++) {jp2.add(bus[i]);}frame.add(jp2, BorderLayout.CENTER);frame.pack();frame.setLocation(300, 400);frame.setVisible(true);frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);}public void actionPerformed(ActionEvent arg0) {String conn = arg0.getActionCommand();if ("C".equals(conn)) {d_one = "";operator = "";jtx.setText("");return;}if(".".equals(conn)){return;}if (("+-*/".indexOf(conn)) != -1) {if("".equals(d_one) && "".equals(jtx.getText())) return;d_one = jtx.getText();operator = conn;jtx.setText("");return;}if ("=".equals(conn)) {if("".equals(d_one) && "".equals(jtx.getText())) return;double db = 0;if ("+".equals(operator)) {db = Double.parseDouble(d_one)+ Double.parseDouble(jtx.getText());jtx.setText(db + "");}if ("-".equals(operator)) {db = Double.parseDouble(d_one)- Double.parseDouble(jtx.getText());jtx.setText(db + "");}if ("*".equals(operator)) {db = Double.parseDouble(d_one)* Double.parseDouble(jtx.getText());jtx.setText(db + "");}if ("/".equals(operator)) {db = Double.parseDouble(d_one)/ Double.parseDouble(jtx.getText());jtx.setText(db + "");}d_one = db + "";return;}jtx.setText(jtx.getText() + conn);}}package pm;public class SwitchTest{public static void main(String[] args){int n=5;for(int i=0;i<=n;i++){for(int j=0;j<n-i;j++){System.out.print(" ");}for(int k=0;k<2*i-1;k++){System.out.print("*");}System.out.println();}}}package pm;import java.util.Scanner;public class SwitchTest{public static void main(String[] args){String name=null;Scanner sca=new Scanner (System.in);char firstChar;do{System.out.println("please input your name");name=sca.nextLine();firstChar=name.charAt(0);}while(!(firstChar>='a' && firstChar<='z' ||firstChar>='A' && firstChar<='Z'));System.out.println("OK! your name is:"+name);}}package pm;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JPanel;public class SwitchTest {private JFrame frame;private JLabel jl1;private JLabel jl2;private JLabel jl3;/* */public static void main(String[] args) {new SwitchTest().getTime();}private void getTime(){long time=1*3600;long hour =0 ;long minute =0 ;long seconds=0;while(time>=0){hour=time/3600;minute=(time-hour*3600)/60;seconds=time-hour*3600-minute*60;jl1.setText(hour+"时");jl2.setText(minute+"分");jl3.setText(seconds+"秒");try {Thread.sleep(1000);} catch (InterruptedException e) {e.printStackTrace();}time--;}}/* GUI */public SwitchTest(){frame = new JFrame;jl1 = new JLabel();jl2 = new JLabel();jl3 = new JLabel();init();}/* */private void init(){JPanel jp=new JPanel();jp.add(jl1);jp.add(jl2);jp.add(jl3);frame.add(jp);frame.setVisible(true);frame.setLocation(300,400);frame.setSize(300, 200);frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);}}public class Sjx{public static void main(String[] args){int SIZE=19;for(int i=0;i<SIZE;i++){if(i<10){System.out.print(" "+i);}else{System.out.print(" "+(char)(i+'a'-10));}}System.out.println();// System.out.print(i<10?(char)(i+'0'):(char)(i+'a'-10));for(int i=0;i<SIZE;i++){if(i<10){System.out.print(i+" ");//}else{System.out.print((char)(i+'a'-10)+" ");}for(int j=0;j<SIZE;j++){System.out.print("*"+" ");}System.out.println();}}}package day04;public class ArrayTest {public static void main(String[] args){char[][] arr=new char[4][7];String s="";for(int i=0;i<arr.length;i++){for(int j=0;j<arr[i].length;j++){arr[i][j]=s.charAt(i*7+j);}}for(int i=0;i<arr[0].length;i++){for(int j=0;j<arr.length;j++){System.out.print(arr[arr.length-j-1][i]+" ");}System.out.println();}}}package day02;public class Fangk{public static void main(String[] args){for(int i=1000;i<=9999;i++){int q=i/1000;int b=i/100%10;int s=i/10%10;int g=i%10;if(q>b && s>g && q+g==b+s && b%2!=0){System.out.println("The Min Number is:"+i);break;}}loop1: for(int q=1;q<=9;q++){loop2: for(int b=0;b<=9;b++){if(b%2==0){continue loop2;}for(int s=0;s<=9;s++){for(int g=0;g<=9;g++){if(q>b && s>g && q+g==b+s){System.out.println("The Min Number is:"+(q*1000+b*100+s*10+g));break loop1;}}}}package day02;public class Fangk{public static void main(String[] args){int num=14;boolean flag=true;for(int i=2;i<=num/2;i++){if(num%i==0){flag=false;break;}}if(flag){System.out.println(num+" is a prime number!");}else{System.out.println(num+" is not a prime number!");}}}package day04;import java.util.Scanner;public class A1{public static void main(String[] args){int n;Scanner sca=new Scanner(System.in);System.out.println("please input a number:");n=sca.nextInt();if(isPrimeNumber(n)){System.out.println(n+"is a prime number!");}else{System.out.println(n+"is not a prime number!");}}public static boolean isPrimeNumber(int n){for(int i=2;i<=n/2;i++){if(n%i==0){return false;}}return true;}}package day02;public class Daoxu{public static void main(String[] args){int olddata=3758;int newdata=0;while(olddata!=0){for(int i=0;i<4;i++){newdata=newdata*10+olddata%10;olddata=olddata/10;}System.out.println("newdata="+newdata);}}}package day04;import java.util.Scanner;public class ArrayTest {public static void main(String[] args){int n;Scanner s=new Scanner(System.in);System.out.println("please input a number:");n=s.nextInt();for(int i=31;i>=0;i--){if((n&(1<<i))!=0){System.out.print("1");}else{System.out.print("0");}if((32-i)%8==0){System.out.print(" ");}}}}package day02;public class Fangk {public static void main(String[] args){int m=5,n=6;for(int i=0;i<n;i++){System.out.print("* ");}System.out.println();for(int i=0;i<m-2;i++){System.out.print("* ");for(int j=0;j<n-2;j++){System.out.print(" ");}System.out.print("*");System.out.println();}for(int i=0;i<n;i++){System.out.print("* ");}}}package day02;import java.util.Scanner;public class Csz {public static void main(String[] args) {Scanner s = new Scanner(System.in);int num = (int) (Math.random() * 1000);int m=0;for(int i=9;i>=0;i--){System.out.println("please input your number! ");m=s.nextInt();if(m>num){System.out.println("Too large!");}else if(m<num){System.out.println("Too small!");}else{System.out.println("You are right!");break;}if(i>0){System.out.println;}}if( m!=num){System.out.println;}}}17.HotelManagerpackage hotel;import java.util.Scanner;public class HotelManager {private static String[][] rooms;public static void main(String[] args) {rooms = new String[10][12];String comm;for (int i = 0; i < rooms.length; i++) {for (int j = 0; j < rooms[0].length; j++) {rooms[i][j] = "EMPTY";}}while (true) {System.out.println;Scanner sca = new Scanner(System.in);System.gc();comm = sca.next();if ("search".equalsIgnoreCase(comm)) {search();} else if ("in".equalsIgnoreCase(comm)) {int roomNo = sca.nextInt();String name = sca.next();in(roomNo, name);} else if ("out".equalsIgnoreCase(comm)) {int roomNo = sca.nextInt();out(roomNo);} else if ("exit".equalsIgnoreCase(comm)) {System.out.println;break;} else {System.out.println;}}}private static void out(int roomNo) {if("EMPTY".equals(rooms[(roomNo/100)-1][(roomNo%100)-1])){System.out.println;return;}rooms[(roomNo/100)-1][(roomNo%100)-1]="EMPTY";System.out.println;}private static void in(int roomNo, String name) {if(!"EMPTY".equals(rooms[(roomNo/100)-1][(roomNo%100)-1])){System.out.println;return;}rooms[(roomNo/100)-1][(roomNo%100)-1]=name;System.out.println;}private static void search() {for (int i = 0; i < rooms.length; i++) {for (int j = 0; j < rooms[0].length; j++) {if (j + 1 < 10) {System.out.print(i + 1 + "0" + (j + 1) + "");} else {System.out.print(i + 1 + "" + (j + 1) + " ");}}System.out.println();for (int j = 0; j < rooms[0].length; j++) {System.out.print(rooms[i][j] + " ");}System.out.println();}}}18.StudentManagerpackage day05.student_manager;import java.util.Scanner;public class StudentManager {static int[][] scores=new int[6][5];static String[]students={"zhangsan","lisi","wangwu","zhaoliu","qianqi","liuba"};static String[] courses={"corejava","jdbc","servlet","jsp","ejb"};public static void main(String[] args) {for(int i=0;i<scores.length;i++){for(int j=0;j<scores[i].length;j++){scores[i][j]=(int)(Math.random()*100);}}Scanner s=new Scanner(System.in);String comm;while(true){System.out.println;comm=s.next();if(comm.equals("AVG")){String para=s.next();avg(para);}else if(comm.equals("SORT")){String course=s.next();sort(course);}else if(comm.equals("GET")){String student=s.next();String course=s.next();get(student,course);}else if(comm.equals("EXIT")){break;}else{System.out.println;}}}//main() end!public static void avg(String para){int sIndex=-1;int cIndex=-1;for(int i=0;i<students.length;i++){if(students[i].equals(para)){sIndex=i;}}if(sIndex==-1){for(int i=0;i<courses.length;i++){if(courses[i].equals(para)){cIndex=i;}}}if(sIndex==-1 && cIndex==-1){System.out.println;return;}double avg=0.0;if(sIndex!=-1){for(int i=0;i<scores[sIndex].length;i++){avg+=scores[sIndex][i];}avg/=scores[sIndex].length;System.out.println(+para++avg);}else{for(int i=0;i<scores.length;i++){avg+=scores[i][cIndex];}avg/=scores.length;System.out.println(+para+ +avg);}}public static void sort(String course){int[] courseScore=new int[scores.length];if(course.equals("sum"))courseScorefor(int i=0;i<scores.length;i++){int studentSum=0;for(int j=0;j<scores[i].length;j++){studentSum+=scores[i][j];}courseScore[i]=studentSum;}}elseint cIndex=-1;for(int i=0;i<courses.length;i++)if(courses[i].equals(course)){cIndex=i;}}if(cIndex!=-1)// scores* courseScore!for(int i=0;i<scores.length;i++){courseScore[i]=scores[i][cIndex];}}else{System.out.println;return;}}String[] studentCopy=new String[students.length];System.arraycopy(students, 0, studentCopy, 0, students.length);for(int i=0;i<courseScore.length-1;i++){for(int j=i+1;j<courseScore.length;j++){if(courseScore[i]<courseScore[j]){int temp=courseScore[i];courseScore[i]=courseScore[j];courseScore[j]=temp;String stemp=studentCopy[i];studentCopy[i]=studentCopy[j];studentCopy[j]=stemp;}}}int order=1;System.out.println;for(int i=0;i<courseScore.length;i++){if(i!=0 && courseScore[i]==courseScore[i-1]){order--;}else{order=i+1;}System.out.print(order+"\t");System.out.print(studentCopy[i]+"\t");System.out.println(courseScore[i]);order++;}}public static void get(String student,String course){int sIndex=-1;int cIndex=-1;for(int i=0;i<students.length;i++){if(students[i].equals(student)){sIndex=i;}}if(sIndex==-1){System.out.println(+student);return;}if(course.equals("sum")){int studentSum=0;for(int j=0;j<scores[sIndex].length;j++){studentSum+=scores[sIndex][j];}System.out.println(student+studentSum);return;}for(int i=0;i<courses.length;i++){if(courses[i].equals(course)){cIndex=i;}}if(cIndex==-1){System.out.println(+course);return;}System.out.println(student+course+scores[sIndex][cIndex]);}}19.Fivepackage hotel;import java.util.Scanner;public class Five {private static String[][] five=new String[17][17];static{drawFive();}public static void main(String[] args) {while(true){System.out.println;Point p1=pleaseIn();if(!five[Integer.parseInt(p1.getX())][Integer.parseInt(p1.getY())].equal s("*")){System.out.println;}runPoint(p1,"white");gameover(p1);System.out.println;Point p2=pleaseIn();if(!five[Integer.parseInt(p2.getX())][Integer.parseInt(p2.getY())].equal s("*")){System.out.println;}runPoint(p2,"black");gameover(p2);}} private static void runPoint(Point p,String str){// px pyint x=Integer.parseInt(p.getX()),y=Integer.parseInt(p.getY());if(str.equals("white")){five[x][y]="@";}else{five[x][y]="O";}outFive();}private static Point pleaseIn(){Scanner sc=new Scanner(System.in);Point p=new Point(sc.next(),sc.next());String px=p.getX();String py=p.getY();// px pyint x=0,y=0;for(int i=1;i<five.length;i++){if(five[i][0].equals(px)){x=i;}if(five[0][i].equals(py)){y=i;}}return new Point(x+"",y+"");}* @param ppublic static void gameover(Point p) {int x=Integer.parseInt(p.getX()),y=Integer.parseInt(p.getY());int c1 = 0, c2 = 0, c3 = 0, c4 = 0;boolean l1 = true, l2 = true, l3 = true, l4 = true, l5 = true, l6 = true, l7 = true, l8 = true;for (int i = 1; i <5 ; i++) {if (y - i >= 1&& five[x][y - i].equals(five[x][y])&& l1) {c1++;} else {l1 = false;}if (y + i <= 16&& five[x][y + i].equals(five[x][y])&& l2) {c1++;} else {l2 = false;}if (x - i >= 1&& five[x - i][y].equals(five[x][y])&& l3) {c2++;} else {l3 = false;}if (x + i <= 16&& five[x + i][y].equals(five[x][y])&& l4) {c2++;} else {l4 = false;}if (x - i >= 1 && y - i >= 1&& five[x - i][y - i].equals(five[x][y])&& l5) {c3++;} else {l5 = false;}if (x + i <= 16 && y + i <= 16&& five[x + i][y + i].equals(five[x][y])&& l6) {c3++;} else {l6 = false;}if (x - i >= 1 && y + i <= 16&& five[x - i][y + i].equals(five[x][y])&& l7) {c4++;} else {l7 = false;}if (x + i <= 16 && y - i >= 1&& five[x + i][y - i].equals(five[x][y])&& l8) {c4++;} else {l8 = false;}}if (c1 >= 4 || c2 >= 4 || c3 >= 4 || c4 >= 4) {if (five[x][y].equals("1")) {System.out.println;System.exit(0);} else {System.out.println;System.exit(0);}}}。

销售管理系统相关代码

销售管理系统相关代码以下是一个简单的销售管理系统的代码示例:```pythonclass Product:def __init__(self, name, price, quantity): = nameself.price = priceself.quantity = quantitydef get_total_price(self):return self.price * self.quantityclass SalesManager:def __init__(self):self.products = []def add_product(self, product):self.products.append(product)def remove_product(self, product):self.products.remove(product)def calculate_total_revenue(self):total_revenue = 0for product in self.products:total_revenue += product.get_total_price() return total_revenue# 示例用法if __name__ == "__main__":manager = SalesManager()# 添加产品product1 = Product("iPhone", 999, 2)manager.add_product(product1)product2 = Product("iPad", 599, 3)manager.add_product(product2)# 计算总收入total_revenue = manager.calculate_total_revenue()print("总收入:", total_revenue)# 移除产品manager.remove_product(product1)# 重新计算总收入total_revenue = manager.calculate_total_revenue()print("调整后总收入:", total_revenue)```上述代码包括两个类:`Product`和`SalesManager`。

基于Java Swing 和MySQL的企业进销存管理系统(含源文件)

摘要随着信息化时代的到来,生活中各种信息趋向数字化、清晰化,应用于各行业的信息管理系统应运而生。

进销存管理系统是促进企业发展的重要组成部分,是商业企业经营管理中的核心环节,也是一个企业能否取得效益的关键,如果能够做到合理采购、及时销售、库存量最小、减少积压,那么企业就能够取得最佳效益。

在现代社会中,大多数企事业单位,特别是中小型企业,实现信息化管理是首要任务。

只有实现信息化管理,才能够提高工作效率和企业的管理水平。

市场经济快速多变,竞争激烈,企业采用进销存管理系统管理进货、库存、销售等诸多环节已成为趋势及必然。

本系统是一个基本的进销存管理系统,利用信息化手段把先进的企业管理方法引入企业的实践,为企业的管理改革提供切实易行的途径。

系统对企业中常见的采购、库存销售等商业活动以及相关的供应商和客户等基本信息进行管理。

本文以企业进销存管理系统的分析和设计为出发点,详细介绍了开发本系统的各个步骤:系统分析、系统设计、系统编码实现和系统测试。

在系统分析中先后用数据流图、系统的功能结构图分析了系统所需的各种数据和功能模块。

在系统设计和系统实现部分,详细的展现了系统的数据库设计与实现,以及系统的各个功能模块的所需的数据库表、表字段以及菜单的设计。

系统实现了强大的经销存管理,包括基本信息、采购、进货、销售和库存管理。

系统采用Java Swing技术,以MySQL作为后台数据库管理系,使用Eclipse 集成环境工具进行开发,界面简洁美观、性能满足要求、功能完善,经测试,本系统的设计是正确的。

关键词:信息化管理;进销存管理系统;Java Swing;Mysql;ABSTRACTWith the advent of the information age, living in a variety of information tends to digital, clear, information management systems used in various industries came into being. Inventory management system is an important part of the promotion of enterprise development is a core part of the management of commercial enterprises, is an enterprise the ability to obtain the key to effective, timely sales if you can do a reasonable purchase, minimum inventory levels, reduce the backlog. , then the business will be able to achieve the best efficiency. In modern society, the majority of enterprises, especially SMEs, to achieve information management is a priority. Only information management, to improve the efficiency and management level of enterprises. Market economy is rapidly changing, highly competitive, enterprise management of inventory management system to purchase, inventory, sales, and many other areas has become a trend and inevitable.This system is a basic inventory management systems, and use of information technology means the introduction of advanced management methods to the practice of the enterprise, to provide effective and easy way for enterprise management reform. Management system for enterprise purchasing, inventory, sales and other commercial activities, as well as suppliers and customers and other basic information.In this paper, the inventory management system analysis and design as a starting point, details the various steps of the development of the system: system analysis, system design, system coding and system testing. System analysis has used data flow diagrams, the functional block diagram of the system required by the system data and functional modules. In system design and system implementation part of the show in detail the system's database design and implementation, as well as the various functional modules of the system required database tables, table fields, and menu design. System to achieve a strong distribution inventory management, including basic information, procurement, purchasing, selling and inventory management.The system uses the Java Swing technology, MySQL as a backend database manager system, using the Eclipse integrated development of environmental tools, the interface is simple and beautiful performance to meet the requirements, fully functionalhas been tested the design of this system is correct.Keywords:information management; inventory management system; Java Swing; MySQL;目录第一章前言 (1)1.1 系统开发背景 (1)1.2 系统开发目的与意义 (1)1.3 企业进销存系统的发展现状 (2)第二章系统分析 (4)2.1 系统开发的目标 (4)2.2 可行性分析 (4)2.2.1 可行性研究的前提 (5)2.2.2 经济可行性 (5)2.2.3 技术可行性 (5)2.2.4 社会可行性 (6)2.2.5 操作可行性 (6)2.3 需求分析 (6)2.3.1 系统的功能需求 (6)2.3.2 数据字典设计 (7)2.3.3 系统的性能需求 (10)2.3.4 出错处理需求 (10)2.3.5 约束需求 (10)2.3.6 开发环境 (11)第三章总体设计 (12)3.1 系统功能结构设计 (12)3.2 数据库设计 (13)3.2.1 概念结构设计 (13)3.2.2 逻辑结构设计 (20)3.2.3 数据表设计 (21)第四章详细设计 (30)4.1界面设计 (30)4.1.1 界面概述 (30)4.1.2 主界面设计 (30)4.2 功能模块设计 (31)4.2.1 系统登录模块设计 (31)4.2.2 供应商基本信息管理模块设计 (32)4.2.3 入库信息查询模块设计 (33)4.2.4 用户管理模块设计 (34)4.2.5 经手人管理模块设计 (35)4.2.6 订购商品信息管理模块设计 (36)4.2.7 采购入库管理模块设计 (37)4.2.8 库存调拨模块设计 (38)4.2.9 销售退货管理模块设计 (38)4.2.10 其他模块设计 (39)第五章系统实现 (40)5.1 公共类设计 (40)5.1.1 SaveUserInfo公共类 (40)5.1.2 OnlyNumber公共类 (40)5.1.3 DaoConn公共类 (41)5.2软件实现 (41)5.2.1 用户登录模块 (41)5.2.2 供应商基本信息管理模块 (43)5.2.3 入库信息查询模块 (47)5.2.4 用户信息管理模块设计 (48)5.2.5 经手人管理模块设计 (53)5.2.6 订购商品信息管理模块 (55)5.2.7 采购入库管理模块 (57)5.2.8 销售出库管理模块 (59)5.3 开发常见问题与解决 (61)5.3.1 不显示系统登录窗体 (61)5.3.2运行程序时找不到数据库驱动 (61)5.3.3运行程序时用户名或密码不正确 (62)5.3.4运行程序时找不到数据库 (62)5.4 系统测试 (62)5.4.1测试目标 (62)5.4.2测试方法 (63)5.4.3测试方案 (63)5.4.4 测试用例 (63)5.4.5 测试运行 (67)5.4.6 测试结论 (72)总结 (73)附录A 系统使用说明书 (74)参考文献 (76)致谢 (77)第一章前言1.1 系统开发背景计算机技术作为现代科学技术的基础和核心,已经而且将继续对人类文明社会的进步与发展产生深刻影响。

产品进销存管理系统 代码

q=(plinklist)malloc(sizeof(productlnode));
printf("输入此产品类所含产品的产品名称、总量、进货日期、销售数量、销售时间:\n");
scanf("%s %d %d,%d,%d %d %d,%d,%d",&(q->pname),&(q->totalquantity),&((q->goodsdate).year),&((q->goodsdate).month),&((q->goodsdate).day),&(q->salesquantity),&((q->salestime).year),&((q->salestime).month),&((q->salestime).day));
typedef struct date{
int year;
int month;
int day;
}date; //日期
typedef struct productlnode{
char pname[30]; //产品名称
int totalquantity; //产品总量
}
if(i<L.length){
for(p=L.kindelem[i].firstproduct;p!=NULL;p=p->nextproduct){
k=strcmp(p->pname,pname1);
if(k==0){
p->totalquantity=p->totalquantity+n;
plinklist p;
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
相关文档
最新文档