📄 rkfhdlg.cpp
字号:
{
// TODO: Add your control notification handler code here
CWnd *wnd;
wnd = GetDlgItem(IDC_wpsl);
switch_to_english_mode(wnd);
cur_focus = 7;
order_of_wpsl ++;
}
void Crkfhdlg::OnChangezje()
{
}
void Crkfhdlg::OnSetfocuszje()
{
// TODO: Add your control notification handler code here
CWnd *wnd;
wnd = GetDlgItem(IDC_zje);
switch_to_english_mode(wnd);
cur_focus = 8;
order_of_zje ++;
double sl,zje,dj,ozje;
char buf[30];
GetDlgItemText(IDC_zje,buf,20);
ozje = atof(buf);
GetDlgItemText(IDC_wpsl,buf,20);
sl = atof(buf);
GetDlgItemText(IDC_wpdj,buf,20);
dj = atof(buf);
zje = dj*sl;
if (fabs(zje-ozje) > 0.09){
sprintf(buf,"%.2lf",zje);
if (fabs(dj) > 0.01)
SetDlgItemText(IDC_zje,buf);
}
}
void Crkfhdlg::OnEditchangejbr()
{
// TODO: Add your control notification handler code here
char buf[20];
GetDlgItemText(IDC_jbr,buf,20);
if (strlen(buf) > 10){
buf[10] = 0;
SetDlgItemText(IDC_jbr,buf);
Set_to_item_end(this,IDC_jbr);
}
}
void Crkfhdlg::OnSetfocusjbr()
{
// TODO: Add your control notification handler code here
CWnd *wnd;
wnd = GetDlgItem(IDC_jbr);
switch_to_chinese_mode(wnd);
cur_focus = 9;
}
void Crkfhdlg::OnChangeghdw()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
char buf[50];
GetDlgItemText(IDC_ghdw,buf,50);
if (strlen(buf) > 20){
buf[20] = 0;
SetDlgItemText(IDC_ghdw,buf);
Set_to_item_end(this,IDC_ghdw);
}
}
void Crkfhdlg::OnSetfocusghdw()
{
// TODO: Add your control notification handler code here
CWnd *wnd;
wnd = GetDlgItem(IDC_ghdw);
switch_to_chinese_mode(wnd);
cur_focus = 10;
}
void Crkfhdlg::OnEditchangessbm()
{
// TODO: Add your control notification handler code here
char buf[50];
if (update_ssbm_flag == 0){
GetDlgItemText(IDC_ssbm,buf,20);
Cxzbm1dlg dlg;
strcpy(g_xzbm_pass_buf,buf);
if (dlg.DoModal() == IDOK){
update_ssbm_flag = 1;
SetDlgItemText(IDC_ssbm,g_xzbm);
}
}
else{
update_ssbm_flag = 0;
}
}
void Crkfhdlg::OnSetfocusssbm()
{
// TODO: Add your control notification handler code here
CWnd *wnd;
wnd = GetDlgItem(IDC_ssbm);
switch_to_chinese_mode(wnd);
cur_focus = 11;
}
void Crkfhdlg::OnEditchangerkn()
{
// TODO: Add your control notification handler code here
char buf[40];
int l,i,flag,j;
GetDlgItemText(IDC_rkn,buf,12);
l = strlen(buf);
if (l > 0){
if (l > 4){
buf[4] = 0;
SetDlgItemText(IDC_rkn,buf);
}
for (i=0;i<l;i++){
if ((buf[i] < '0')||(buf[i] > '9')){
if (i == 0){
strcpy(buf,"2000");
}
else
buf[i] = 0;
SetDlgItemText(IDC_rkn,buf);
Set_to_item_end(this,IDC_rkn);
}
}
}
}
void Crkfhdlg::OnSetfocusrkn()
{
// TODO: Add your control notification handler code here
CWnd *wnd;
wnd = GetDlgItem(IDC_rkn);
switch_to_english_mode(wnd);
cur_focus = 14;
}
void Crkfhdlg::OnEditchangerky()
{
// TODO: Add your control notification handler code here
char buf[40];
int l,i,flag,j;
GetDlgItemText(IDC_rky,buf,12);
l = strlen(buf);
if (l > 0){
if (l > 2){
buf[2] = 0;
SetDlgItemText(IDC_rky,buf);
Set_to_item_end(this,IDC_rky);
}
for (i=0;i<l;i++){
if ((buf[i] < '0')||(buf[i] > '9')){
if (i == 0){
strcpy(buf,"6");
}
else
buf[i] = 0;
SetDlgItemText(IDC_rky,buf);
Set_to_item_end(this,IDC_rky);
}
}
}
}
void Crkfhdlg::OnSetfocusrky()
{
// TODO: Add your control notification handler code here
CWnd *wnd;
wnd = GetDlgItem(IDC_rky);
switch_to_english_mode(wnd);
cur_focus = 15;
}
void Crkfhdlg::OnEditchangerkr()
{
// TODO: Add your control notification handler code here
char buf[40];
int l,i,flag,j;
GetDlgItemText(IDC_rkr,buf,12);
l = strlen(buf);
if (l > 0){
if (l > 2){
buf[2] = 0;
SetDlgItemText(IDC_rkr,buf);
Set_to_item_end(this,IDC_rkr);
}
for (i=0;i<l;i++){
if ((buf[i] < '0')||(buf[i] > '9')){
if (i == 0){
strcpy(buf,"15");
}
else
buf[i] = 0;
SetDlgItemText(IDC_rkr,buf);
Set_to_item_end(this,IDC_rkr);
}
}
}
}
void Crkfhdlg::OnSetfocusrkr()
{
// TODO: Add your control notification handler code here
CWnd *wnd;
wnd = GetDlgItem(IDC_rkr);
switch_to_english_mode(wnd);
cur_focus = 16;
}
void Crkfhdlg::OnCancel()
{
// TODO: Add extra cleanup here
CDialog::OnCancel();
}
void Crkfhdlg::OnHezhun()
{
// TODO: Add your control notification handler code here
CWnd *pwnd;
FILE *fpe;
char buf[200];
CString str;
char buf1[50],buf2[50],buf3[50],buf4[50];
char buf5[50],buf6[50],buf7[50],buf8[50];;
char outs[20];
float zje1,sl1;
double ff,sls,djs;
long rowl,l;
int i,cur;
l = m_yszm.GetRowSel();
if (l > 0){
m_yszm.SetCol(8L);
str = m_yszm.GetText();
strcpy(buf,str.GetBuffer(10));
if (strlen(buf) == 0){
MessageBox("未选择设备.",MB_OK);
pwnd = GetDlgItem(IDC_byjx);
pwnd->SetFocus();
return;
}
}
else{
MessageBox("未选择设备.",MB_OK);
pwnd = GetDlgItem(IDC_byjx);
pwnd->SetFocus();
return;
}
GetDlgItemText(IDC_gdbh,str);
strcpy(buf,str.GetBuffer(12));
if ((strlen(buf) == 0)||(strlen(buf) > 6)){
MessageBox("未选择设备.",MB_OK);
pwnd = GetDlgItem(IDC_byjx);
pwnd->SetFocus();
return ;
}
OnSave();
if (error_flag == 1){
error_flag = 0;
return;
}
GetDlgItemText(IDC_sbmc,buf,50);
if (strlen(buf) == 0){
MessageBox("没有输入具体设备名称,不能保存.",MB_OK);
pwnd = GetDlgItem(IDC_sbmc);
pwnd->SetFocus();
return ;
}
float f;
int t;
GetDlgItemText(IDC_wpdj,str);
strcpy(buf,str.GetBuffer(14));
sscanf(buf,"%f",&f);
sprintf(buf,"%#.2f",f);
if ((f < 0.001)||(strlen(buf) > 9)){
MessageBox("物品单价错误.",MB_OK);
pwnd = GetDlgItem(IDC_wpdj);
pwnd->SetFocus();
return ;
}
SetDlgItemText(IDC_wpdj,buf);
m_yszm.SetCol(3L);
str = m_yszm.GetText();
strcpy(buf,str.GetBuffer(14));
sscanf(buf,"%f",&f);
sprintf(buf,"%#.2f",f);
if ((f < 0.001)||(strlen(buf) > 9)){
MessageBox("物品数量错误.",MB_OK);
pwnd = GetDlgItem(IDC_wpsl);
pwnd->SetFocus();
return ;
}
if ((buf[strlen(buf)-1] == '0') && (buf[strlen(buf)-2] == '0')){
l = f;
sprintf(buf,"%#ld",l);
}
SetDlgItemText(IDC_wpsl,buf);
m_yszm.SetCol(4L);
str = m_yszm.GetText();
strcpy(buf,str.GetBuffer(14));
sscanf(buf,"%f",&f);
sprintf(buf,"%#.2f",f);
GetDlgItemText(IDC_wpdj,str);
strcpy(buf,str.GetBuffer(15));
djs = atof(buf);;
GetDlgItemText(IDC_wpsl,str);
strcpy(buf,str.GetBuffer(15));
sls = atof(buf);;
GetDlgItemText(IDC_zje,str);
strcpy(buf,str.GetBuffer(14));
ff = atof(buf);
if (ff < 0.1){
ff = djs * sls;
}
if ((f < 0.001)||(strlen(buf) > 12)||(fabs(ff-djs*sls) > 0.01*sls)){
MessageBox("总金额错误.",MB_OK);
pwnd = GetDlgItem(IDC_zje);
pwnd->SetFocus();
return ;
}
SetDlgItemText(IDC_zje,buf);
GetDlgItemText(IDC_wpdj,buf,20);
GetDlgItemText(IDC_rkfs,str);
strcpy(buf,str.GetBuffer(22));
if ((strlen(buf) == 0)||(strlen(buf) >= 20)){
MessageBox("入库方式错误.",MB_OK);
pwnd = GetDlgItem(IDC_rkfs);
pwnd->SetFocus();
return ;
}
GetDlgItemText(IDC_ssbm,str);
strcpy(buf,str.GetBuffer(42));
if ((strlen(buf) == 0)||(strlen(buf) >= 40)){
MessageBox("所属部门错误.",MB_OK);
pwnd = GetDlgItem(IDC_ssbm);
pwnd->SetFocus();
return ;
}
GetDlgItemText(IDC_jbr,str);
strcpy(buf,str.GetBuffer(12));
if ((strlen(buf) == 0)||(strlen(buf) > 10)){
MessageBox("经办人错误.",MB_OK);
pwnd = GetDlgItem(IDC_jbr);
pwnd->SetFocus();
return ;
}
GetDlgItemText(IDC_rkn,str);
strcpy(buf,str.GetBuffer(6));
t = atoi(buf);
if ((t < 1990)||(t > 2100)){
MessageBox("入库年份错误.",MB_OK);
pwnd = GetDlgItem(IDC_rkn);
pwnd->SetFocus();
return ;
}
GetDlgItemText(IDC_rky,str);
strcpy(buf,str.GetBuffer(4));
t = atoi(buf);
if ((t < 1)||(t > 12)){
MessageBox("入库月份错误.",MB_OK);
pwnd = GetDlgItem(IDC_rky);
pwnd->SetFocus();
return ;
}
GetDlgItemText(IDC_rkr,str);
strcpy(buf,str.GetBuffer(4));
t = atoi(buf);
if ((t < 1)||(t > 31)){
MessageBox("入库日期错误.",MB_OK);
pwnd = GetDlgItem(IDC_rkr);
pwnd->SetFocus();
return ;
}
/*
g_end_of_rkbh ++;
fpe = fopen("c:\\xxsbgl\\rkbh.txt","wb");
fprintf(fpe,"%ld",g_end_of_rkbh);
fclose(fpe);
*/
cur = i;
fpe = fopen("c:\\xxsbgl\\sbrkzm.dat","a+b");
fseek(fpe,0L,SEEK_END);
strcpy(tzm.reserve,"");
GetDlgItemText(IDC_jfxs,buf,4);
strcpy(tzm.jfxs,buf);
GetDlgItemText(IDC_yzf,buf,10);
strcpy(tzm.yzf,buf);
m_yszm.SetCol(0L);
str = m_yszm.GetText();
strcpy(buf,str.GetBuffer(8));
buf[0] = ' ';
t = atoi(buf);
itoa(t,buf,10);
trim(buf);
strcpy(rkbh,buf);
strcpy(tzm.rkbh,buf);
GetDlgItemText(IDC_byjx,str);
strcpy(buf,str.GetBuffer(50));
trim(buf);
strcpy(pyjx,buf);
strcpy(tzm.pyjx,buf);
GetDlgItemText(IDC_gdbh,str);
strcpy(buf,str.GetBuffer(50));
trim(buf);
strcpy(gdbh,buf);
strcpy(tzm.gdbh,buf);
GetDlgItemText(IDC_yqdm,str);
strcpy(buf,str.GetBuffer(50));
trim(buf);
strcpy(yqdm,buf);
strcpy(tzm.yqdm,buf);
GetDlgItemText(IDC_sbmc,str);
strcpy(buf,str.GetBuffer(50));
trim(buf);
strcpy(sbmc,buf);
strcpy(tzm.sbmc,buf);
GetDlgItemText(IDC_scdm,str);
strcpy(buf,str.GetBuffer(50));
trim(buf);
strcpy(scdm,buf);
strcpy(tzm.scdm,buf);
GetDlgItemText(IDC_cjpp,str);
strcpy(buf,str.GetBuffer(50));
trim(buf);
strcpy(cjpp,buf);
strcpy(tzm.cjpp,buf);
GetDlgItemText(IDC_xhgg,str);
strcpy(buf,str.GetBuffer(50));
trim(buf);
strcpy(xhgg,buf);
strcpy(tzm.xhgg,buf);
GetDlgItemText(IDC_wpdj,str);
strcpy(buf,str.GetBuffer(50));
trim(buf);
strcpy(wpdj,buf);
strcpy(tzm.wpdj,buf);
GetDlgItemText(IDC_wpsl,str);
strcpy(buf,str.GetBuffer(50));
trim(buf);
strcpy(wpsl,buf);
strcpy(tzm.wpsl,buf);
GetDlgItemText(IDC_zje,str);
strcpy(buf,str.GetBuffer(50));
trim(buf);
strcpy(zje,buf);
strcpy(tzm.zje,buf);
GetDlgItemText(IDC_rkfs,str);
strcpy(buf,str.GetBuffer(50));
trim(buf);
strcpy(rkfs,buf);
strcpy(tzm.rkfs,buf);
GetDlgItemText(IDC_ssbm,ssbm,20);
GetDlgItemText(IDC_jbr,jbr,20);
GetDlgItemText(IDC_ghdw,ghdw,20);
GetDlgItemText(IDC_rkn,rkn,5);
GetDlgItemText(IDC_rky,rky,3);
GetDlgItemText(IDC_rkr,rkr,3);
if (IsDlgButtonChecked(IDC_sfdzp)){
strcpy(buf,"是");
}
else{
strcpy(buf,"否");
}
trim(buf);
strcpy(sfdzp,buf);
strcpy(tzm.sfdzp,buf);
strcpy(buf,ssbm);
strcpy(tzm.ssbm,buf);
strcpy(buf,jbr);
strcpy(tzm.jbr,buf);
strcpy(buf,ghdw);
strcpy(tzm.ghdw,buf);
strcpy(buf,rkn);
strcpy(tzm.rkn,buf);
strcpy(buf,rky);
strcpy(tzm.rky,buf);
strcpy(buf,rkr);
strcpy(tzm.rkr,buf);
fwrite(&(tzm.reserve[0]),sizeof(zmstrt),1,fpe);
fclose(fpe);
int flag;
GetDlgItemText(IDC_jbr,str);
strcpy(buf,str.GetBuffer(12));
flag = 0;
for (i=0;i<g_end_jbr;i++){
if (strcmp(buf,g_jbr_name[i]) == 0){
flag = 1;
break;
}
}
if (flag == 0){
fpe = fopen("c:\\xxsbgl\\jbr.txt","a+b");
fprintf(fpe,"%s\n",buf);
fclose(fpe);
strcpy(g_jbr_name[g_end_jbr++],buf);
m_jbr.AddString(buf);
}
tishi_flag = 1;
OnShanchu();
pwnd = GetDlgItem(IDC_sbmc);
pwnd->SetFocus();
}
void Crkfhdlg::OnOK()
{
// TODO: Add extra validation here
CWnd *wn_sbmc;
CWnd *wn_rkfs;
CWnd *wn_sfdzp;
CWnd *wn_cjpp;
CWnd *wn_xhgg;
CWnd *wn_wpdj;
CWnd *wn_wpsl;
CWnd *wn_zje;
CWnd *wn_ssbm;
CWnd *wn_jbr;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -