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

📄 salemang.cpp

📁 IP电话计费管理系统本地版
💻 CPP
📖 第 1 页 / 共 4 页
字号:
									
									
								}
								
							}
							
						}	
			   }
     }
    }
   }
  }
  
  if (henv)
  {
	  if (hdbc)
	  {
		  if (bIsConnected)
		  {
			  if (hstmt)
			  {
				  ::SQLFreeHandle(SQL_HANDLE_STMT, hstmt);
			  }
			  ::SQLDisconnect(hdbc);
			  bIsConnected = FALSE;
		  }
		  ::SQLFreeHandle(SQL_HANDLE_DBC, hdbc);
		  hdbc = NULL;
	  }
	  ::SQLFreeHandle(SQL_HANDLE_ENV, henv);
	  henv = NULL;
  }	
}

void CSaleMang::OnLineCount() 
{
	// TODO: Add your control notification handler code here
	bCountLineAll=FALSE;
	nLineCountFlag=0;//o线结算
    ClickLineCount(0);
	m_SaleGrid.SetFocus();
	    
}

void CSaleMang::OnLineCount1() 
{
	// TODO: Add your control notification handler code here
	bCountLineAll=FALSE;
	nLineCountFlag=1;//1线结算
    ClickLineCount(1);	
	m_SaleGrid.SetFocus();
}

void CSaleMang::OnLineCount2() 
{
	// TODO: Add your control notification handler code here
	bCountLineAll=FALSE;
	nLineCountFlag=2;//2线结算
    ClickLineCount(2); 
	m_SaleGrid.SetFocus();
}

void CSaleMang::OnLineCount3() 
{
	// TODO: Add your control notification handler code here
	bCountLineAll=FALSE;
	nLineCountFlag=3;//3线结算
    ClickLineCount(3);
	m_SaleGrid.SetFocus();
}

void CSaleMang::OnLineCount4() 
{
	// TODO: Add your control notification handler code here
	bCountLineAll=FALSE;
	nLineCountFlag=4;//4线结算
    ClickLineCount(4);
	m_SaleGrid.SetFocus();
}

void CSaleMang::OnLineCount5() 
{
	// TODO: Add your control notification handler code here
	bCountLineAll=FALSE;
	nLineCountFlag=5;//5线结算
    ClickLineCount(5);
	m_SaleGrid.SetFocus();
}

void CSaleMang::OnLineCount6() 
{
	// TODO: Add your control notification handler code here
	bCountLineAll=FALSE;
	nLineCountFlag=6;//6线结算
    ClickLineCount(6);
	m_SaleGrid.SetFocus();

}

void CSaleMang::OnLineCount7() 
{
	// TODO: Add your control notification handler code here
	bCountLineAll=FALSE;
	nLineCountFlag=7;//7线结算
	ClickLineCount(7);
	m_SaleGrid.SetFocus();
}

void CSaleMang::ClickLineCount(int nClickLine)
{
	bQuitSaleMang=FALSE;//线路是否全部结算
	CIPCountDlg *cdlg;
	cdlg=(CIPCountDlg *)GetParent();
    if((nClickLine==16)||(nClickLine==18))
	{
		for(int bActive=0;bActive<16;bActive++)
		{
			//if(cdlg->bTalking[bActive])
            if((cdlg->nFlagLine[bActive]!=0)&&(cdlg->nFlagLine[bActive]!=7))
			{
				AfxMessageBox("所有线路空闲或锁定才能全部结算!");
				return ;
			}
		}
	}
    else if((cdlg->nFlagLine[nClickLine]!=0)&&(cdlg->nFlagLine[nClickLine]!=7))//bTalking[nClickLine])
	{
		AfxMessageBox("空闲或锁定状态才能结算!");
		return;
	}
	
	ldlg->DoModal();	
}

void CSaleMang::OnLineCount9() 
{
	// TODO: Add your control notification handler code here
	bCountLineAll=FALSE;
	nLineCountFlag=9;//9线结算
	ClickLineCount(9);
	m_SaleGrid.SetFocus();
}

void CSaleMang::OnLineCount8() 
{
	// TODO: Add your control notification handler code here
	bCountLineAll=FALSE;
	nLineCountFlag=8;//8线结算
	ClickLineCount(8);
	m_SaleGrid.SetFocus();
}

void CSaleMang::OnLineCount10() 
{
	// TODO: Add your control notification handler code here
	bCountLineAll=FALSE;
	nLineCountFlag=10;//10线结算
	ClickLineCount(10);	
	m_SaleGrid.SetFocus();
}

void CSaleMang::OnLineCount11() 
{
	// TODO: Add your control notification handler code here
	bCountLineAll=FALSE;
	nLineCountFlag=11;//11线结算
	ClickLineCount(11);	
	m_SaleGrid.SetFocus();
}

void CSaleMang::OnLineCount12() 
{
	// TODO: Add your control notification handler code here
	bCountLineAll=FALSE;
	nLineCountFlag=12;//12线结算
	ClickLineCount(12);
	m_SaleGrid.SetFocus();
}

void CSaleMang::OnLineCount13() 
{
	// TODO: Add your control notification handler code here
	bCountLineAll=FALSE;
	nLineCountFlag=13;//13线结算
	ClickLineCount(13);	
	m_SaleGrid.SetFocus();
}

void CSaleMang::OnLineCount14() 
{
	// TODO: Add your control notification handler code here
	bCountLineAll=FALSE;
	nLineCountFlag=14;//14线结算
	ClickLineCount(14);
	m_SaleGrid.SetFocus();
}

void CSaleMang::OnLineCount15() 
{
	// TODO: Add your control notification handler code here
	bCountLineAll=FALSE;
	nLineCountFlag=15;//15线结算
	ClickLineCount(15);
	m_SaleGrid.SetFocus();
}


void CSaleMang::ShowButton()
{
	m_LineButton8.ShowWindow(SW_SHOW);
	m_LineButton9.ShowWindow(SW_SHOW);
	m_LineButton10.ShowWindow(SW_SHOW);
    m_LineButton11.ShowWindow(SW_SHOW);
    m_LineButton12.ShowWindow(SW_SHOW);
	m_LineButton13.ShowWindow(SW_SHOW);
	m_LineButton14.ShowWindow(SW_SHOW);
	m_LineButton15.ShowWindow(SW_SHOW);
	m_LineButton16.ShowWindow(SW_SHOW);
}


void CSaleMang::OnAddMoney() 
{
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);
	CString strPreMoney="";//获得该线的押金
	CString strRemainMoney="";//获得该线的余额
	CString strRem="";//余额的小数位
	CString strQuot="";//余额的整数位
	int nAddLine=-1;
	int nAddMoney=0;
	CString m_strAddLine="";//编辑框中的线号
	CString m_strAddMoney="";//编辑框中的输入金额
	m_AddLine.GetWindowText(m_strAddLine);
	m_AddMany.GetWindowText(m_strAddMoney);
	if((m_strAddLine.IsEmpty())||(m_strAddMoney.IsEmpty()))
	{
		AfxMessageBox("请选择线路和金额!");
		return;
	}
	nAddLine=atoi(m_strAddLine);
    CIPCountDlg * mdlg;
	mdlg=(CIPCountDlg *)GetParent();
	if(mdlg->nOperateLines == 16)
	{
		if(nAddLine>15)
		{
			AfxMessageBox("请输入0-15之间的线号");
			return;
		}
	}
	else if (mdlg->nOperateLines == 8)
	{
		if(nAddLine>7)
		{
			AfxMessageBox("请输入0-7之间的线号");
			return;
		}
	}
	
	strPreMoney=m_SaleGrid.GetTextMatrix(nAddLine+1,7);
	strRemainMoney=m_SaleGrid.GetTextMatrix(nAddLine+1,8);
	
	int nDot=-1;
	nDot=strRemainMoney.Find('.',0);
	if(nDot!=-1)
	{
		strQuot=strRemainMoney.Mid(0,nDot);
		strRem=strRemainMoney.Mid(nDot+1);
	}
	else
		strQuot=strRemainMoney;
    nAddMoney=atoi(m_strAddMoney);
	int nNewRemMoney=atoi(strQuot)+nAddMoney;
    int nNewMoney=atoi(strPreMoney)+nAddMoney;
	strPreMoney.Format("%d",nNewMoney);
	strRemainMoney.Format("%d",nNewRemMoney);
	if(!strRem.IsEmpty())
		strRemainMoney=strRemainMoney+'.'+strRem;
	strNum[nAddLine]=strPreMoney;
	m_SaleGrid.SetTextMatrix(nAddLine+1,7,strPreMoney);
	m_SaleGrid.SetTextMatrix(nAddLine+1,8,strRemainMoney);
	m_SaleGrid.SetFocus();
}
////////////////////////////////////////////////////////

int CSaleMang::OnCountTLen(CString strStart, CString strCurrent)
{
    int nSec = atof(strCurrent) - atof(strStart);
	return nSec;
}

void CSaleMang::OnLineCountAll() 
{
	// TODO: Add your control notification handler code here
    CIPCountDlg * mdlg;
	mdlg=(CIPCountDlg *)GetParent();
	SetAllLineHot();

	if(mdlg->nOperateLines == 16)
     	nLineCountFlag=16;//16路全部结算
	else if (mdlg->nOperateLines = 8)
	{
		nLineCountFlag=18;//8路全部结算
	}
	bCountLineAll=TRUE;

	ClickLineCount(nLineCountFlag);
    m_SaleGrid.SetFocus();	
}

void CSaleMang::SetAllLineHot()
{
	int j=0;  
	CIPCountDlg *Ipcdlg;
	Ipcdlg=(CIPCountDlg *)GetParent();
	int nMax=0;

    nMax=Ipcdlg->nOperateLines;

    for(j=0;j<nMax;j++)
	{
		Ipcdlg->bClosedLine[j]=TRUE;
		
		if(strcmp(m_SaleGrid.GetTextMatrix(j+1,9),"关")!=0)
		{
			//if(strcmp(m_SaleGrid.GetTextMatrix(j+1,1),"空闲")==0)//如果线路不是空闲,则不锁机
            if(Ipcdlg->nFlagLine[j]==0)
			{
				Ipcdlg->nFlagLine[j]=7;
				nCountClk[j]++;
				m_SaleGrid.SetTextMatrix(j+1,9,"关");
				m_SaleGrid.SetTextMatrix(j+1,1,"锁定");
				Ipcdlg->ShowLineColor(j,RGB(255,0,0));//显示红颜色			
			}
		}
		else
		{
            Ipcdlg->bTalking[j]=FALSE;
		}
		
	}
	
    Ipcdlg->SendCommand("bil", "line", Ipcdlg->nGwCom[0]);
	if (nMax==16)
	{
        Ipcdlg->SendCommand("bil", "line", Ipcdlg->nGwCom[1]);
	}

}

BOOL CSaleMang::OnClickNum(int nClickNum)
{
	CIPCountDlg *Ipcdlg;
	Ipcdlg=(CIPCountDlg *)GetParent();
	if(Ipcdlg->bTalking[nClickNum])
	{
		AfxMessageBox("请先结束通话!");
		return FALSE;
	}
	if(strcmp(m_SaleGrid.GetTextMatrix(nClickNum+1,9),"开")==0) 
	{
		if(strcmp(m_SaleGrid.GetTextMatrix(nClickNum+1,1),"空闲")!=0) 
			return FALSE;
	}
	
	nCountClk[nClickNum]++;//判断点击过的次数
	CString strCountClk;
	strCountClk.Format("%d",nCountClk[nClickNum]);

	ControlLine(nCountClk[nClickNum],nClickNum+1);
	return TRUE;
}

BEGIN_EVENTSINK_MAP(CSaleMang, CDialog)
    //{{AFX_EVENTSINK_MAP(CSaleMang)
	ON_EVENT(CSaleMang, IDC_MSFLEXGRID_SALE, -601 /* DblClick */, OnDblClickMsflexgridSale, VTS_NONE)
	//}}AFX_EVENTSINK_MAP
END_EVENTSINK_MAP()

//双击打开相应的线路
void CSaleMang::OnDblClickMsflexgridSale() 
{
	// TODO: Add your control notification handler code here
	int nClickRow=0;
	nClickRow=m_SaleGrid.GetRowSel()-1;
	OnClickNum(nClickRow);

}

void CSaleMang::OnClickListScroll(NMHDR* pNMHDR, LRESULT* pResult) 
{
	// TODO: Add your control notification handler code here
	m_SaleGrid.SetFocus();
	*pResult = 0;
}



void CSaleMang::OnMouseMove(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
	m_SaleGrid.SetFocus();
	CDialog::OnMouseMove(nFlags, point);
}


void CSaleMang::OnQuitConf() 
{
	// TODO: Add your control notification handler code here
    CIPCountDlg * mdlg;
	mdlg=(CIPCountDlg *)GetParent();
    mdlg->SendData("0d",mdlg->nGwCom[0]);
/*	for (int nQuit=0; nQuit<nMaxPort; nQuit++)
	{
		if (mdlg->bOpenCom[nQuit])
		{
			mdlg->SendData("exit",mdlg->nGwCom[nQuit]);	
			mdlg->SendData("exit", mdlg->nGwCom[nQuit]);
		}
	}
*/
}
void CSaleMang::OnOK() 
{
	// TODO: Add extra validation here
}

⌨️ 快捷键说明

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