📄 rkfhdlg.cpp
字号:
// rkfhdlg.cpp : implementation file
//
#include "stdafx.h"
#include "xxgl.h"
#include "rkfhdlg.h"
#include "math.h"
#include "yszmscqrdlg.h"
#include "xzbm1dlg.h"
#include "qrqbhz.h"
#include "process.h"
#include "strt.h"
#include "ext.h"
#include "func.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
static char prt_buf[400][100];
static int end_prt_buf;
static int p_mod_wpsl,p_mod_wpdj,p_mod_zje;
static long order_of_wpsl,order_of_wpdj,order_of_zje;
static int cur_focus;
static int order_of_recs[2000];
static int mod_rec;
static int end_recs;
static int tishi_flag;
static int old_sel_row;
static char old_sel_bh[20];
static int error_flag;
static int update_ssbm_flag;
Crkfhdlg::Crkfhdlg(CWnd* pParent /*=NULL*/)
: CDialog(Crkfhdlg::IDD, pParent)
{
//{{AFX_DATA_INIT(Crkfhdlg)
m_pyjx = _T("");
m_cjpp = _T("");
m_gdbh = _T("");
m_ghdw = _T("");
m_sbmc = _T("");
m_scdm = _T("");
m_sfdzp = FALSE;
m_wpdj = _T("");
m_wpsl = _T("");
m_xhgg = _T("");
m_yqdm = _T("");
m_zje = _T("");
m_jfxs = _T("100");
m_yzf = _T("0");
m_sjhf = _T("");
m_xxhf = _T("");
//}}AFX_DATA_INIT
g_lock_count_flag = 0;
p_mod_wpsl = p_mod_wpdj = p_mod_zje =0;
order_of_wpsl = order_of_wpdj = order_of_zje =0;
mod_rec = -1;
tishi_flag = 0;
FILE *fpe;
unsigned char buf[40];
unsigned char pass[40];
int l,i,c,j,k,flag;
unsigned char mask;
rand_base = 1000;
fpe = fopen("c:\\xxsbgl\\mima.txt","rb");
fscanf(fpe,"%s\n%s\n",buf,pass);
fclose(fpe);
l = strlen((char *)buf);
for (i=0;i<l*8;i++){
c = buf[i/8];
mask = 1;
for (j=0;j<i%8;j++)
mask *= 2;
code[i] = c & mask;
if (code[i] != 0)
code[i] = 1;
}
for (i=0;i<1000;i++)
process_flag[i] = 0;
flag = 0;
j = 0;
while (flag == 0){
i = find_a_seat(l*8);
tab[j] = i;
process_flag[i] = 1;
j ++;
if (j == l*8)
flag = 1;
}
for (i=0;i<l*8;i++){
code6[i] = code[tab[i]];
}
for (i=0;i<l*8;i++)
code[i] = code6[i];
for (i=0;i<l*8;i++){
j = i + l%7;
if (j >= l*8)
j -= l*8;
code1[i] = code[j];
}
for (i=0;i<l*4;i++){
code2[i] = code1[2*i+1];
}
for (i=0;i<l*8;i++){
j = i + l%7;
if (j > l*8)
j -= l*8;
code3[i] = code[j];
}
for (i=0;i<l*4;i++){
code4[i] = code3[2*i];
}
for (i=0;i<l*4;i++)
code5[i] = code2[i] ^ code4[i];
/*
k = 0;
for (i=0;i<l;i++){
c = code5[i*4]*8 + code5[i*4+1]*4 + + code5[i*4+2]*2 + + code5[i*4+3];
if (c < 10)
c += '0';
else
c += 'A' - 10;
pass[k++] = c;
}
pass[k] = 0;
*/
for (i=0;i<l;i++){
c = pass[i];
if (c >= 'A')
c = c - 'A' + 10;
else
c -= '0';
code5[4*i] = c / 8;
c = c % 8;
code5[4*i+1] = c / 4;
c = c % 4;
code5[4*i+2] = c / 2;
code5[4*i+3] = c % 2;
}
for (i=0;i<l*4;i++)
code2[i] = code5[i] ^ code4[i];
for (i=0;i<l*4;i++){
code1[2*i+1] = code2[i];
}
for (i=0;i<l*8;i++){
j = i - l%7;
if (j < 0)
j = j + l*8;
code[i] = code1[j];
}
for (i=0;i<l*8;i++){
code6[tab[i]] = code[i];
}
for (i=0;i<l*8;i++)
code[i] = code6[i];
for (i=0;i<l;i++){
buf[i] = code[i*8] + code[i*8+1]*2 + code[i*8+2]*4 + code[i*8+3]*8
+ code[i*8+4]*16 + code[i*8+5]*32 + code[i*8+6]*64 + code[i*8+7]*128;
}
strcpy(xiaoming,(char *)buf);
error_flag = 0;
update_ssbm_flag = 0;
}
void Crkfhdlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(Crkfhdlg)
DDX_Control(pDX, IDC_ssbm, m_ssbm);
DDX_Control(pDX, IDC_rky, m_rky);
DDX_Control(pDX, IDC_rkr, m_rkr);
DDX_Control(pDX, IDC_rkn, m_rkn);
DDX_Control(pDX, IDC_rkfs, m_rkfs);
DDX_Control(pDX, IDC_jbr, m_jbr);
DDX_Text(pDX, IDC_byjx, m_pyjx);
DDX_Text(pDX, IDC_cjpp, m_cjpp);
DDX_Text(pDX, IDC_gdbh, m_gdbh);
DDX_Text(pDX, IDC_ghdw, m_ghdw);
DDX_Text(pDX, IDC_sbmc, m_sbmc);
DDX_Text(pDX, IDC_scdm, m_scdm);
DDX_Check(pDX, IDC_sfdzp, m_sfdzp);
DDX_Text(pDX, IDC_wpdj, m_wpdj);
DDX_Text(pDX, IDC_wpsl, m_wpsl);
DDX_Text(pDX, IDC_xhgg, m_xhgg);
DDX_Text(pDX, IDC_yqdm, m_yqdm);
DDX_Control(pDX, IDC_yszm, m_yszm);
DDX_Text(pDX, IDC_zje, m_zje);
DDX_Text(pDX, IDC_jfxs, m_jfxs);
DDX_Text(pDX, IDC_yzf, m_yzf);
DDX_Text(pDX, IDC_sjhf, m_sjhf);
DDX_Text(pDX, IDC_xxhf, m_xxhf);
//}}AFX_DATA_MAP
CBitmap *bitmapadd;
CBitmap *bitmapadd1;
CBitmap *bitmapadd2;
CBitmap *bitmapadd3;
CBitmap *bitmapadd4;
CBitmap *bitmapadd5;
HBITMAP hbitmapadd;
HBITMAP hbitmapadd1;
HBITMAP hbitmapadd2;
HBITMAP hbitmapadd3;
HBITMAP hbitmapadd4;
HBITMAP hbitmapadd5;
bitmapadd= new CBitmap();
bitmapadd1= new CBitmap();
bitmapadd2= new CBitmap();
bitmapadd3= new CBitmap();
bitmapadd4= new CBitmap();
bitmapadd5= new CBitmap();
bitmapadd->LoadBitmap(IDB_bc);
bitmapadd1->LoadBitmap(IDB_dy);
bitmapadd2->LoadBitmap(IDB_hz);
bitmapadd3->LoadBitmap(IDB_qx);
bitmapadd4->LoadBitmap(IDB_qb_hz);
bitmapadd5->LoadBitmap(IDB_tc);
hbitmapadd= (*bitmapadd).operator HBITMAP();
hbitmapadd1= (*bitmapadd1).operator HBITMAP();
hbitmapadd2= (*bitmapadd2).operator HBITMAP();
hbitmapadd3= (*bitmapadd3).operator HBITMAP();
hbitmapadd4= (*bitmapadd4).operator HBITMAP();
hbitmapadd5= (*bitmapadd5).operator HBITMAP();
CWnd *wnadd;
CWnd *wnadd1;
CWnd *wnadd2;
CWnd *wnadd3;
CWnd *wnadd4;
CWnd *wnadd5;
wnadd = GetDlgItem(IDSAVE);
wnadd1 = GetDlgItem(IDDAYIN);
wnadd2 = GetDlgItem(IDHEZHUN);
wnadd3 = GetDlgItem(IDSHANCHU);
wnadd4 = GetDlgItem(IDQBHZ);
wnadd5 = GetDlgItem(IDCANCEL);
WPARAM wParam;
LPARAM lParam;
wParam = (WPARAM) LOWORD(BS_LEFT | BS_BITMAP); // style
lParam = MAKELPARAM(TRUE, 0); // redraw flag
wnadd->SendMessage(BM_SETIMAGE, IMAGE_BITMAP,(long)hbitmapadd);
wnadd1->SendMessage(BM_SETIMAGE, IMAGE_BITMAP,(long)hbitmapadd1);
wnadd2->SendMessage(BM_SETIMAGE, IMAGE_BITMAP,(long)hbitmapadd2);
wnadd3->SendMessage(BM_SETIMAGE, IMAGE_BITMAP,(long)hbitmapadd3);
wnadd4->SendMessage(BM_SETIMAGE, IMAGE_BITMAP,(long)hbitmapadd4);
wnadd5->SendMessage(BM_SETIMAGE, IMAGE_BITMAP,(long)hbitmapadd5);
if (g_come_in_flag == 0){
g_come_in_flag = 1;
m_yszm.SetColWidth(0L,1100L);
m_yszm.SetColWidth(1L,3600L);
m_yszm.SetColWidth(2L,1100L);
m_yszm.SetColWidth(3L,1100L);
m_yszm.SetColWidth(4L,1200L);
m_yszm.SetColWidth(5L,2000L);
m_yszm.SetColWidth(6L,1200L);
m_yszm.SetColWidth(7L,800L);
m_yszm.SetColWidth(8L,1100L);
m_yszm.SetColWidth(9L,800L);
m_yszm.SetColWidth(10L,2000L);
m_yszm.SetColWidth(11L,2000L);
m_yszm.SetColWidth(12L,1100L);
m_yszm.SetColWidth(13L,1100L);
m_yszm.SetColWidth(14L,1100L);
m_yszm.SetColWidth(15L,1100L);
m_yszm.SetColWidth(16L,1100L);
m_yszm.SetColWidth(17L,1100L);
m_yszm.SetColWidth(18L,1100L);
m_yszm.SetRow(0L);
m_yszm.SetCol(0L);
m_yszm.SetText("库存编号");
m_yszm.SetCol(1L);
m_yszm.SetText("物品名称");
m_yszm.SetCol(2L);
m_yszm.SetText("物品单价");
m_yszm.SetCol(3L);
m_yszm.SetText("物品数量");
m_yszm.SetCol(4L);
m_yszm.SetText("总金额");
m_yszm.SetCol(5L);
m_yszm.SetText("入库时间");
m_yszm.SetCol(6L);
m_yszm.SetText("型号规格");
m_yszm.SetCol(7L);
m_yszm.SetText("经办人");
m_yszm.SetCol(8L);
m_yszm.SetText("固定编号");
m_yszm.SetCol(9L);
m_yszm.SetText("低值品");
m_yszm.SetCol(10L);
m_yszm.SetText("厂家品牌");
m_yszm.SetCol(11L);
m_yszm.SetText("供货单位");
m_yszm.SetCol(12L);
m_yszm.SetText("所属部门");
m_yszm.SetCol(13L);
m_yszm.SetText("入库方式");
m_yszm.SetCol(14L);
m_yszm.SetText("经费系数");
m_yszm.SetCol(15L);
m_yszm.SetText("运杂费");
m_yszm.SetCol(16L);
m_yszm.SetText("仪器代码");
m_yszm.SetCol(17L);
m_yszm.SetText("生产代码");
m_yszm.SetCol(18L);
m_yszm.SetText("名称缩写");
FILE *fpe;
int ret,i;
char buf[100];
fpe = fopen("c:\\xxsbgl\\jbr.txt","rb");
g_end_jbr = 0;
if (fpe != NULL){
ret = fscanf(fpe,"%s\n",buf);
while (ret > 0){
if (strlen(buf) != 0){
strcpy(g_jbr_name[g_end_jbr],buf);
g_end_jbr ++;
}
ret = fscanf(fpe,"%s\n",buf);
}
fclose(fpe);
}
m_jbr.InitStorage(1000,10);
for (i=0;i<g_end_jbr;i++){
m_jbr.AddString(g_jbr_name[i]);
}
m_jbr.SelectString(0,g_jbr_name[0]);
reload();
}
}
BEGIN_MESSAGE_MAP(Crkfhdlg, CDialog)
//{{AFX_MSG_MAP(Crkfhdlg)
ON_EN_CHANGE(IDC_sbmc, OnChangesbmc)
ON_EN_SETFOCUS(IDC_sbmc, OnSetfocussbmc)
ON_CBN_EDITCHANGE(IDC_rkfs, OnEditchangerkfs)
ON_CBN_SETFOCUS(IDC_rkfs, OnSetfocusrkfs)
ON_EN_CHANGE(IDC_cjpp, OnChangecjpp)
ON_EN_SETFOCUS(IDC_cjpp, OnSetfocuscjpp)
ON_EN_CHANGE(IDC_xhgg, OnChangexhgg)
ON_EN_SETFOCUS(IDC_xhgg, OnSetfocusxhgg)
ON_EN_CHANGE(IDC_wpdj, OnChangewpdj)
ON_EN_SETFOCUS(IDC_wpdj, OnSetfocuswpdj)
ON_EN_CHANGE(IDC_wpsl, OnChangewpsl)
ON_EN_SETFOCUS(IDC_wpsl, OnSetfocuswpsl)
ON_EN_CHANGE(IDC_zje, OnChangezje)
ON_EN_SETFOCUS(IDC_zje, OnSetfocuszje)
ON_CBN_EDITCHANGE(IDC_jbr, OnEditchangejbr)
ON_CBN_SETFOCUS(IDC_jbr, OnSetfocusjbr)
ON_EN_CHANGE(IDC_ghdw, OnChangeghdw)
ON_EN_SETFOCUS(IDC_ghdw, OnSetfocusghdw)
ON_CBN_EDITCHANGE(IDC_ssbm, OnEditchangessbm)
ON_CBN_SETFOCUS(IDC_ssbm, OnSetfocusssbm)
ON_CBN_EDITCHANGE(IDC_rkn, OnEditchangerkn)
ON_CBN_SETFOCUS(IDC_rkn, OnSetfocusrkn)
ON_CBN_EDITCHANGE(IDC_rky, OnEditchangerky)
ON_CBN_SETFOCUS(IDC_rky, OnSetfocusrky)
ON_CBN_EDITCHANGE(IDC_rkr, OnEditchangerkr)
ON_CBN_SETFOCUS(IDC_rkr, OnSetfocusrkr)
ON_BN_CLICKED(IDHEZHUN, OnHezhun)
ON_BN_CLICKED(IDSAVE, OnSave)
ON_BN_CLICKED(IDSHANCHU, OnShanchu)
ON_BN_CLICKED(IDQBHZ, OnQbhz)
ON_EN_SETFOCUS(IDC_jfxs, OnSetfocusjfxs)
ON_EN_CHANGE(IDC_jfxs, OnChangejfxs)
ON_EN_SETFOCUS(IDC_yzf, OnSetfocusyzf)
ON_EN_CHANGE(IDC_yzf, OnChangeyzf)
ON_BN_CLICKED(IDDAYIN, OnDayin)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// Crkfhdlg message handlers
void Crkfhdlg::OnChangesbmc()
{
// 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_sbmc,buf,50);
if (strlen(buf) > 40){
buf[40] = 0;
SetDlgItemText(IDC_sbmc,buf);
Set_to_item_end(this,IDC_sbmc);
}
}
void Crkfhdlg::OnSetfocussbmc()
{
// TODO: Add your control notification handler code here
CWnd *wnd;
wnd = GetDlgItem(IDC_sbmc);
switch_to_chinese_mode(wnd);
cur_focus = 1;
}
void Crkfhdlg::OnEditchangerkfs()
{
// TODO: Add your control notification handler code here
char buf[20];
GetDlgItemText(IDC_rkfs,buf,20);
if (buf[0] != 0){
if (m_rkfs.SelectString(0,buf) == CB_ERR){
SetDlgItemText(IDC_rkfs,"");
}
}
}
void Crkfhdlg::OnSetfocusrkfs()
{
// TODO: Add your control notification handler code here
CWnd *wnd;
wnd = GetDlgItem(IDC_rkfs);
switch_to_chinese_mode(wnd);
cur_focus = 2;
}
void Crkfhdlg::OnChangecjpp()
{
// 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_cjpp,buf,50);
if (strlen(buf) > 20){
buf[20] = 0;
SetDlgItemText(IDC_cjpp,buf);
Set_to_item_end(this,IDC_cjpp);
}
}
void Crkfhdlg::OnSetfocuscjpp()
{
// TODO: Add your control notification handler code here
CWnd *wnd;
wnd = GetDlgItem(IDC_cjpp);
switch_to_chinese_mode(wnd);
cur_focus = 4;
}
void Crkfhdlg::OnChangexhgg()
{
// 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_xhgg,buf,50);
if (strlen(buf) > 20){
buf[20] = 0;
SetDlgItemText(IDC_xhgg,buf);
Set_to_item_end(this,IDC_xhgg);
}
}
void Crkfhdlg::OnSetfocusxhgg()
{
// TODO: Add your control notification handler code here
CWnd *wnd;
wnd = GetDlgItem(IDC_xhgg);
switch_to_chinese_mode(wnd);
cur_focus = 5;
}
void Crkfhdlg::OnChangewpdj()
{
}
void Crkfhdlg::OnSetfocuswpdj()
{
// TODO: Add your control notification handler code here
CWnd *wnd;
wnd = GetDlgItem(IDC_wpdj);
switch_to_english_mode(wnd);
cur_focus = 6;
order_of_wpdj ++;
double sl,zje,dj;
char buf[30];
GetDlgItemText(IDC_wpsl,buf,20);
sl = atof(buf);
GetDlgItemText(IDC_zje,buf,20);
zje = atof(buf);
if (fabs(sl) > 0.001){
dj = zje / sl;
sprintf(buf,"%.2lf",dj);
if (fabs(zje) > 0.01)
SetDlgItemText(IDC_wpdj,buf);
}
}
void Crkfhdlg::OnChangewpsl()
{
}
void Crkfhdlg::OnSetfocuswpsl()
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -