1681 lines
58 KiB
C++
1681 lines
58 KiB
C++
// DLG_Corp_LXR_SF.cpp : ʵÏÖÎļþ
|
||
//
|
||
|
||
#include "stdafx.h"
|
||
#include "SmsManager.h"
|
||
#include "DLG_Corp_LXR_SF.h"
|
||
#include "afxdialogex.h"
|
||
#include "MainFrm.h"
|
||
#include "..\public\Barcode\Barcode.h"
|
||
#include "..\public\PictureEx\PictureEx.h"
|
||
|
||
//¶þάÂë
|
||
#include "..\public\QRCode\BitBuffer.hpp"
|
||
#include "..\public\QRCode\QrCode.hpp"
|
||
#include "..\public\QRCode\QrDrawVC.h"
|
||
using std::uint8_t;
|
||
using qrcodegen::QrCode;
|
||
using qrcodegen::QrSegment;
|
||
using qrcodegen::QrDrawVC;
|
||
|
||
|
||
// DLG_Corp_LXR_SF ¶Ô»°¿ò
|
||
|
||
IMPLEMENT_DYNAMIC(DLG_Corp_LXR_SF, CDialogEx)
|
||
|
||
DLG_Corp_LXR_SF::DLG_Corp_LXR_SF(CWnd* pParent /*=NULL*/)
|
||
: CDialogEx(IDD_CORP_LXR_SF, pParent)
|
||
, m_strCargo(_T(""))
|
||
, m_strD_Address(_T(""))
|
||
, m_strD_Company(_T(""))
|
||
, m_strD_Contact(_T(""))
|
||
, m_strD_Mobile(_T(""))
|
||
, m_strD_Tel(_T(""))
|
||
, m_strDestcode(_T(""))
|
||
, m_lExpressType(0)
|
||
, m_strJ_Contact(_T(""))
|
||
, m_strJ_Mobile(_T(""))
|
||
, m_strJ_Tel(_T(""))
|
||
, m_strMailNo(_T(""))
|
||
, m_strRemark(_T(""))
|
||
, m_lPayMethod(0)
|
||
, m_fPrice(0)
|
||
{
|
||
m_lYWYCount = 0;
|
||
m_lDefaultYWYID=0;
|
||
memset(&m_SF,0,sizeof(m_SF));
|
||
m_pYWYData = NULL;
|
||
m_bNew = false;
|
||
}
|
||
|
||
DLG_Corp_LXR_SF::~DLG_Corp_LXR_SF()
|
||
{
|
||
}
|
||
|
||
void DLG_Corp_LXR_SF::DoDataExchange(CDataExchange* pDX)
|
||
{
|
||
CDialogEx::DoDataExchange(pDX);
|
||
DDX_CBString(pDX, IDC_CORP_SF_CARGO, m_strCargo);
|
||
DDV_MaxChars(pDX, m_strCargo, 16);
|
||
DDX_Text(pDX, IDC_CORP_SF_D_ADDRESS, m_strD_Address);
|
||
DDV_MaxChars(pDX, m_strD_Address, 60);
|
||
DDX_Text(pDX, IDC_CORP_SF_D_COMPANY, m_strD_Company);
|
||
DDV_MaxChars(pDX, m_strD_Company, 32);
|
||
DDX_Text(pDX, IDC_CORP_SF_D_CONTACT, m_strD_Contact);
|
||
DDV_MaxChars(pDX, m_strD_Contact, 30);
|
||
DDX_Text(pDX, IDC_CORP_SF_D_MOBILE, m_strD_Mobile);
|
||
DDV_MaxChars(pDX, m_strD_Mobile, 16);
|
||
DDX_Text(pDX, IDC_CORP_SF_D_TEL, m_strD_Tel);
|
||
DDV_MaxChars(pDX, m_strD_Tel, 16);
|
||
DDX_Text(pDX, IDC_CORP_SF_DESTCODE, m_strDestcode);
|
||
DDV_MaxChars(pDX, m_strDestcode, 16);
|
||
DDX_CBIndex(pDX, IDC_CORP_SF_EXPRESSTYPE, m_lExpressType);
|
||
DDX_Text(pDX, IDC_CORP_SF_J_CONTACT, m_strJ_Contact);
|
||
DDV_MaxChars(pDX, m_strJ_Contact, 30);
|
||
DDX_Text(pDX, IDC_CORP_SF_J_MOBILE, m_strJ_Mobile);
|
||
DDV_MaxChars(pDX, m_strJ_Mobile, 16);
|
||
DDX_Text(pDX, IDC_CORP_SF_J_TEL, m_strJ_Tel);
|
||
DDV_MaxChars(pDX, m_strJ_Tel, 16);
|
||
DDX_Text(pDX, IDC_CORP_SF_MAILNO, m_strMailNo);
|
||
DDV_MaxChars(pDX, m_strMailNo, 60);
|
||
DDX_Text(pDX, IDC_CORP_SF_REMARK, m_strRemark);
|
||
DDV_MaxChars(pDX, m_strRemark, 30);
|
||
DDX_CBIndex(pDX, IDC_CORP_SF_PAYMETHOD, m_lPayMethod);
|
||
DDX_Control(pDX, IDC_CORP_SF_ORDER, m_B_Order);
|
||
DDX_Control(pDX, IDC_CORP_SF_PRINT, m_B_Print);
|
||
DDX_Control(pDX, IDC_CORP_SF_PREVIEW, m_B_Preview);
|
||
DDX_Text(pDX, IDC_CORP_SF_PRICE, m_fPrice);
|
||
DDV_MinMaxDouble(pDX, m_fPrice, 0, 9999999);
|
||
DDX_Control(pDX, IDC_CORP_SF_J_CONTACT, m_J_Contact);
|
||
DDX_Control(pDX, IDC_CORP_SF_J_MOBILE, m_E_J_Mobile);
|
||
DDX_Control(pDX, IDC_CORP_SF_J_TEL, m_E_J_Tel);
|
||
DDX_Control(pDX, IDC_CORP_SF_CANCEL, m_B_SFCancel);
|
||
DDX_Control(pDX, IDC_CORP_SF_ROUTE, m_B_SFRoute);
|
||
DDX_Control(pDX, IDC_CORP_SF_S1, m_S1);
|
||
}
|
||
|
||
|
||
BEGIN_MESSAGE_MAP(DLG_Corp_LXR_SF, CDialogEx)
|
||
ON_BN_CLICKED(IDOK, &DLG_Corp_LXR_SF::OnBnClickedOk)
|
||
ON_BN_CLICKED(IDCANCEL, &DLG_Corp_LXR_SF::OnBnClickedCancel)
|
||
ON_CBN_SELCHANGE(IDC_CORP_SF_J_CONTACT, &DLG_Corp_LXR_SF::OnCbnSelchangeCorpSfJContact)
|
||
ON_BN_CLICKED(IDC_CORP_SF_ORDER, &DLG_Corp_LXR_SF::OnBnClickedCorpSfOrder)
|
||
ON_CBN_EDITCHANGE(IDC_CORP_SF_J_CONTACT, &DLG_Corp_LXR_SF::OnCbnEditchangeCorpSfJContact)
|
||
ON_CBN_SELENDOK(IDC_CORP_SF_J_CONTACT, &DLG_Corp_LXR_SF::OnCbnSelendokCorpSfJContact)
|
||
ON_CBN_CLOSEUP(IDC_CORP_SF_J_CONTACT, &DLG_Corp_LXR_SF::OnCbnCloseupCorpSfJContact)
|
||
|
||
ON_MESSAGE(WM_CORP_LXR_SF_RET, On_SF_Ret)
|
||
ON_BN_CLICKED(IDC_CORP_SF_CANCEL, &DLG_Corp_LXR_SF::OnBnClickedCorpSfCancel)
|
||
ON_BN_CLICKED(IDC_CORP_SF_ROUTE, &DLG_Corp_LXR_SF::OnBnClickedCorpSfRoute)
|
||
ON_BN_CLICKED(IDC_CORP_SF_PREVIEW, &DLG_Corp_LXR_SF::OnBnClickedCorpSfPreview)
|
||
ON_BN_CLICKED(IDC_CORP_SF_PRINT, &DLG_Corp_LXR_SF::OnBnClickedCorpSfPrint)
|
||
END_MESSAGE_MAP()
|
||
|
||
|
||
// DLG_Corp_LXR_SF ÏûÏ¢´¦Àí³ÌÐò
|
||
|
||
|
||
void DLG_Corp_LXR_SF::OnBnClickedOk()
|
||
{
|
||
// TODO: ÔÚ´ËÌí¼Ó¿Ø¼þ֪ͨ´¦Àí³ÌÐò´úÂë
|
||
//CDialogEx::OnOK();
|
||
}
|
||
|
||
|
||
void DLG_Corp_LXR_SF::OnBnClickedCancel()
|
||
{
|
||
// TODO: ÔÚ´ËÌí¼Ó¿Ø¼þ֪ͨ´¦Àí³ÌÐò´úÂë
|
||
CDialogEx::OnCancel();
|
||
}
|
||
|
||
void DLG_Corp_LXR_SF::SetParam(long lYWYCount, long lDefaultYWYID,ANS_Corp_LXR_YWYData * pYWYData, ANS_Corp_SFData SF,BOOL bNew)
|
||
{
|
||
|
||
m_lYWYCount = lYWYCount;
|
||
m_lDefaultYWYID = lDefaultYWYID;
|
||
m_pYWYData = pYWYData;
|
||
m_bNew = bNew;
|
||
m_SF = SF;
|
||
}
|
||
|
||
|
||
BOOL DLG_Corp_LXR_SF::OnInitDialog()
|
||
{
|
||
CDialogEx::OnInitDialog();
|
||
|
||
if (m_bNew)
|
||
{
|
||
if (m_SF.lPayType > 0) //¼ÄËÍÄÚÈÝΪ·¢Æ±
|
||
{
|
||
if (m_SF.fPrice>=5.0f && m_SF.fPrice < 1500.0f) //СÓÚ1500¼ÄËÍ·¢Æ±Îªµ½¸¶
|
||
m_SF.pay_method = 2; //ÊÕ·½¸¶
|
||
}
|
||
}
|
||
m_lPayMethod = m_SF.pay_method;
|
||
m_lExpressType = m_SF.express_type;
|
||
m_strMailNo = m_SF.Res_mailno;
|
||
m_strDestcode = m_SF.Res_destcode;
|
||
|
||
m_strD_Company = m_SF.d_company;
|
||
m_strD_Contact = m_SF.d_contact;
|
||
m_strD_Tel = m_SF.d_tel;
|
||
m_strD_Mobile = m_SF.d_mobile;
|
||
m_strD_Address = m_SF.d_address;
|
||
|
||
m_fPrice = m_SF.fPrice;
|
||
|
||
//ĬÈÏ»õÎïÀàÐÍ
|
||
m_SF.Cargo_count = 1;
|
||
switch (m_SF.lPayType)
|
||
{
|
||
case 0:
|
||
m_strCargo = _T("ºÏͬ");
|
||
break;
|
||
default:
|
||
m_strCargo = _T("·¢Æ±");
|
||
break;
|
||
}
|
||
|
||
int lYWYSel = 0;
|
||
if (m_bNew)
|
||
{
|
||
for (int i = 0; i < m_lYWYCount; i++)
|
||
{
|
||
m_J_Contact.AddString(m_pYWYData[i].szName);
|
||
if (m_pYWYData[i].lYWYID == m_lDefaultYWYID)
|
||
{
|
||
lYWYSel = i;
|
||
m_strJ_Mobile = m_pYWYData[i].szMobile;
|
||
m_strJ_Tel = m_pYWYData[i].szTel;
|
||
}
|
||
}
|
||
}
|
||
else
|
||
{
|
||
m_strJ_Contact = m_SF.j_contact;
|
||
m_strJ_Mobile = m_SF.j_mobile;
|
||
m_strJ_Tel = m_SF.j_tel;
|
||
|
||
}
|
||
|
||
UpdateData(false);
|
||
if (m_bNew)
|
||
m_J_Contact.SetCurSel(lYWYSel); //Ñ¡Öе±Ç°ÒµÎñÔ±
|
||
|
||
if (m_bNew)
|
||
{
|
||
m_B_Order.EnableWindow(true);
|
||
m_B_Print.EnableWindow(false);
|
||
m_B_Preview.EnableWindow(false);
|
||
m_B_SFCancel.EnableWindow(false);
|
||
m_B_SFRoute.EnableWindow(false);
|
||
|
||
m_S1.SetWindowText(_T("˳·áÑ¡Ïî £¨Î´Ïµ¥£©"));
|
||
}
|
||
else
|
||
{
|
||
m_B_Order.EnableWindow(false);
|
||
m_B_Print.EnableWindow(true);
|
||
m_B_Preview.EnableWindow(true);
|
||
m_B_SFCancel.EnableWindow(true);
|
||
m_B_SFRoute.EnableWindow(true);
|
||
|
||
CString strStatus;
|
||
switch (m_SF.lStatus)
|
||
{
|
||
case 1:
|
||
strStatus = _T("ÒÑÈ¡Ïû");
|
||
break;
|
||
case 2:
|
||
strStatus = _T("ÒÑÊÕ¼þ");
|
||
break;
|
||
case 3:
|
||
strStatus = _T("ÒÑÇ©ÊÕ");
|
||
break;
|
||
case 0:
|
||
default:
|
||
strStatus = _T("ÒÑϵ¥");
|
||
break;
|
||
}
|
||
CString str;
|
||
str.Format(_T("˳·áÑ¡Ïî £¨%s %04d.%02d.%02d %02d:%02d£©"), strStatus, m_SF.tCreate.wYear, m_SF.tCreate.wMonth, m_SF.tCreate.wDay, m_SF.tCreate.wHour, m_SF.tCreate.wMinute);
|
||
m_S1.SetWindowText(str);
|
||
|
||
EnableInputWindows(false); //Ö»ÊÇÏÔʾµÄ£¬½ûֹ¼Èë
|
||
}
|
||
return TRUE; // return TRUE unless you set the focus to a control
|
||
// Òì³£: OCX ÊôÐÔÒ³Ó¦·µ»Ø FALSE
|
||
}
|
||
|
||
|
||
void DLG_Corp_LXR_SF::OnCbnSelchangeCorpSfJContact()
|
||
{
|
||
long lSel = m_J_Contact.GetCurSel();
|
||
if (lSel >= 0 && lSel <= m_lYWYCount)
|
||
{
|
||
m_E_J_Tel.SetWindowText(m_pYWYData[lSel].szTel);
|
||
m_E_J_Mobile.SetWindowText(m_pYWYData[lSel].szMobile);
|
||
|
||
}
|
||
/*
|
||
CString strName;
|
||
m_J_Contact.GetWindowText(strName);
|
||
for (int i = 0; i < m_lYWYCount; i++)
|
||
{
|
||
if (strName == CString(m_pYWYData[i].szName))
|
||
{
|
||
m_E_J_Tel.SetWindowText(m_pYWYData[i].szTel);
|
||
m_E_J_Mobile.SetWindowText(m_pYWYData[i].szMobile);
|
||
break;
|
||
}
|
||
}
|
||
*/
|
||
}
|
||
void DLG_Corp_LXR_SF::OnCbnEditchangeCorpSfJContact()
|
||
{
|
||
//OnCbnSelchangeCorpSfJContact();
|
||
}
|
||
|
||
void DLG_Corp_LXR_SF::OnBnClickedCorpSfOrder()
|
||
{
|
||
if (!UpdateData(true))
|
||
return;
|
||
|
||
CMainFrame *pFrame = (CMainFrame*)(AfxGetApp()->m_pMainWnd);
|
||
if (!pFrame)
|
||
return;
|
||
|
||
long lSize = sizeof(REQ_Corp_SF_Add) + sizeof(ANS_Corp_SFData);
|
||
BYTE * pDataSend = new BYTE[lSize]; memset(pDataSend, 0, lSize);
|
||
REQ_Corp_SF_Add * pAdd = (REQ_Corp_SF_Add*)pDataSend;
|
||
ANS_Corp_SFData * pSFData = (ANS_Corp_SFData *)(pDataSend + sizeof(REQ_Corp_SF_Add));
|
||
|
||
pAdd->lCount = 1;
|
||
//Éú³É¿Í»§¶©µ¥ºÅ
|
||
SYSTEMTIME t; GetLocalTime(&t);
|
||
#ifdef _DEBUG
|
||
_stprintf(m_SF.orderid, _T("%d_%04d%02d%02d%02d"), m_SF.lCorpID, t.wYear, t.wMonth, t.wDay, t.wHour);
|
||
//_stprintf(m_SF.orderid,_T("%d_%04d%02d%02d%02d%02d%02d"), m_SF.lCorpID,t.wYear, t.wMonth, t.wDay,t.wHour,t.wMinute,t.wSecond);
|
||
#else
|
||
_stprintf(m_SF.orderid, _T("%d_%04d%02d%02d%02d"), m_SF.lCorpID, t.wYear, t.wMonth, t.wDay, t.wHour);
|
||
#endif
|
||
m_SF.pay_method = m_lPayMethod;
|
||
m_SF.express_type = m_lExpressType;
|
||
_tcscpy(m_SF.Res_mailno, m_strMailNo );
|
||
|
||
_tcscpy(m_SF.d_company,m_strD_Company);
|
||
_tcscpy(m_SF.d_contact,m_strD_Contact);
|
||
_tcscpy(m_SF.d_tel,m_strD_Tel);
|
||
_tcscpy(m_SF.d_mobile,m_strD_Mobile);
|
||
_tcscpy(m_SF.d_address,m_strD_Address);
|
||
|
||
m_SF.fPrice = m_fPrice;
|
||
_tcscpy(m_SF.Cargo_name,m_strCargo);
|
||
_tcscpy(m_SF.j_contact, m_strJ_Contact);
|
||
_tcscpy(m_SF.j_mobile,m_strJ_Mobile);
|
||
_tcscpy(m_SF.j_tel, m_strJ_Tel);
|
||
_tcscpy(m_SF.remark, this->m_strRemark);
|
||
|
||
*pSFData = m_SF;
|
||
|
||
|
||
pFrame->SendFrame(SMSFUNC_CORP_SF_ADD, pDataSend, lSize);
|
||
|
||
EnableInputWindows(false); //ϵ¥ºó£¬½ûֹ¼ÈëÄÚÈÝ
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
void DLG_Corp_LXR_SF::OnCbnSelendokCorpSfJContact()
|
||
{
|
||
|
||
}
|
||
|
||
|
||
void DLG_Corp_LXR_SF::OnCbnCloseupCorpSfJContact()
|
||
{
|
||
|
||
}
|
||
|
||
BOOL DLG_Corp_LXR_SF::ProcessSocket(Socket_Head_Add *pHead, BYTE *pFrame)
|
||
{
|
||
BYTE * pData = new BYTE[pHead->lFrameLen];
|
||
memcpy(pData, pFrame, pHead->lFrameLen);
|
||
this->PostMessage(WM_CORP_LXR_SF_RET, (WPARAM)pData, (LPARAM)pHead->lFuncType);
|
||
return true;
|
||
}
|
||
|
||
LRESULT DLG_Corp_LXR_SF::On_SF_Ret(WPARAM wParam, LPARAM lParam)
|
||
{
|
||
BYTE *pFrame = (BYTE *)wParam;
|
||
if (!pFrame)
|
||
return false;
|
||
long lType = (long)lParam;
|
||
switch (lType)
|
||
{
|
||
case SMSFUNC_CORP_SF_ADD:
|
||
{
|
||
ANS_Corp_SF_Add * pAdd = (ANS_Corp_SF_Add *)pFrame;
|
||
ANS_Corp_SFData * pData = (ANS_Corp_SFData *)(pFrame + sizeof(ANS_Corp_SF_Add));
|
||
if (pAdd->lCount <= 0 || pAdd->lErrCode != 0)
|
||
{
|
||
CString str;
|
||
str.Format(_T("˳·áϵ¥Ê§°Ü£¬´íÎó´úÂë(%d)\r\n%s"), pAdd->lErrCode, pAdd->szMemo);
|
||
MessageBox(str, _T("´íÎó"), MB_ICONWARNING);
|
||
|
||
EnableInputWindows(true); //ϵ¥Ê§°Üºó£¬ÔÊÐíÖØÐ¼ÈëÄÚÈÝ
|
||
}
|
||
else
|
||
{
|
||
|
||
m_SF = *pData;
|
||
m_strMailNo = m_SF.Res_mailno;
|
||
m_strDestcode = m_SF.Res_destcode;
|
||
|
||
m_B_Order.EnableWindow(false);
|
||
m_B_Print.EnableWindow(true);
|
||
m_B_Preview.EnableWindow(true);
|
||
m_B_SFCancel.EnableWindow(true);
|
||
m_B_SFRoute.EnableWindow(true);
|
||
|
||
UpdateData(false);
|
||
CString str;
|
||
str.Format(_T("˳·áÑ¡Ïî £¨%s %04d.%02d.%02d %02d:%02d£©"), _T("ÒÑϵ¥"), m_SF.tCreate.wYear, m_SF.tCreate.wMonth, m_SF.tCreate.wDay, m_SF.tCreate.wHour, m_SF.tCreate.wMinute);
|
||
m_S1.SetWindowText(str);
|
||
|
||
str.Format(_T("˳·áϵ¥³É¹¦£¬Ô˵¥ºÅ£º%s£¬¿ÉÒÔ´òÓ¡Ô˵¥ÁË¡£"), pData->Res_mailno);
|
||
//MessageBox(str, _T("Ìáʾ"), MB_ICONINFORMATION);
|
||
MessageBox(pAdd->szMemo, _T("Ìáʾ"), MB_ICONINFORMATION);
|
||
}
|
||
}
|
||
break;
|
||
case SMSFUNC_CORP_SF_CANCEL:
|
||
{
|
||
ANS_Corp_SF_Cancel * pCancel = (ANS_Corp_SF_Cancel *)pFrame;
|
||
if (pCancel->lErrCode != 0)
|
||
{
|
||
CString str;
|
||
str.Format(_T("˳·áÈ¡Ïû¶©µ¥Ê§°Ü£¬´íÎó´úÂë(%d)\r\n%s"), pCancel->lErrCode, pCancel->szMemo);
|
||
MessageBox(str, _T("´íÎó"), MB_ICONWARNING);
|
||
}
|
||
else
|
||
{
|
||
CString str;
|
||
str.Format(_T("˳·áÑ¡Ïî £¨%s %04d.%02d.%02d %02d:%02d£©"), _T("ÒÑÈ¡Ïû"), m_SF.tCreate.wYear, m_SF.tCreate.wMonth, m_SF.tCreate.wDay, m_SF.tCreate.wHour, m_SF.tCreate.wMinute);
|
||
m_S1.SetWindowText(str);
|
||
|
||
str.Format(_T("˳·áÈ¡Ïû¶©µ¥³É¹¦:%d\r\n%s"), pCancel->lErrCode, pCancel->szMemo);
|
||
MessageBox(str, _T("ÐÅÏ¢"), MB_ICONINFORMATION);
|
||
}
|
||
}
|
||
break;
|
||
case SMSFUNC_CORP_SF_ROUTE:
|
||
{
|
||
ANS_Corp_SF_Route * pRoute = (ANS_Corp_SF_Route *)pFrame;
|
||
if (pRoute->lErrCode != 0)
|
||
{
|
||
CString str;
|
||
str.Format(_T("˳·á²éѯ·ÓÉʧ°Ü£¬´íÎó´úÂë(%d)\r\n%s"), pRoute->lErrCode, pRoute->szMemo);
|
||
MessageBox(str, _T("´íÎó"), MB_ICONWARNING);
|
||
}
|
||
else
|
||
{
|
||
if (pRoute->lStatus != m_SF.lStatus) //¸üÐÂ״̬
|
||
{
|
||
m_SF.lStatus = pRoute->lStatus;
|
||
|
||
CString strStatus;
|
||
switch (m_SF.lStatus)
|
||
{
|
||
case 1:
|
||
strStatus = _T("ÒÑÈ¡Ïû");
|
||
break;
|
||
case 2:
|
||
strStatus = _T("ÒÑÊÕ¼þ");
|
||
break;
|
||
case 3:
|
||
strStatus = _T("ÒÑÇ©ÊÕ");
|
||
break;
|
||
case 0:
|
||
default:
|
||
strStatus = _T("ÒÑϵ¥");
|
||
break;
|
||
}
|
||
CString str;
|
||
str.Format(_T("˳·áÑ¡Ïî £¨%s %04d.%02d.%02d %02d:%02d£©"), strStatus, m_SF.tCreate.wYear, m_SF.tCreate.wMonth, m_SF.tCreate.wDay, m_SF.tCreate.wHour, m_SF.tCreate.wMinute);
|
||
m_S1.SetWindowText(str);
|
||
|
||
}
|
||
CString strRouteMsg = pRoute->szMemo;
|
||
MessageBox(strRouteMsg,_T("·ÓÉÐÅÏ¢"), MB_ICONINFORMATION);
|
||
|
||
}
|
||
}
|
||
break;
|
||
}
|
||
delete pFrame;
|
||
return true;
|
||
}
|
||
|
||
int DLG_Corp_LXR_SF::EnableInputWindows(BOOL bEnable)
|
||
{
|
||
if (bEnable)
|
||
{
|
||
GetDlgItem(IDC_CORP_SF_PAYMETHOD)->EnableWindow(true);
|
||
GetDlgItem(IDC_CORP_SF_EXPRESSTYPE)->EnableWindow(true);
|
||
GetDlgItem(IDC_CORP_SF_J_CONTACT)->EnableWindow(true);
|
||
GetDlgItem(IDC_CORP_SF_CARGO)->EnableWindow(true);
|
||
|
||
((CEdit*)GetDlgItem(IDC_CORP_SF_D_COMPANY))->SetReadOnly(false);
|
||
((CEdit*)GetDlgItem(IDC_CORP_SF_D_CONTACT))->SetReadOnly(false);
|
||
((CEdit*)GetDlgItem(IDC_CORP_SF_D_MOBILE))->SetReadOnly(false);
|
||
((CEdit*)GetDlgItem(IDC_CORP_SF_D_TEL))->SetReadOnly(false);
|
||
((CEdit*)GetDlgItem(IDC_CORP_SF_D_ADDRESS))->SetReadOnly(false);
|
||
((CEdit*)GetDlgItem(IDC_CORP_SF_J_MOBILE))->SetReadOnly(false);
|
||
((CEdit*)GetDlgItem(IDC_CORP_SF_J_TEL))->SetReadOnly(false);
|
||
((CEdit*)GetDlgItem(IDC_CORP_SF_PRICE))->SetReadOnly(false);
|
||
((CEdit*)GetDlgItem(IDC_CORP_SF_REMARK))->SetReadOnly(false);
|
||
}
|
||
else
|
||
{
|
||
GetDlgItem(IDC_CORP_SF_PAYMETHOD)->EnableWindow(false);
|
||
GetDlgItem(IDC_CORP_SF_EXPRESSTYPE)->EnableWindow(false);
|
||
GetDlgItem(IDC_CORP_SF_J_CONTACT)->EnableWindow(false);
|
||
GetDlgItem(IDC_CORP_SF_CARGO)->EnableWindow(false);
|
||
|
||
//((CEdit*)GetDlgItem(IDC_CORP_SF_J_CONTACT))->SetReadOnly(true);
|
||
//((CEdit*)GetDlgItem(IDC_CORP_SF_CARGO))->SetReadOnly(true);
|
||
|
||
((CEdit*)GetDlgItem(IDC_CORP_SF_D_COMPANY))->SetReadOnly(true);
|
||
((CEdit*)GetDlgItem(IDC_CORP_SF_D_CONTACT))->SetReadOnly(true);
|
||
((CEdit*)GetDlgItem(IDC_CORP_SF_D_MOBILE))->SetReadOnly(true);
|
||
((CEdit*)GetDlgItem(IDC_CORP_SF_D_TEL))->SetReadOnly(true);
|
||
((CEdit*)GetDlgItem(IDC_CORP_SF_D_ADDRESS))->SetReadOnly(true);
|
||
((CEdit*)GetDlgItem(IDC_CORP_SF_J_MOBILE))->SetReadOnly(true);
|
||
((CEdit*)GetDlgItem(IDC_CORP_SF_J_TEL))->SetReadOnly(true);
|
||
((CEdit*)GetDlgItem(IDC_CORP_SF_PRICE))->SetReadOnly(true);
|
||
((CEdit*)GetDlgItem(IDC_CORP_SF_REMARK))->SetReadOnly(true);
|
||
}
|
||
return 0;
|
||
}
|
||
|
||
|
||
void DLG_Corp_LXR_SF::OnBnClickedCorpSfCancel()
|
||
{
|
||
CMainFrame *pFrame = (CMainFrame*)(AfxGetApp()->m_pMainWnd);
|
||
if (!pFrame)
|
||
return;
|
||
|
||
if (m_SF.lSFID <=0 || _tcslen(m_SF.Res_mailno) <=0)
|
||
{
|
||
MessageBox(_T("´Ë˳·á¶©µ¥»¹Ã»Ïµ¥³É¹¦£¬ÎÞ·¨È¡Ïû¶©µ¥"), _T("´íÎó"), MB_ICONWARNING);
|
||
return;
|
||
}
|
||
CString str;
|
||
str.Format(_T("ÕæµÄҪȡÏûÔ˵¥ºÅ(%s)µÄ˳·á¶©µ¥Âð£¿"), m_SF.Res_mailno);
|
||
int iRet = MessageBox(str, _T("ÌáÎÊ"), MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2);
|
||
if (iRet != IDYES)
|
||
return;
|
||
|
||
long lSize = sizeof(REQ_Corp_SF_Cancel);
|
||
BYTE * pDataSend = new BYTE[lSize]; memset(pDataSend, 0, lSize);
|
||
REQ_Corp_SF_Cancel * pCancel = (REQ_Corp_SF_Cancel*)pDataSend;
|
||
|
||
pCancel->lCount = 0;
|
||
pCancel->lSFID = m_SF.lSFID;
|
||
_tcscpy(pCancel->orderid, m_SF.orderid);
|
||
_tcscpy(pCancel->mailno, m_SF.Res_mailno);
|
||
|
||
pFrame->SendFrame(SMSFUNC_CORP_SF_CANCEL, pDataSend, lSize);
|
||
}
|
||
|
||
|
||
void DLG_Corp_LXR_SF::OnBnClickedCorpSfRoute()
|
||
{
|
||
CMainFrame *pFrame = (CMainFrame*)(AfxGetApp()->m_pMainWnd);
|
||
if (!pFrame)
|
||
return;
|
||
|
||
if (m_SF.lSFID <= 0 || _tcslen(m_SF.Res_mailno) <= 0)
|
||
{
|
||
MessageBox(_T("´Ë˳·á¶©µ¥»¹Ã»Ïµ¥³É¹¦£¬ÎÞ·¨²éѯ·ÓÉ"), _T("´íÎó"), MB_ICONWARNING);
|
||
return;
|
||
}
|
||
|
||
long lSize = sizeof(REQ_Corp_SF_Route);
|
||
BYTE * pDataSend = new BYTE[lSize]; memset(pDataSend, 0, lSize);
|
||
REQ_Corp_SF_Route * pCancel = (REQ_Corp_SF_Route*)pDataSend;
|
||
|
||
pCancel->lCount = 0;
|
||
pCancel->lStatus = m_SF.lStatus;
|
||
pCancel->lSFID = m_SF.lSFID;
|
||
_tcscpy(pCancel->orderid, m_SF.orderid);
|
||
_tcscpy(pCancel->mailno, m_SF.Res_mailno);
|
||
|
||
pFrame->SendFrame(SMSFUNC_CORP_SF_ROUTE, pDataSend, lSize);
|
||
}
|
||
|
||
|
||
void DLG_Corp_LXR_SF::OnBnClickedCorpSfPreview()
|
||
{
|
||
try
|
||
{
|
||
|
||
//Ô¤ÀÀ
|
||
CPrnFrame * PrnFrame = new CPrnFrame(On_Print2, On_BeginPrint2, OnPreparePrinting2, this, this, false);
|
||
PrnFrame->ShowWindow(SW_SHOW);
|
||
PrnFrame->UpdateWindow();
|
||
|
||
//´òÓ¡
|
||
//CPrnFrame * PrnFrame = new CPrnFrame(On_Print2,On_BeginPrint2,this,this,true);
|
||
}
|
||
catch (...)
|
||
{
|
||
AfxMessageBox(_T("print error"));
|
||
}
|
||
|
||
}
|
||
|
||
|
||
void DLG_Corp_LXR_SF::OnBnClickedCorpSfPrint()
|
||
{
|
||
|
||
try
|
||
{
|
||
//´òÓ¡
|
||
CPrnFrame * PrnFrame = new CPrnFrame(On_Print2, On_BeginPrint2, OnPreparePrinting2, this, this, true);
|
||
}
|
||
catch (...)
|
||
{
|
||
AfxMessageBox(_T("print error"));
|
||
}
|
||
}
|
||
|
||
|
||
void DLG_Corp_LXR_SF::On_Print2(CDC *pDC, CPrintInfo *pInfo, void *pVoid)
|
||
{
|
||
DLG_Corp_LXR_SF * pDlg = (DLG_Corp_LXR_SF *)pVoid;
|
||
|
||
|
||
CMemDCLJ dc(pDC);
|
||
|
||
CPen Pen,Pen2;
|
||
CPen* pOldPen=NULL;
|
||
CFont* pOldfont = NULL;
|
||
CGdiObject * pOldBrush = NULL;
|
||
CFont font1, font2, font3, font4, font5, font6, font7, font9, font12;
|
||
CPoint point;
|
||
int nWidth = dc.GetDeviceCaps(HORZRES);
|
||
int nHeight = dc.GetDeviceCaps(VERTRES);
|
||
int xLogPixPerInch = dc.GetDeviceCaps(LOGPIXELSX);
|
||
int yLogPixPerInch = dc.GetDeviceCaps(LOGPIXELSY);
|
||
float xmm = ((float)xLogPixPerInch / 24.5f);
|
||
float ymm = ((float)yLogPixPerInch / 24.5f);
|
||
|
||
font1.CreateFont(-MulDiv(10, dc.GetDeviceCaps(LOGPIXELSY), 72),
|
||
0, 0, 0, FW_NORMAL, 0, 0, 0, GB2312_CHARSET,
|
||
OUT_STROKE_PRECIS, CLIP_STROKE_PRECIS, DRAFT_QUALITY,
|
||
VARIABLE_PITCH | FF_SWISS, _T("ºÚÌå"));
|
||
font2.CreateFont(-MulDiv(10, -dc.GetDeviceCaps(LOGPIXELSY), 72),
|
||
0, 0, 0, FW_NORMAL, 0, 0, 0, GB2312_CHARSET,
|
||
OUT_STROKE_PRECIS, CLIP_STROKE_PRECIS, DRAFT_QUALITY,
|
||
VARIABLE_PITCH | FF_SWISS, _T("Arial"));
|
||
font3.CreateFont(-MulDiv(14, -dc.GetDeviceCaps(LOGPIXELSY), 72),
|
||
0, 0, 0, FW_NORMAL, 0, 0, 0, GB2312_CHARSET,
|
||
OUT_STROKE_PRECIS, CLIP_STROKE_PRECIS, DRAFT_QUALITY,
|
||
VARIABLE_PITCH | FF_SWISS, _T("ºÚÌå"));
|
||
|
||
font4.CreateFont(-MulDiv(50, -dc.GetDeviceCaps(LOGPIXELSY), 72),
|
||
0, 0, 0, FW_NORMAL, 0, 0, 0, GB2312_CHARSET,
|
||
OUT_STROKE_PRECIS, CLIP_STROKE_PRECIS, DRAFT_QUALITY,
|
||
VARIABLE_PITCH | FF_SWISS, _T("ºÚÌå"));
|
||
|
||
font5.CreateFont(-MulDiv(36, -dc.GetDeviceCaps(LOGPIXELSY), 72),
|
||
0, 0, 0, FW_BOLD, 0, 0, 0, GB2312_CHARSET,
|
||
OUT_STROKE_PRECIS, CLIP_STROKE_PRECIS, DRAFT_QUALITY,
|
||
VARIABLE_PITCH | FF_SWISS, _T("Arial"));
|
||
|
||
font6.CreateFont(-MulDiv(30, -dc.GetDeviceCaps(LOGPIXELSY), 72),
|
||
0, 0, 0, FW_NORMAL, 0, 0, 0, GB2312_CHARSET,
|
||
OUT_STROKE_PRECIS, CLIP_STROKE_PRECIS, DRAFT_QUALITY,
|
||
VARIABLE_PITCH | FF_SWISS, _T("ºÚÌå"));
|
||
|
||
font7.CreateFont(-MulDiv(8, -dc.GetDeviceCaps(LOGPIXELSY), 72),
|
||
0, 0, 0, FW_NORMAL, 0, 0, 0, GB2312_CHARSET,
|
||
OUT_STROKE_PRECIS, CLIP_STROKE_PRECIS, DRAFT_QUALITY,
|
||
VARIABLE_PITCH | FF_SWISS, _T("ºÚÌå"));
|
||
|
||
font9.CreateFont(-MulDiv(22, -dc.GetDeviceCaps(LOGPIXELSY), 72),
|
||
0, 0, 0, FW_NORMAL, 0, 0, 0, GB2312_CHARSET,
|
||
OUT_STROKE_PRECIS, CLIP_STROKE_PRECIS, DRAFT_QUALITY,
|
||
VARIABLE_PITCH | FF_SWISS, _T("ºÚÌå"));
|
||
|
||
font12.CreateFont(-MulDiv(23, -dc.GetDeviceCaps(LOGPIXELSY), 72),
|
||
0, 0, 0, FW_NORMAL, 0, 0, 0, GB2312_CHARSET,
|
||
OUT_STROKE_PRECIS, CLIP_STROKE_PRECIS, DRAFT_QUALITY,
|
||
VARIABLE_PITCH | FF_SWISS, _T("ºÚÌå"));
|
||
|
||
dc.SetBkMode(TRANSPARENT);
|
||
pOldBrush = dc.SelectStockObject(NULL_BRUSH);
|
||
Pen.CreatePen(PS_SOLID, int(0.3f*xmm), RGB(0, 0, 0)); //0.1000¾ÍÊÇÎÒÐèÒªµÄ0.2mm±Ê¿í
|
||
pOldPen = dc.SelectObject(&Pen);
|
||
pOldfont = dc.SelectObject(&font1);
|
||
dc.SetTextColor(RGB(0, 0, 0));//ÉèÖôòÓ¡ÑÕÉ«
|
||
|
||
CString str;
|
||
|
||
float x = 0, y = 0, w = 0, h = 0;
|
||
float x2 = 0, y2 = 0, w2 = 0, h2 = 0;
|
||
float lxBegin = 50;
|
||
float lyBegin = 5;
|
||
float fRectAdd = 0.0f;
|
||
UINT uMask = 0;
|
||
|
||
x = lxBegin; y = lyBegin; w = 23; h = 8;
|
||
//µÚÒ»¸ñ
|
||
//´òӡ˳·áLogo
|
||
CString strSFLogo;
|
||
TCHAR szBuf[512] = { 0 };
|
||
GetCurrentPath(szBuf);
|
||
strSFLogo.Format(_T("%s%s"), szBuf, _T("SFLogo\\logo.jpg"));
|
||
//strSFLogo.Format(_T("%s%s"), szBuf, _T("SFLogo\\20_20 T6.png"));
|
||
x2 = x + 1; y2 = y + 0.5; w2 = w - 2; h2 = h - 1;
|
||
pDlg->Draw_Image(dc->GetSafeHdc(), strSFLogo,x2,y2,w2,h2,xmm,ymm);
|
||
//strSFLogo.Format(_T("%s%s"), szBuf, _T("SFLogo\\ÈÈÏß.png"));
|
||
//x2 = x + 74; y2 = y + 0.5; w2 = 22; h2 = h - 1;
|
||
//pDlg->Draw_Image(dc->GetSafeHdc(), strSFLogo, x2, y2, w2, h2, xmm, ymm);
|
||
|
||
/*
|
||
|
||
CImage image;
|
||
image.Load(strSFLogo);
|
||
if (!image.IsNull())
|
||
{
|
||
SIZE iSize = { image.GetWidth(),image.GetHeight() };
|
||
pDlg->MakeRect_Pict(x2, y2, w2, h2, iSize);
|
||
CRect pRect = pDlg->MakeRect(x2, y2, w2, h2, xmm, ymm);
|
||
//image.Draw(dc->m_hDC, pRect);
|
||
|
||
dc.SetStretchBltMode(COLORONCOLOR);//ÉèÖÃͼÏñµÄÀÉ췽ʽ
|
||
//image.StretchBlt(dc.m_hDC, 0, 0, pRect.left, pRect.top, 0, 0, pRect.Width(), pRect.Height());//½«Í¼ÏñдÈë´òÓ¡»úÉ豸
|
||
image.StretchBlt(dc.m_hDC, pRect);
|
||
}
|
||
*/
|
||
//´òÓ¡²úÆ·´úÂë
|
||
dc.SelectObject(&font5);
|
||
dc.DrawText(pDlg->m_SF.Res_proCode, &pDlg->MakeRect(x + 60, y, 36, h+5, xmm, ymm), DT_RIGHT | DT_SINGLELINE);
|
||
|
||
//´òӡϵͳÀ´Ô´Óëʱ¼ä
|
||
SYSTEMTIME t; ::GetLocalTime(&t);
|
||
str.Format(_T("Mobset CRM ZJ ´òӡʱ¼ä%dÄê%dÔÂ%dÈÕ %02d:%02d"), t.wYear, t.wMonth, t.wDay, t.wHour, t.wMinute);
|
||
dc.SelectObject(&font7);
|
||
dc.DrawText(str, &pDlg->MakeRect(x+6.0f, y+h-0.5f, 72, 5, xmm, ymm), DT_LEFT | DT_VCENTER | DT_SINGLELINE);
|
||
|
||
|
||
//µÚ¶þ¸ñ
|
||
//´òÓ¡ÌõÂëÓëÔ˵¥ºÅ
|
||
lyBegin = lyBegin + 12;
|
||
//´òÓ¡Ô˵¥ºÅÌõÂë
|
||
x = lxBegin + 6; y = lyBegin; w = 82; h = 17;
|
||
COLORREF clrBar = RGB(0, 0, 0);
|
||
COLORREF clrSpace = RGB(255, 255, 255);
|
||
Barcode128 code;
|
||
char szBarCode[64] = { 0 };
|
||
strcpy(szBarCode, CW2A(pDlg->m_SF.Res_mailno));
|
||
code.Encode128B(szBarCode);
|
||
code.DrawBarcode(dc.m_hDC, int((float)x*xmm + 0.5f), int((float)(y+0.5f)*ymm + 0.5f), int((float)(y + h - 1)*ymm + 0.5f), int((float)(y + h)*ymm + 0.5f), clrBar, clrSpace, int(0.41f*xmm + 0.5f));
|
||
//´òÓ¡¡°Ô˵¥ºÅ£º¡±
|
||
x = lxBegin + 3; y = lyBegin + h-0.5f; w = 82; h = 5;
|
||
dc.SelectObject(&font1); //ºÚÌ壬10ºÅ
|
||
//´òÓ¡Ô˵¥ºÅ
|
||
long lLen = _tcslen(pDlg->m_SF.Res_mailno);
|
||
CString strMailNo;
|
||
long lSplit = 3;
|
||
for (int i = 0; i < 20; i += lSplit) //×î¶à´òÓ¡6×é
|
||
{
|
||
TCHAR szPrint[32] = { 0 };
|
||
_tcsncpy(szPrint, pDlg->m_SF.Res_mailno + i, lSplit);
|
||
if (_tcslen(szPrint) > 0)
|
||
{
|
||
if (i == 0)
|
||
strMailNo = szPrint;
|
||
else
|
||
strMailNo = strMailNo + CString(_T(" ")) + CString(szPrint);
|
||
}
|
||
if (_tcslen(szPrint) < lSplit)
|
||
break;
|
||
}
|
||
dc.DrawText(CString(_T("Ô˵¥ºÅ£º")) + strMailNo, &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_CENTER | DT_VCENTER | DT_SINGLELINE);
|
||
/*
|
||
//´òÓ¡T1/T4/T6/T8
|
||
x = lxBegin + 74; y = lyBegin; w = 22; h = 23;
|
||
dc.Rectangle(&pDlg->MakeRect(x, y, w, h+ fRectAdd, xmm, ymm));
|
||
strSFLogo.Format(_T("%sSFLogo\\20_20 %s.png"), szBuf, pDlg->m_SF.Res_proCode);
|
||
x2 = x + 0.5; y2 = y + 0.5; w2 = w - 1; h2 = h - 1;
|
||
pDlg->Draw_Image(dc->GetSafeHdc(), strSFLogo, x2, y2, w2, h2, xmm, ymm);
|
||
*/
|
||
|
||
//µÚÈý¸ñ
|
||
//´òÓ¡ÊÕ¼þÈËÐÅÏ¢
|
||
lyBegin = lyBegin + 23;
|
||
//»¿ò
|
||
x = lxBegin ; y = lyBegin; w = 96; h = 27;
|
||
dc.Rectangle(&pDlg->MakeRect(x, y, w, h + fRectAdd, xmm, ymm));
|
||
//´òӡ·ÓÉÐÅÏ¢
|
||
str = pDlg->m_SF.Res_destRouteLabel;
|
||
if (str.GetLength() <= 0) str = pDlg->m_SF.Res_destcode;
|
||
dc.SelectObject(&font6); //ºÚÌ壬10ºÅ
|
||
x = lxBegin+2; y = lyBegin+0.3f; w = 92; h = 10;
|
||
dc.DrawText(str, &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_LEFT | DT_WORDBREAK);
|
||
//´òÓ¡"ÊÕ"ͼ±ê
|
||
strSFLogo.Format(_T("%sSFLogo\\ÊÕ£¨7mm£©.png"), szBuf);
|
||
x = lxBegin+0.5f; y = lyBegin+9.0f; w = 9.0f; h = 17.5f;
|
||
pDlg->Draw_Image(dc->GetSafeHdc(), strSFLogo, x, y, w, h, xmm, ymm);
|
||
//´òÓ¡ÊÕ¼þÈË
|
||
CString strMobile= pDlg->m_SF.d_mobile;
|
||
CString strTel = pDlg->m_SF.d_tel;
|
||
CString strCompany = pDlg->m_SF.d_company;
|
||
for (int i = 0; i < 4; i++) if (4 + i < strMobile.GetLength()) strMobile.SetAt(3 + i, L'*');
|
||
for (int i = 0; i < 4; i++) if (4 + i < strTel.GetLength()) strTel.SetAt(3 + i, L'*');
|
||
str = pDlg->m_SF.d_contact;
|
||
if (strMobile.GetLength() > 0) str = str + CString(_T(" ")) + strMobile;
|
||
if (strTel.GetLength() > 0) str = str + CString(_T(" ")) + strTel;
|
||
uMask = DT_SINGLELINE;
|
||
if (strCompany.GetLength() > 0) { str = str + CString(_T("\r\n")) + strCompany; uMask = 0; }
|
||
x = lxBegin+10.5f; y = lyBegin + 10.5f; w = 85; h = 7;
|
||
dc.SelectObject(&font1); //ºÚÌ壬10ºÅ
|
||
dc.DrawText(str, &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_LEFT | DT_VCENTER | DT_WORDBREAK | uMask);
|
||
//´òÓ¡µØÖ·
|
||
str = pDlg->m_SF.d_address;
|
||
if (str.GetLength() > 6) for (int i = 1; i <= 5; i++) str.SetAt(str.GetLength() - i, L'*');
|
||
x = lxBegin + 10.5f; y = lyBegin + 18.0f; w = 86; h = 16; //Èç¹ûÐèÒª´òÓ¡COD±ê£¬Ôòw=75£¬²»´òӡΪ85¡£
|
||
dc.DrawText(str, &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_LEFT | DT_WORDBREAK);
|
||
//´òÓ¡COD±ê£¬ÔÝʱ²»ÓôòÓ¡COD±ê
|
||
//strSFLogo.Format(_T("%sSFLogo\\CODͼƬ£¨¿í17mm¸ß9mm£©.png"), szBuf);
|
||
//x = lxBegin+85.5f; y = lyBegin + 10; w = 10.5f; h = 16.0f;
|
||
//pDlg->Draw_Image(dc->GetSafeHdc(), strSFLogo, x, y, w, h, xmm, ymm);
|
||
|
||
//µÚËĸñ
|
||
lyBegin = lyBegin + 27;
|
||
|
||
CString strPayMathod;
|
||
switch (pDlg->m_SF.pay_method)
|
||
{
|
||
case 0:
|
||
strPayMathod = _T("¼Ä¸¶Ô½á");
|
||
break;
|
||
case 1:
|
||
strPayMathod = _T("¼Ä·½¸¶");
|
||
break;
|
||
case 2:
|
||
strPayMathod = _T("ÊÕ·½¸¶");
|
||
break;
|
||
case 3:
|
||
strPayMathod = _T("µÚÈý·½¸¶");
|
||
break;
|
||
}
|
||
//»¿ò
|
||
x = lxBegin; y = lyBegin; w = 96; h = 26;
|
||
dc.Rectangle(&pDlg->MakeRect(x, y, w, h + fRectAdd, xmm, ymm));
|
||
x = lxBegin; y = lyBegin; w = 33; h = 6;
|
||
dc.Rectangle(&pDlg->MakeRect(x, y, w, h + fRectAdd, xmm, ymm));
|
||
dc.SelectObject(&font3); //ºÚÌ壬10ºÅ
|
||
dc.DrawText(strPayMathod, &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_CENTER|DT_VCENTER| DT_SINGLELINE); //¸¶¿î·½Ê½
|
||
x = lxBegin; y = lyBegin+6; w = 33; h = 11;
|
||
dc.Rectangle(&pDlg->MakeRect(x, y, w, h + fRectAdd, xmm, ymm));
|
||
dc.SelectObject(&font12); //ºÚÌ壬10ºÅ
|
||
str = pDlg->m_SF.Res_codingMapping;
|
||
dc.DrawText(str, &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_CENTER | DT_VCENTER | DT_SINGLELINE); //½ø¸ÛÐÅÏ¢
|
||
x = lxBegin; y = lyBegin + 6+11; w = 33; h = 9;
|
||
dc.Rectangle(&pDlg->MakeRect(x, y, w, h + fRectAdd, xmm, ymm));
|
||
//dc.SelectObject(&font12); //ºÚÌ壬10ºÅ
|
||
//str = pDlg->m_SF.Res_sourceTransferCode;
|
||
//dc.DrawText(str, &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_CENTER | DT_VCENTER | DT_SINGLELINE); //³ö¸ÛÐÅÏ¢
|
||
|
||
//´òÓ¡¶þάÂë
|
||
x = lxBegin + 33 ; y = lyBegin; w = 32; h = 26;
|
||
char szQRCode[600] = { 0 };
|
||
strcpy(szQRCode, CW2A(pDlg->m_SF.Res_twoDimensionCode));
|
||
QrCode qr0 = QrCode::encodeText((const char*)szQRCode, QrCode::Ecc::MEDIUM);
|
||
CRect rect = pDlg->MakeRect(x+3.5, y+0.5, w-1, h-1, xmm, ymm);
|
||
QrDrawVC::Draw(qr0, dc, rect);
|
||
|
||
x = lxBegin+33+32; y = lyBegin; w = 10; h = 26;
|
||
dc.Rectangle(&pDlg->MakeRect(x, y, w + fRectAdd, h + fRectAdd, xmm, ymm));
|
||
//´òÓ¡ÒÑÑéÊÓ
|
||
dc.SetTextColor(RGB(192, 192, 192));
|
||
dc.SelectObject(&font9); //ºÚÌ壬10ºÅ
|
||
str = _T("ÒÑÑéÊÓ");
|
||
dc.DrawText(str, &pDlg->MakeRect(x, y+1.5f, w, h, xmm, ymm), DT_CENTER | DT_VCENTER | DT_WORDBREAK); //ÒÑÑéÊÓ
|
||
dc.SetTextColor(RGB(0, 0, 0));
|
||
|
||
x = lxBegin + 33 + 32+10; y = lyBegin; w = 21; h = 17;
|
||
dc.Rectangle(&pDlg->MakeRect(x, y, w, h + fRectAdd, xmm, ymm));
|
||
dc.SelectObject(&font9); //ºÚÌ壬10ºÅ
|
||
str = pDlg->m_SF.Res_proName;
|
||
dc.DrawText(str, &pDlg->MakeRect(x, y+1, w, h+20, xmm, ymm), DT_CENTER | DT_WORDBREAK); //²úÆ·Ãû³Æ
|
||
|
||
x = lxBegin + 33 + 32 + 10; y = lyBegin+17; w = 21; h = 9;
|
||
dc.Rectangle(&pDlg->MakeRect(x, y, w, h + fRectAdd, xmm, ymm));
|
||
|
||
//´òÓ¡A/B±ê
|
||
strSFLogo = _T("");
|
||
if (pDlg->m_SF.Res_abFlag[0] == L'A')
|
||
strSFLogo.Format(_T("%sSFLogo\\A±ê.jpg"), szBuf);
|
||
if (pDlg->m_SF.Res_abFlag[0] == L'B')
|
||
strSFLogo.Format(_T("%sSFLogo\\B±ê.jpg"), szBuf);
|
||
if (strSFLogo.GetLength() > 0)
|
||
pDlg->Draw_Image(dc->GetSafeHdc(), strSFLogo, x + 0.5f, y + 0.5f, w - 1, h - 1, xmm, ymm);
|
||
|
||
|
||
//µÚÎå¸ñ
|
||
lyBegin = lyBegin + 26;
|
||
//»¿ò
|
||
x = lxBegin; y = lyBegin; w = 96; h = 12;
|
||
dc.Rectangle(&pDlg->MakeRect(x, y, w, h + fRectAdd, xmm, ymm));
|
||
//´òÓ¡"¼Ä"ͼ±ê
|
||
strSFLogo.Format(_T("%sSFLogo\\¼Ä(7mm).png"), szBuf);
|
||
x = lxBegin + 0.5f; y = lyBegin + 0.5f; w = 9.0f; h = 11.0f;
|
||
pDlg->Draw_Image(dc->GetSafeHdc(), strSFLogo, x, y, w, h, xmm, ymm);
|
||
//´òÓ¡¼Ä¼þÈË
|
||
strMobile = pDlg->m_SF.j_mobile;
|
||
strTel = pDlg->m_SF.j_tel;
|
||
strCompany = pDlg->m_SF.j_company;
|
||
for (int i = 0; i < 4; i++) if (4 + i < strMobile.GetLength()) strMobile.SetAt(3 + i, L'*');
|
||
for (int i = 0; i < 4; i++) if (4 + i < strTel.GetLength()) strTel.SetAt(3 + i, L'*');
|
||
str = pDlg->m_SF.j_contact;
|
||
if (strMobile.GetLength() > 0) str = str + CString(_T(" ")) + strMobile;
|
||
if (strTel.GetLength() > 0) str = str + CString(_T(" ")) + strTel;
|
||
uMask = DT_SINGLELINE;
|
||
if (strCompany.GetLength() > 0) { str = str + CString(_T("\r\n")) + strCompany; uMask = 0; }
|
||
x = lxBegin + 10.5f; y = lyBegin+0.5f ; w = 85; h = 7;
|
||
dc.SelectObject(&font1); //ºÚÌ壬10ºÅ
|
||
dc.DrawText(str, &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_LEFT | DT_VCENTER | DT_WORDBREAK | uMask);
|
||
//´òÓ¡µØÖ·
|
||
str = pDlg->m_SF.j_address;
|
||
if (str.GetLength() > 6) for (int i = 1; i <= 5; i++) str.SetAt(str.GetLength() - i, L'*');
|
||
x = lxBegin + 10.5f; y = lyBegin + 7.5f; w = 86; h = 16;
|
||
dc.DrawText(str, &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_LEFT | DT_WORDBREAK);
|
||
|
||
//µÚÁù¸ñ
|
||
lyBegin = lyBegin + 12;
|
||
//´òÓ¡Ê×Ò×Logo
|
||
x = lxBegin + 1.0f; y = lyBegin + 9.5f; w = 94; h = 16;
|
||
strSFLogo.Format(_T("%sSFLogo\\mobset_logo2.png"), szBuf);
|
||
pDlg->Draw_Image(dc->GetSafeHdc(), strSFLogo, x, y, w, h, xmm, ymm);
|
||
//»¿ò
|
||
x = lxBegin; y = lyBegin; w = 96; h = 26;
|
||
dc.Rectangle(&pDlg->MakeRect(x, y, w, h + fRectAdd, xmm, ymm));
|
||
//
|
||
str.Format(_T("ÔöÖµ·þÎñ£º\r\nÍмÄÎ%s\r\n¼þÊý£º%d\r\n±¸×¢£º%s"), pDlg->m_SF.Cargo_name, pDlg->m_SF.Cargo_count,pDlg->m_SF.remark);
|
||
x = lxBegin+1.0f; y = lyBegin+2.0f; w = 90; h = 26;
|
||
dc.SelectObject(&font7); //ºÚÌ壬8ºÅ
|
||
dc.DrawText(str, &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_LEFT | DT_WORDBREAK);
|
||
|
||
str.Format(_T("\r\nʵ¼ÊÖØÁ¿ÊÇ£º\r\n¼Æ·ÑÖØÁ¿£º") );
|
||
x = lxBegin + 1.0f+33.0f; y = lyBegin + 2.0f; w = 60; h = 26;
|
||
dc.DrawText(str, &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_LEFT | DT_WORDBREAK);
|
||
CString strCustid = pDlg->m_SF.custid;
|
||
for (int i = 0; i < 6; i++) if (2 + i < strCustid.GetLength()) strCustid.SetAt(2 + i, L'*');
|
||
str.Format(_T("\r\nÔ½ῨºÅ£º%s\r\n·ÑÓúϼƣº"), strCustid);
|
||
x = lxBegin + 1.0f + 33.0f+30.0f; y = lyBegin + 2.0f; w = 30; h = 26;
|
||
dc.DrawText(str, &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_LEFT | DT_WORDBREAK);
|
||
|
||
//µÚÆß¸ñ
|
||
lyBegin = lyBegin + 26;
|
||
//»¿ò
|
||
x = lxBegin; y = lyBegin; w = 96; h = 22;
|
||
dc.Rectangle(&pDlg->MakeRect(x, y, w, h + fRectAdd, xmm, ymm));
|
||
|
||
|
||
|
||
//µÚ¶þ¸ñ
|
||
//»ÐéÏß
|
||
lyBegin = lyBegin + 23;
|
||
//PS_DASH PS_DOT PS_DASHDOT PS_DASHDOTDOT
|
||
Pen2.CreatePen(PS_DASHDOTDOT, int(0.2f*xmm), RGB(0, 0, 0)); //0.1000¾ÍÊÇÎÒÐèÒªµÄ0.2mm±Ê¿í
|
||
dc.SelectObject(&Pen2);
|
||
x = lxBegin; y = lyBegin ; w = 96; h = 60;
|
||
dc.LineX(pDlg->MakePoint(x, y, xmm, ymm), pDlg->MakePoint(x+w, y, xmm, ymm));
|
||
|
||
|
||
//¿Õ15mm£¬»100*60µÄ¿ò
|
||
lyBegin = lyBegin + 1;
|
||
dc.SelectObject(&Pen);
|
||
x = lxBegin; y = lyBegin; w = 96; h = 60;
|
||
dc.Rectangle(&pDlg->MakeRect(x, y, w, h, xmm, ymm));
|
||
|
||
strSFLogo.Format(_T("%s%s"), szBuf, _T("SFLogo\\logo.jpg"));
|
||
x2 = x + 1; y2 = y + 0.5; w2 = 25; h2 = 7;
|
||
pDlg->Draw_Image(dc->GetSafeHdc(), strSFLogo, x2, y2, w2, h2, xmm, ymm);
|
||
strSFLogo.Format(_T("%s%s"), szBuf, _T("SFLogo\\ÈÈÏß.png"));
|
||
x2 = x + 1; y2 = y + 7+0.5f; w2 = 25; h2 = 7;
|
||
pDlg->Draw_Image(dc->GetSafeHdc(), strSFLogo, x2, y2, w2, h2, xmm, ymm);
|
||
|
||
|
||
x = lxBegin + 29; y = lyBegin + 1.5f; w = 48; h = 9.5f;
|
||
code.DrawBarcode(dc.m_hDC, int((float)x*xmm + 0.5f), int((float)y*ymm + 0.5f), int((float)(y + h - 1)*ymm + 0.5f), int((float)(y + h)*ymm + 0.5f), clrBar, clrSpace, int(0.31f*xmm + 0.5f));
|
||
//´òÓ¡¡°Ô˵¥ºÅ£º¡±
|
||
x = lxBegin + 38 + 2; y = lyBegin + 2+9.1f; w = 48; h = 6;
|
||
dc.SelectObject(&font1); //ºÚÌ壬10ºÅ
|
||
dc.DrawText(CString(_T("Ô˵¥ºÅ£º")) + strMailNo, &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_LEFT | DT_SINGLELINE);
|
||
|
||
x = lxBegin; y = lyBegin; w = 27; h = 15;
|
||
//dc.Rectangle(&pDlg->MakeRect(x, y, w, h, xmm, ymm));
|
||
dc.LineX(pDlg->MakePoint(x+w, y, xmm, ymm), pDlg->MakePoint(x + w, y+15, xmm, ymm));
|
||
//9¡¢
|
||
//´òÓ¡ÊÕ¼þÈË
|
||
x = lxBegin + 1; y = lyBegin + 15 ; w = 6; h = 10;
|
||
//dc.SelectObject(&font1); //ºÚÌ壬9ºÅ
|
||
//dc.DrawText(_T("ÊÕ¼þÈË"), &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_CENTER | DT_WORDBREAK);
|
||
//´òÓ¡"ÊÕ"ͼ±ê
|
||
strSFLogo.Format(_T("%sSFLogo\\ÊÕ£¨7mm£©.png"), szBuf);
|
||
pDlg->Draw_Image(dc->GetSafeHdc(), strSFLogo, x, y, w, h, xmm, ymm);
|
||
//´òÓ¡ÊÕ¼þÈËÐÅÏ¢
|
||
dc.SelectObject(&font7); //ºÚÌ壬9ºÅ
|
||
x = lxBegin + 8 + 1; y = lyBegin + 15 + 1.4f; w = 96 - 8 - 1; h = 10;
|
||
strMobile = pDlg->m_SF.d_mobile;
|
||
strTel = pDlg->m_SF.d_tel;
|
||
strCompany = pDlg->m_SF.d_company;
|
||
for (int i = 0; i < 4; i++) if (4 + i < strMobile.GetLength()) strMobile.SetAt(3 + i, L'*');
|
||
for (int i = 0; i < 4; i++) if (4 + i < strTel.GetLength()) strTel.SetAt(3 + i, L'*');
|
||
str = pDlg->m_SF.d_contact;
|
||
if (strMobile.GetLength() > 0) str = str + CString(_T(" ")) + strMobile;
|
||
if (strTel.GetLength() > 0) str = str + CString(_T(" ")) + strTel;
|
||
if (strCompany.GetLength() > 0) str = str + CString(_T(" ")) + strCompany;
|
||
dc.DrawText(str, &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_LEFT | DT_SINGLELINE);
|
||
x = lxBegin + 8 + 1; y = lyBegin + 15 + 1 + 4.8f; w = 96 - 8 - 1; h = 10;
|
||
str = pDlg->m_SF.d_address;
|
||
if (str.GetLength() > 6) for (int i = 1; i <= 5; i++) str.SetAt(str.GetLength() - i, L'*');
|
||
dc.DrawText(str, &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_LEFT | DT_SINGLELINE);
|
||
|
||
x = lxBegin; y = lyBegin+15; w = 96; h = 10;
|
||
dc.Rectangle(&pDlg->MakeRect(x, y, w, h, xmm, ymm));
|
||
|
||
x = lxBegin; y = lyBegin + 15; w = 8; h = 10+10;
|
||
//dc.Rectangle(&pDlg->MakeRect(x, y, w, h, xmm, ymm));
|
||
dc.LineX(pDlg->MakePoint(x+w, y, xmm, ymm), pDlg->MakePoint(x + w, y + h, xmm, ymm));
|
||
|
||
//10¡¢
|
||
|
||
//´òÓ¡¼Ä¼þÈË
|
||
x = lxBegin + 1.2f; y = lyBegin + 15+10 ; w = 6; h = 10;
|
||
//dc.SelectObject(&font1); //ºÚÌ壬9ºÅ
|
||
//dc.DrawText(_T("¼Ä¼þÈË"), &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_CENTER | DT_WORDBREAK);
|
||
strSFLogo.Format(_T("%sSFLogo\\¼Ä(7mm).png"), szBuf);
|
||
pDlg->Draw_Image(dc->GetSafeHdc(), strSFLogo, x, y, w, h, xmm, ymm);
|
||
|
||
//´òÓ¡¼Ä¼þÈËÐÅÏ¢
|
||
x = lxBegin + 8 + 1; y = lyBegin + 15+10 + 1.4f; w = 96 - 8 - 1; h = 10;
|
||
strMobile = pDlg->m_SF.j_mobile;
|
||
strTel = pDlg->m_SF.j_tel;
|
||
strCompany = pDlg->m_SF.j_company;
|
||
for (int i = 0; i < 4; i++) if (4 + i < strMobile.GetLength()) strMobile.SetAt(3 + i, L'*');
|
||
for (int i = 0; i < 4; i++) if (4 + i < strTel.GetLength()) strTel.SetAt(3 + i, L'*');
|
||
str = pDlg->m_SF.j_contact;
|
||
if (strMobile.GetLength() > 0) str = str + CString(_T(" ")) + strMobile;
|
||
if (strTel.GetLength() > 0) str = str + CString(_T(" ")) + strTel;
|
||
if (strCompany.GetLength() > 0) str = str + CString(_T(" ")) + strCompany;
|
||
dc.SelectObject(&font7); //ºÚÌ壬9ºÅ
|
||
dc.DrawText(str, &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_LEFT | DT_SINGLELINE);
|
||
x = lxBegin + 8 + 1; y = lyBegin + 15 + 10 + 1 + 4.8f; w = 96 - 8 - 1; h = 10;
|
||
str = pDlg->m_SF.j_address;
|
||
if (str.GetLength() > 6) for (int i = 1; i <= 5; i++) str.SetAt(str.GetLength() - i, L'*');
|
||
dc.DrawText(str, &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_LEFT | DT_SINGLELINE);
|
||
|
||
|
||
x = lxBegin; y = lyBegin + 15+10+10; w = 96; h = 10;
|
||
//dc.Rectangle(&pDlg->MakeRect(x, y, w, h, xmm, ymm));
|
||
dc.LineX(pDlg->MakePoint(x, y, xmm, ymm), pDlg->MakePoint(x + w, y, xmm, ymm));
|
||
|
||
//11¡¢
|
||
str.Format(_T("¸¶¿î·½Ê½£º%s\r\nÔ½áÕʺţº%s\r\n°ü¹üÊýÁ¿£º%d"), strPayMathod, strCustid, pDlg->m_SF.Cargo_count);
|
||
x = lxBegin + 1; y = lyBegin + 15 + 10 + 10 + 2; w = 30; h = 25;
|
||
dc.SelectObject(&font7); //ºÚÌ壬8ºÅ
|
||
dc.DrawText(str, &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_LEFT | DT_WORDBREAK);
|
||
str = _T("¼Æ·ÑÖØÁ¿£º\r\nÉùÃ÷¼Û¸ñ£º\r\n±£¼Û·ÑÓãº");
|
||
x = lxBegin + 1 + 29; y = lyBegin + 15 + 10 + 10 + 2; w = 23; h = 25;
|
||
dc.DrawText(str, &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_LEFT | DT_WORDBREAK);
|
||
x = lxBegin + 1 + 29 + 20; y = lyBegin + 15 + 10 + 10 + 2; w = 23; h = 25;
|
||
str = _T("°ü×°·ÑÓãº\r\nÔË·Ñ£º\r\n·ÑÓúϼƣº");
|
||
dc.DrawText(str, &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_LEFT | DT_WORDBREAK);
|
||
|
||
//´òÓ¡²úÆ·Ãû³Æ
|
||
CString strSFType;
|
||
switch (pDlg->m_SF.express_type)
|
||
{
|
||
case 0:
|
||
strSFType = _T("˳·á±ê¿ì");
|
||
break;
|
||
case 1:
|
||
strSFType = _T("˳·áÌØ»Ý");
|
||
break;
|
||
case 2:
|
||
strSFType = _T("˳·á¼´ÈÕ");
|
||
break;
|
||
case 3:
|
||
strSFType = _T("˳·á´Î³¿");
|
||
break;
|
||
}
|
||
|
||
//´òÊռļþÈÕÆÚ
|
||
str.Format(_T("²úÆ·£º%s\r\nÊÕ¼þÔ±:\r\n\r\n%04d.%02d.%02d %02d:%02d"), strSFType,pDlg->m_SF.tCreate.wYear,pDlg->m_SF.tCreate.wMonth, pDlg->m_SF.tCreate.wDay, pDlg->m_SF.tCreate.wHour, pDlg->m_SF.tCreate.wMinute);
|
||
x = lxBegin + 1 + 29 + 25+17; y = lyBegin + 15 + 10 + 10 + 2; w = 23; h = 25;
|
||
dc.DrawText(str, &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_LEFT | DT_WORDBREAK);
|
||
|
||
//´òÓ¡ÍмÄÎï
|
||
//str.Format(_T("ÆóÒµID£º%d¡¡¡¡ÍмÄÎ%s"), pDlg->m_SF.lCorpID,pDlg->m_SF.Cargo_name);
|
||
str.Format(_T("ÍмÄÎ%s"), pDlg->m_SF.Cargo_name);
|
||
x = lxBegin + 1; y = lyBegin + 15 + 10 + 10 + 16.5f; w = 96-2; h = 10;
|
||
dc.DrawText(str, &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_LEFT | DT_WORDBREAK);
|
||
str.Format(_T("±¸×¢£º%s"), pDlg->m_SF.remark);
|
||
x = lxBegin + 1; y = lyBegin + 15 + 10 + 10 + 18+2.5f; w = 96 - 20-2; h = 10;
|
||
dc.DrawText(str, &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_LEFT | DT_WORDBREAK);
|
||
|
||
//×îºó´òӡϵ¥ÈÕÆÚ
|
||
//x = lxBegin + 1; y = lyBegin + 15 + 10 + 10 + 18 + 2.5f; w = 96 - 2; h = 10;
|
||
//str.Format(_T("%04d.%02d.%02d %02d:%02d"), pDlg->m_SF.tCreate.wYear, pDlg->m_SF.tCreate.wMonth, pDlg->m_SF.tCreate.wDay, pDlg->m_SF.tCreate.wHour, pDlg->m_SF.tCreate.wMinute);
|
||
//dc.SelectObject(&font7); //ºÚÌ壬7ºÅ
|
||
//dc.DrawText(str, &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_RIGHT | DT_WORDBREAK);
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
if (pOldBrush)
|
||
dc.SelectObject(pOldBrush);
|
||
if (pOldPen)
|
||
dc.SelectObject(pOldPen);
|
||
if (pOldfont)
|
||
dc.SelectObject(pOldfont);
|
||
|
||
font1.DeleteObject();
|
||
font2.DeleteObject();
|
||
font3.DeleteObject();
|
||
font4.DeleteObject();
|
||
font5.DeleteObject();
|
||
font6.DeleteObject();
|
||
font7.DeleteObject();
|
||
font9.DeleteObject();
|
||
font12.DeleteObject();
|
||
}
|
||
|
||
|
||
void DLG_Corp_LXR_SF::On_Print2_b(CDC *pDC, CPrintInfo *pInfo, void *pVoid)
|
||
{
|
||
DLG_Corp_LXR_SF * pDlg = (DLG_Corp_LXR_SF *)pVoid;
|
||
|
||
|
||
CMemDCLJ dc(pDC);
|
||
|
||
CPen Pen, Pen2;
|
||
CPen* pOldPen = NULL;
|
||
CFont* pOldfont = NULL;
|
||
CGdiObject * pOldBrush = NULL;
|
||
CFont font1, font2, font3, font4, font5, font6, font7, font9, font12;
|
||
CPoint point;
|
||
int nWidth = dc.GetDeviceCaps(HORZRES);
|
||
int nHeight = dc.GetDeviceCaps(VERTRES);
|
||
int xLogPixPerInch = dc.GetDeviceCaps(LOGPIXELSX);
|
||
int yLogPixPerInch = dc.GetDeviceCaps(LOGPIXELSY);
|
||
float xmm = ((float)xLogPixPerInch / 24.5f);
|
||
float ymm = ((float)yLogPixPerInch / 24.5f);
|
||
|
||
font1.CreateFont(-MulDiv(10, dc.GetDeviceCaps(LOGPIXELSY), 72),
|
||
0, 0, 0, FW_NORMAL, 0, 0, 0, GB2312_CHARSET,
|
||
OUT_STROKE_PRECIS, CLIP_STROKE_PRECIS, DRAFT_QUALITY,
|
||
VARIABLE_PITCH | FF_SWISS, _T("ºÚÌå"));
|
||
font2.CreateFont(-MulDiv(10, -dc.GetDeviceCaps(LOGPIXELSY), 72),
|
||
0, 0, 0, FW_NORMAL, 0, 0, 0, GB2312_CHARSET,
|
||
OUT_STROKE_PRECIS, CLIP_STROKE_PRECIS, DRAFT_QUALITY,
|
||
VARIABLE_PITCH | FF_SWISS, _T("Arial"));
|
||
font3.CreateFont(-MulDiv(14, -dc.GetDeviceCaps(LOGPIXELSY), 72),
|
||
0, 0, 0, FW_NORMAL, 0, 0, 0, GB2312_CHARSET,
|
||
OUT_STROKE_PRECIS, CLIP_STROKE_PRECIS, DRAFT_QUALITY,
|
||
VARIABLE_PITCH | FF_SWISS, _T("ºÚÌå"));
|
||
|
||
font4.CreateFont(-MulDiv(50, -dc.GetDeviceCaps(LOGPIXELSY), 72),
|
||
0, 0, 0, FW_NORMAL, 0, 0, 0, GB2312_CHARSET,
|
||
OUT_STROKE_PRECIS, CLIP_STROKE_PRECIS, DRAFT_QUALITY,
|
||
VARIABLE_PITCH | FF_SWISS, _T("ºÚÌå"));
|
||
|
||
font5.CreateFont(-MulDiv(36, -dc.GetDeviceCaps(LOGPIXELSY), 72),
|
||
0, 0, 0, FW_NORMAL, 0, 0, 0, GB2312_CHARSET,
|
||
OUT_STROKE_PRECIS, CLIP_STROKE_PRECIS, DRAFT_QUALITY,
|
||
VARIABLE_PITCH | FF_SWISS, _T("Arial"));
|
||
|
||
font6.CreateFont(-MulDiv(36, -dc.GetDeviceCaps(LOGPIXELSY), 72),
|
||
0, 0, 0, FW_NORMAL, 0, 0, 0, GB2312_CHARSET,
|
||
OUT_STROKE_PRECIS, CLIP_STROKE_PRECIS, DRAFT_QUALITY,
|
||
VARIABLE_PITCH | FF_SWISS, _T("ºÚÌå"));
|
||
|
||
font7.CreateFont(-MulDiv(8, -dc.GetDeviceCaps(LOGPIXELSY), 72),
|
||
0, 0, 0, FW_NORMAL, 0, 0, 0, GB2312_CHARSET,
|
||
OUT_STROKE_PRECIS, CLIP_STROKE_PRECIS, DRAFT_QUALITY,
|
||
VARIABLE_PITCH | FF_SWISS, _T("ºÚÌå"));
|
||
|
||
font9.CreateFont(-MulDiv(9, -dc.GetDeviceCaps(LOGPIXELSY), 72),
|
||
0, 0, 0, FW_NORMAL, 0, 0, 0, GB2312_CHARSET,
|
||
OUT_STROKE_PRECIS, CLIP_STROKE_PRECIS, DRAFT_QUALITY,
|
||
VARIABLE_PITCH | FF_SWISS, _T("ºÚÌå"));
|
||
|
||
font12.CreateFont(-MulDiv(12, -dc.GetDeviceCaps(LOGPIXELSY), 72),
|
||
0, 0, 0, FW_NORMAL, 0, 0, 0, GB2312_CHARSET,
|
||
OUT_STROKE_PRECIS, CLIP_STROKE_PRECIS, DRAFT_QUALITY,
|
||
VARIABLE_PITCH | FF_SWISS, _T("ºÚÌå"));
|
||
|
||
dc.SetBkMode(TRANSPARENT);
|
||
pOldBrush = dc.SelectStockObject(NULL_BRUSH);
|
||
Pen.CreatePen(PS_SOLID, int(0.3f*xmm), RGB(0, 0, 0)); //0.1000¾ÍÊÇÎÒÐèÒªµÄ0.2mm±Ê¿í
|
||
pOldPen = dc.SelectObject(&Pen);
|
||
pOldfont = dc.SelectObject(&font1);
|
||
dc.SetTextColor(RGB(0, 0, 0));//ÉèÖôòÓ¡ÑÕÉ«
|
||
|
||
|
||
float x = 0, y = 0, w = 0, h = 0;
|
||
|
||
//µÚÒ»¸ñ
|
||
//»100*90µÄ¿ò
|
||
float lxBegin = 5;
|
||
float lyBegin = 5;
|
||
x = lxBegin; y = lyBegin; w = 100; h = 90;
|
||
dc.Rectangle(&pDlg->MakeRect(x, y, w, h, xmm, ymm));
|
||
//1¡¢
|
||
//´òӡ˳·áLogo
|
||
CString strSFLogo;
|
||
TCHAR szBuf[512] = { 0 };
|
||
GetCurrentPath(szBuf);
|
||
strSFLogo.Format(_T("%s%s"), szBuf, _T("SF_Logo1.jpg"));
|
||
CPictureEx pict;
|
||
if (pict.Load(strSFLogo))
|
||
{
|
||
SIZE iSize = pict.GetSize();
|
||
x = lxBegin + 2; y = lyBegin + 1; w = 25; h = 13 - 2;
|
||
|
||
float w1 = (h * (float)iSize.cx) / (float)iSize.cy;
|
||
float h1 = (w * (float)iSize.cy) / (float)iSize.cx;
|
||
if (h1 > h) //°´³¤¼ÆËã¿í£¬µ«Ð¿í¹ý³¤¡£
|
||
{
|
||
x = x + (w - w1) / 2.0f;
|
||
w = w1;
|
||
}
|
||
if (w1 > w) //°´¿í¼ÆË㳤£¬µ«Ð³¤¹ý³¤¡£
|
||
{
|
||
y = y + (h - h1) / 2.0f;
|
||
h = h1;
|
||
}
|
||
pict.Draw(&dc, pDlg->MakeRect(x, y, w, h, xmm, ymm));
|
||
}
|
||
|
||
strSFLogo.Format(_T("%s%s"), szBuf, _T("SF_Logo2.jpg"));
|
||
CPictureEx pict2;
|
||
if (pict2.Load(strSFLogo))
|
||
{
|
||
SIZE iSize = pict2.GetSize();
|
||
x = lxBegin + 68; y = lyBegin + 1; w = 30; h = 13 - 2;
|
||
|
||
float w1 = (h * (float)iSize.cx) / (float)iSize.cy;
|
||
float h1 = (w * (float)iSize.cy) / (float)iSize.cx;
|
||
if (h1 > h) //°´³¤¼ÆËã¿í£¬µ«Ð¿í¹ý³¤¡£
|
||
{
|
||
x = x + (w - w1) / 2.0f;
|
||
w = w1;
|
||
}
|
||
if (w1 > w) //°´¿í¼ÆË㳤£¬µ«Ð³¤¹ý³¤¡£
|
||
{
|
||
y = y + (h - h1) / 2.0f;
|
||
h = h1;
|
||
}
|
||
pict2.Draw(&dc, pDlg->MakeRect(x, y, w, h, xmm, ymm));
|
||
}
|
||
|
||
|
||
//´òÓ¡E±ê
|
||
if (pDlg->m_SF.express_type == 1) //˳·áÌØ»Ý
|
||
{
|
||
x = lxBegin + 31; y = lyBegin; w = 10; h = 13;
|
||
dc.SelectObject(&font5); //Arial£¬36ºÅ
|
||
dc.DrawText(_T("E"), &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_CENTER | DT_VCENTER | DT_SINGLELINE);
|
||
}
|
||
//´òÓ¡¼Ó¼±±ê
|
||
if (pDlg->m_SF.express_type == 2 || pDlg->m_SF.express_type == 3) //˳·á¼´ÈÕ Ë³·á´Î³¿
|
||
{
|
||
x = lxBegin + 40; y = lyBegin; w = 26; h = 13;
|
||
dc.SelectObject(&font6); //ºÚÌ壬36ºÅ
|
||
dc.DrawText(_T("¼Ó¼±"), &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_CENTER | DT_VCENTER | DT_SINGLELINE);
|
||
}
|
||
|
||
//2¡¢
|
||
x = lxBegin; y = lyBegin + 13; w = 100; h = 20;
|
||
dc.Rectangle(&pDlg->MakeRect(x, y, w, h, xmm, ymm));
|
||
x = lxBegin + 72; y = lyBegin + 13; w = 100 - 72; h = 20;
|
||
dc.Rectangle(&pDlg->MakeRect(x, y, w, h, xmm, ymm));
|
||
x = lxBegin + 72; y = lyBegin + 13; w = 100 - 72; h = 7;
|
||
dc.Rectangle(&pDlg->MakeRect(x, y, w, h, xmm, ymm));
|
||
//´òÓ¡²úÆ·Ãû³Æ
|
||
CString str;
|
||
switch (pDlg->m_SF.express_type)
|
||
{
|
||
case 0:
|
||
str = _T("˳·á±ê¿ì");
|
||
break;
|
||
case 1:
|
||
str = _T("˳·áÌØ»Ý");
|
||
break;
|
||
case 2:
|
||
str = _T("˳·á¼´ÈÕ");
|
||
break;
|
||
case 3:
|
||
str = _T("˳·á´Î³¿");
|
||
break;
|
||
}
|
||
dc.SelectObject(&font3); //ºÚÌ壬14ºÅ
|
||
dc.DrawText(str, &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_CENTER | DT_VCENTER | DT_SINGLELINE);
|
||
|
||
//´òÓ¡Ô˵¥ºÅÌõÂë
|
||
x = lxBegin + 3; y = lyBegin + 13 + 3; w = 60; h = 11;
|
||
COLORREF clrBar = RGB(0, 0, 0);
|
||
COLORREF clrSpace = RGB(255, 255, 255);
|
||
Barcode128 code;
|
||
char szBarCode[64] = { 0 };
|
||
strcpy(szBarCode, CW2A(pDlg->m_SF.Res_mailno));
|
||
code.Encode128B(szBarCode);
|
||
code.DrawBarcode(dc.m_hDC, int((float)x*xmm + 0.5f), int((float)y*ymm + 0.5f), int((float)(y + h - 1)*ymm + 0.5f), int((float)(y + h)*ymm + 0.5f), clrBar, clrSpace, int(0.32f*xmm + 0.5f));
|
||
//´òÓ¡¡°Ô˵¥ºÅ£º¡±
|
||
x = lxBegin + 6 + 5.5f; y = lyBegin + 13 + 3 + 12; w = 60; h = 6;
|
||
dc.SelectObject(&font1); //ºÚÌ壬10ºÅ
|
||
//´òÓ¡Ô˵¥ºÅ
|
||
long lLen = _tcslen(pDlg->m_SF.Res_mailno);
|
||
CString strMailNo;
|
||
long lSplit = 3;
|
||
for (int i = 0; i < 20; i += lSplit) //×î¶à´òÓ¡6×é
|
||
{
|
||
TCHAR szPrint[32] = { 0 };
|
||
_tcsncpy(szPrint, pDlg->m_SF.Res_mailno + i, lSplit);
|
||
if (_tcslen(szPrint) > 0)
|
||
{
|
||
if (i == 0)
|
||
strMailNo = szPrint;
|
||
else
|
||
strMailNo = strMailNo + CString(_T(" ")) + CString(szPrint);
|
||
}
|
||
if (_tcslen(szPrint) < lSplit)
|
||
break;
|
||
}
|
||
dc.DrawText(CString(_T("Ô˵¥ºÅ£º")) + strMailNo, &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_LEFT | DT_SINGLELINE);
|
||
|
||
//x = lxBegin + 6 + 5 +12; y = lyBegin + 13 + 3 + 12; w = 60; h = 6;
|
||
//dc.SelectObject(&font2); //Arial£¬10ºÅ
|
||
//dc.DrawText(strMailNo, &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_LEFT | DT_SINGLELINE);
|
||
|
||
//3¡¢
|
||
x = lxBegin; y = lyBegin + 13 + 20; w = 8; h = 14 + 13 + 9;
|
||
dc.LineX(pDlg->MakePoint(x + w, y, xmm, ymm), pDlg->MakePoint(x + w, y + h, xmm, ymm));
|
||
//´òÓ¡Ä¿µÄµØ
|
||
x = lxBegin + 1; y = lyBegin + 13 + 20 + 2; w = 6; h = 14;
|
||
dc.SelectObject(&font1); //ºÚÌ壬10ºÅ
|
||
dc.DrawText(_T("Ä¿µÄµØ"), &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_CENTER | DT_WORDBREAK);
|
||
|
||
//´òÓ¡Ä¿µÄµØ´úÂë
|
||
x = lxBegin + 8 + 1; y = lyBegin + 13 + 20; w = 100; h = 14;
|
||
dc.SelectObject(&font4); //ºÚÌ壬50ºÅ
|
||
dc.DrawText(pDlg->m_SF.Res_destcode, &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_LEFT | DT_VCENTER | DT_SINGLELINE);
|
||
|
||
//4¡¢
|
||
x = lxBegin; y = lyBegin + 13 + 20 + 14; w = 100; h = 13;
|
||
dc.Rectangle(&pDlg->MakeRect(x, y, w, h, xmm, ymm));
|
||
//´òÓ¡ÊÕ¼þÈË
|
||
x = lxBegin + 1; y = lyBegin + 13 + 20 + 14 + 1.5f; w = 6; h = 13;
|
||
dc.SelectObject(&font1); //ºÚÌ壬10ºÅ
|
||
dc.DrawText(_T("ÊÕ¼þÈË"), &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_CENTER | DT_WORDBREAK);
|
||
//´òÓ¡ÊÕ¼þÈËÐÅÏ¢
|
||
//dc.SelectObject(&font3); //ºÚÌ壬14ºÅ
|
||
dc.SelectObject(&font12); //ºÚÌ壬12ºÅ
|
||
x = lxBegin + 8 + 1; y = lyBegin + 13 + 20 + 14 + 1.2f; w = 100 - 8 - 2; h = 13;
|
||
str = pDlg->m_SF.d_contact + CString(_T(" ")) + pDlg->m_SF.d_mobile + CString(_T(" ")) + pDlg->m_SF.d_tel + CString(_T(" ")) + pDlg->m_SF.d_company;
|
||
dc.DrawText(str, &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_LEFT | DT_SINGLELINE);
|
||
x = lxBegin + 8 + 1; y = lyBegin + 13 + 20 + 14 + 1 + 5.5f; w = 100 - 8 - 2; h = 13;
|
||
str = pDlg->m_SF.d_address;
|
||
dc.DrawText(str, &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_LEFT | DT_WORDBREAK);
|
||
|
||
//5¡¢
|
||
x = lxBegin; y = lyBegin + 13 + 20 + 14 + 13; w = 100; h = 9;
|
||
dc.LineX(pDlg->MakePoint(x, y + h, xmm, ymm), pDlg->MakePoint(x + w, y + h, xmm, ymm));
|
||
x = lxBegin + 78; y = lyBegin + 13 + 20 + 14 + 13; w = 100 - 78; h = 9 + 12 + 9;
|
||
dc.LineX(pDlg->MakePoint(x, y, xmm, ymm), pDlg->MakePoint(x, y + h, xmm, ymm));
|
||
//´òÓ¡¼Ä¼þÈË
|
||
x = lxBegin + 1.2f; y = lyBegin + 13 + 20 + 14 + 13 + 0.5f; w = 5; h = 9;
|
||
dc.SelectObject(&font7); //ºÚÌ壬8ºÅ
|
||
dc.DrawText(_T("¼Ä¼þÈË"), &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_CENTER | DT_WORDBREAK);
|
||
|
||
//´òÓ¡¼Ä¼þÈËÐÅÏ¢
|
||
x = lxBegin + 8 + 1; y = lyBegin + 13 + 20 + 14 + 13 + 1; w = 78 - 8 - 2; h = 9;
|
||
str = pDlg->m_SF.j_contact + CString(_T(" ")) + pDlg->m_SF.j_mobile + CString(_T(" ")) + pDlg->m_SF.j_tel + CString(_T(" ")) + pDlg->m_SF.j_company;
|
||
dc.SelectObject(&font7); //ºÚÌ壬8ºÅ
|
||
dc.DrawText(str, &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_LEFT | DT_SINGLELINE);
|
||
x = lxBegin + 8 + 1; y = lyBegin + 13 + 20 + 14 + 13 + 1 + 4; w = 78 - 8 - 2; h = 9;
|
||
str = pDlg->m_SF.j_address;
|
||
dc.DrawText(str, &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_LEFT | DT_WORDBREAK);
|
||
|
||
//6¡¢
|
||
x = lxBegin; y = lyBegin + 13 + 20 + 14 + 13; w = 78; h = 9 + 12 + 9;
|
||
//dc.Rectangle(&pDlg->MakeRect(x, y, w, h, xmm, ymm));
|
||
//´òÓ¡¸¶¿î·½Ê½
|
||
CString strPayMathod;
|
||
switch (pDlg->m_SF.pay_method)
|
||
{
|
||
case 0:
|
||
strPayMathod = _T("¼Ä¸¶Ô½á");
|
||
break;
|
||
case 1:
|
||
strPayMathod = _T("¼Ä·½¸¶");
|
||
break;
|
||
case 2:
|
||
strPayMathod = _T("ÊÕ·½¸¶");
|
||
break;
|
||
case 3:
|
||
strPayMathod = _T("µÚÈý·½¸¶");
|
||
break;
|
||
}
|
||
str.Format(_T("¸¶¿î·½Ê½£º%s\r\nÔ½áÕʺţº%s\r\n°ü¹üÊýÁ¿£º%d"), strPayMathod, pDlg->m_SF.custid, pDlg->m_SF.Cargo_count);
|
||
x = lxBegin + 1; y = lyBegin + 13 + 20 + 14 + 13 + 9 + 2; w = 30; h = 12;
|
||
dc.SelectObject(&font7); //ºÚÌ壬8ºÅ
|
||
dc.DrawText(str, &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_LEFT | DT_WORDBREAK);
|
||
str = _T("¼Æ·ÑÖØÁ¿£º\r\nÉùÃ÷¼Û¸ñ£º\r\n±£¼Û·ÑÓãº");
|
||
x = lxBegin + 1 + 29; y = lyBegin + 13 + 20 + 14 + 13 + 9 + 2; w = 23; h = 12;
|
||
dc.DrawText(str, &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_LEFT | DT_WORDBREAK);
|
||
x = lxBegin + 1 + 29 + 25; y = lyBegin + 13 + 20 + 14 + 13 + 9 + 2; w = 23; h = 12;
|
||
str = _T("°ü×°·ÑÓãº\r\nÔË·Ñ£º\r\n·ÑÓúϼƣº");
|
||
dc.DrawText(str, &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_LEFT | DT_WORDBREAK);
|
||
//´òÓ¡Ç©Ãû
|
||
x = lxBegin + 1 + 78; y = lyBegin + 13 + 20 + 14 + 13 + 9 + 1; w = 10; h = 9;
|
||
str = _T("Ç©Ãû£º");
|
||
dc.SelectObject(&font9); //ºÚÌ壬9ºÅ
|
||
dc.DrawText(str, &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_LEFT | DT_SINGLELINE);
|
||
x = lxBegin + 1 + 80; y = lyBegin + 13 + 20 + 14 + 13 + 9 + 12 + 9 - 5; w = 18.5f; h = 9;
|
||
str = _T("Äê¡¡Ô¡¡ÈÕ");
|
||
dc.DrawText(str, &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_RIGHT | DT_SINGLELINE);
|
||
|
||
//7¡¢
|
||
x = lxBegin; y = lyBegin + 13 + 20 + 14 + 13 + 9 + 12; w = 78; h = 9;
|
||
//dc.Rectangle(&pDlg->MakeRect(x, y, w, h, xmm, ymm));
|
||
dc.LineX(pDlg->MakePoint(x, y, xmm, ymm), pDlg->MakePoint(x + w, y, xmm, ymm));
|
||
x = lxBegin; y = lyBegin + 13 + 20 + 14 + 13 + 9 + 12; w = 8; h = 9;
|
||
//dc.Rectangle(&pDlg->MakeRect(x, y, w, h, xmm, ymm));
|
||
dc.LineX(pDlg->MakePoint(x + w, y, xmm, ymm), pDlg->MakePoint(x + w, y + h, xmm, ymm));
|
||
x = lxBegin + 60; y = lyBegin + 13 + 20 + 14 + 13 + 9 + 12; w = 78 - 60; h = 9;
|
||
//dc.Rectangle(&pDlg->MakeRect(x, y, w, h, xmm, ymm));
|
||
dc.LineX(pDlg->MakePoint(x, y, xmm, ymm), pDlg->MakePoint(x, y + h, xmm, ymm));
|
||
|
||
//´òÓ¡ÍмÄÎï
|
||
x = lxBegin + 1.2f; y = lyBegin + 13 + 20 + 14 + 13 + 9 + 12 + 0.5f; w = 5; h = 9;
|
||
dc.SelectObject(&font7); //ºÚÌ壬8ºÅ
|
||
dc.DrawText(_T("ÍмÄÎï"), &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_CENTER | DT_WORDBREAK);
|
||
x = lxBegin + 7 + 1.2f; y = lyBegin + 13 + 20 + 14 + 13 + 9 + 12 + 1; w = 50; h = 9;
|
||
str.Format(_T("ÍйÜÎ%s\r\n±¸×¢£º%s\r\n"), pDlg->m_SF.Cargo_name, pDlg->m_SF.remark);
|
||
dc.SelectObject(&font9); //ºÚÌ壬9ºÅ
|
||
dc.DrawText(str, &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_LEFT | DT_WORDBREAK);
|
||
//´òÊռļþÈÕÆÚ
|
||
str.Format(_T("ÊÕ¼þÔ±:\r\nÈÕÆÚ:%02dÔÂ%02dÈÕ\r\nÅɼþÔ±:"), pDlg->m_SF.tCreate.wMonth, pDlg->m_SF.tCreate.wDay);
|
||
x = lxBegin + 60 + 0.3f; y = lyBegin + 13 + 20 + 14 + 13 + 9 + 12 + 0.3f; w = 20; h = 9;
|
||
dc.SelectObject(&font7); //ºÚÌ壬8ºÅ
|
||
dc.DrawText(str, &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_LEFT | DT_WORDBREAK);
|
||
|
||
|
||
//µÚ¶þ¸ñ
|
||
//»ÐéÏß
|
||
lyBegin = lyBegin + 90;
|
||
//PS_DASH PS_DOT PS_DASHDOT PS_DASHDOTDOT
|
||
Pen2.CreatePen(PS_DASHDOTDOT, int(0.2f*xmm), RGB(0, 0, 0)); //0.1000¾ÍÊÇÎÒÐèÒªµÄ0.2mm±Ê¿í
|
||
dc.SelectObject(&Pen2);
|
||
x = lxBegin; y = lyBegin + 7; w = 100; h = 60;
|
||
dc.LineX(pDlg->MakePoint(x, y, xmm, ymm), pDlg->MakePoint(x + w, y, xmm, ymm));
|
||
|
||
|
||
//¿Õ15mm£¬»100*60µÄ¿ò
|
||
lyBegin = lyBegin + 15;
|
||
dc.SelectObject(&Pen);
|
||
x = lxBegin; y = lyBegin; w = 100; h = 60;
|
||
dc.Rectangle(&pDlg->MakeRect(x, y, w, h, xmm, ymm));
|
||
|
||
//8¡¢
|
||
//´òӡ˳·áLogo;
|
||
if (pict.m_bIsInitialized)
|
||
{
|
||
SIZE iSize = pict.GetSize();
|
||
x = lxBegin + 2; y = lyBegin + 0.5f; w = 28 - 2; h = 7;
|
||
float w1 = (h * (float)iSize.cx) / (float)iSize.cy;
|
||
float h1 = (w * (float)iSize.cy) / (float)iSize.cx;
|
||
if (h1 > h) //°´³¤¼ÆËã¿í£¬µ«Ð¿í¹ý³¤¡£
|
||
{
|
||
x = x + (w - w1) / 2.0f;
|
||
w = w1;
|
||
}
|
||
if (w1 > w) //°´¿í¼ÆË㳤£¬µ«Ð³¤¹ý³¤¡£
|
||
{
|
||
y = y + (h - h1) / 2.0f;
|
||
h = h1;
|
||
}
|
||
pict.Draw(&dc, pDlg->MakeRect(x, y, w, h, xmm, ymm));
|
||
}
|
||
if (pict2.m_bIsInitialized)
|
||
{
|
||
SIZE iSize = pict2.GetSize();
|
||
x = lxBegin + 2; y = lyBegin + 7 + 0.5f; w = 28 - 2; h = 7;
|
||
float w1 = (h * (float)iSize.cx) / (float)iSize.cy;
|
||
float h1 = (w * (float)iSize.cy) / (float)iSize.cx;
|
||
if (h1 > h) //°´³¤¼ÆËã¿í£¬µ«Ð¿í¹ý³¤¡£
|
||
{
|
||
x = x + (w - w1) / 2.0f;
|
||
w = w1;
|
||
}
|
||
if (w1 > w) //°´¿í¼ÆË㳤£¬µ«Ð³¤¹ý³¤¡£
|
||
{
|
||
y = y + (h - h1) / 2.0f;
|
||
h = h1;
|
||
}
|
||
pict2.Draw(&dc, pDlg->MakeRect(x, y, w, h, xmm, ymm));
|
||
}
|
||
|
||
|
||
x = lxBegin + 31; y = lyBegin + 1.5f; w = 48; h = 9.5f;
|
||
code.DrawBarcode(dc.m_hDC, int((float)x*xmm + 0.5f), int((float)y*ymm + 0.5f), int((float)(y + h - 1)*ymm + 0.5f), int((float)(y + h)*ymm + 0.5f), clrBar, clrSpace, int(0.32f*xmm + 0.5f));
|
||
//´òÓ¡¡°Ô˵¥ºÅ£º¡±
|
||
x = lxBegin + 38 + 6; y = lyBegin + 2 + 9.1f; w = 48; h = 6;
|
||
dc.SelectObject(&font1); //ºÚÌ壬10ºÅ
|
||
dc.DrawText(CString(_T("Ô˵¥ºÅ£º")) + strMailNo, &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_LEFT | DT_SINGLELINE);
|
||
|
||
x = lxBegin; y = lyBegin; w = 28; h = 15;
|
||
//dc.Rectangle(&pDlg->MakeRect(x, y, w, h, xmm, ymm));
|
||
dc.LineX(pDlg->MakePoint(x + w, y, xmm, ymm), pDlg->MakePoint(x + w, y + 15, xmm, ymm));
|
||
//9¡¢
|
||
//´òÓ¡ÊÕ¼þÈË
|
||
x = lxBegin + 1; y = lyBegin + 15 + 0.5f; w = 6; h = 10;
|
||
dc.SelectObject(&font9); //ºÚÌ壬9ºÅ
|
||
dc.DrawText(_T("ÊÕ¼þÈË"), &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_CENTER | DT_WORDBREAK);
|
||
//´òÓ¡ÊÕ¼þÈËÐÅÏ¢
|
||
dc.SelectObject(&font9); //ºÚÌ壬9ºÅ
|
||
x = lxBegin + 8 + 1; y = lyBegin + 15 + 1.4f; w = 100 - 8 - 2; h = 10;
|
||
str = pDlg->m_SF.d_contact + CString(_T(" ")) + pDlg->m_SF.d_mobile + CString(_T(" ")) + pDlg->m_SF.d_tel + CString(_T(" ")) + pDlg->m_SF.d_company;
|
||
dc.DrawText(str, &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_LEFT | DT_SINGLELINE);
|
||
x = lxBegin + 8 + 1; y = lyBegin + 15 + 1 + 4.8f; w = 100 - 8 - 2; h = 10;
|
||
str = pDlg->m_SF.d_address;
|
||
dc.DrawText(str, &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_LEFT | DT_SINGLELINE);
|
||
|
||
x = lxBegin; y = lyBegin + 15; w = 100; h = 10;
|
||
dc.Rectangle(&pDlg->MakeRect(x, y, w, h, xmm, ymm));
|
||
|
||
x = lxBegin; y = lyBegin + 15; w = 8; h = 10 + 10;
|
||
//dc.Rectangle(&pDlg->MakeRect(x, y, w, h, xmm, ymm));
|
||
dc.LineX(pDlg->MakePoint(x + w, y, xmm, ymm), pDlg->MakePoint(x + w, y + h, xmm, ymm));
|
||
|
||
//10¡¢
|
||
|
||
//´òÓ¡¼Ä¼þÈË
|
||
x = lxBegin + 1.2f; y = lyBegin + 15 + 10 + 0.5f; w = 5; h = 9;
|
||
dc.SelectObject(&font9); //ºÚÌ壬9ºÅ
|
||
dc.DrawText(_T("¼Ä¼þÈË"), &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_CENTER | DT_WORDBREAK);
|
||
|
||
//´òÓ¡¼Ä¼þÈËÐÅÏ¢
|
||
x = lxBegin + 8 + 1; y = lyBegin + 15 + 10 + 1.4f; w = 100 - 8 - 2; h = 10;
|
||
str = pDlg->m_SF.j_contact + CString(_T(" ")) + pDlg->m_SF.j_mobile + CString(_T(" ")) + pDlg->m_SF.j_tel + CString(_T(" ")) + pDlg->m_SF.j_company;
|
||
dc.SelectObject(&font9); //ºÚÌ壬9ºÅ
|
||
dc.DrawText(str, &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_LEFT | DT_SINGLELINE);
|
||
x = lxBegin + 8 + 1; y = lyBegin + 15 + 10 + 1 + 4.8f; w = 100 - 8 - 2; h = 10;
|
||
str = pDlg->m_SF.j_address;
|
||
dc.DrawText(str, &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_LEFT | DT_SINGLELINE);
|
||
|
||
|
||
x = lxBegin; y = lyBegin + 15 + 10 + 10; w = 100; h = 10;
|
||
//dc.Rectangle(&pDlg->MakeRect(x, y, w, h, xmm, ymm));
|
||
dc.LineX(pDlg->MakePoint(x, y, xmm, ymm), pDlg->MakePoint(x + w, y, xmm, ymm));
|
||
|
||
//11¡¢
|
||
str.Format(_T("¸¶¿î·½Ê½£º%s\r\nÔ½áÕʺţº%s\r\n°ü¹üÊýÁ¿£º%d"), strPayMathod, pDlg->m_SF.custid, pDlg->m_SF.Cargo_count);
|
||
x = lxBegin + 1; y = lyBegin + 15 + 10 + 10 + 2; w = 30; h = 25;
|
||
dc.SelectObject(&font7); //ºÚÌ壬8ºÅ
|
||
dc.DrawText(str, &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_LEFT | DT_WORDBREAK);
|
||
str = _T("¼Æ·ÑÖØÁ¿£º\r\nÉùÃ÷¼Û¸ñ£º\r\n±£¼Û·ÑÓãº");
|
||
x = lxBegin + 1 + 29; y = lyBegin + 15 + 10 + 10 + 2; w = 23; h = 25;
|
||
dc.DrawText(str, &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_LEFT | DT_WORDBREAK);
|
||
x = lxBegin + 1 + 29 + 25; y = lyBegin + 15 + 10 + 10 + 2; w = 23; h = 25;
|
||
str = _T("°ü×°·ÑÓãº\r\nÔË·Ñ£º\r\n·ÑÓúϼƣº");
|
||
dc.DrawText(str, &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_LEFT | DT_WORDBREAK);
|
||
|
||
//´òÊռļþÈÕÆÚ
|
||
str.Format(_T("ÊÕ¼þÔ±:\r\n\r\nÈÕÆÚ:%02dÔÂ%02dÈÕ"), pDlg->m_SF.tCreate.wMonth, pDlg->m_SF.tCreate.wDay);
|
||
x = lxBegin + 1 + 29 + 25 + 25; y = lyBegin + 15 + 10 + 10 + 2; w = 23; h = 25;
|
||
dc.DrawText(str, &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_LEFT | DT_WORDBREAK);
|
||
|
||
//´òÓ¡ÍмÄÎï
|
||
//str.Format(_T("ÆóÒµID£º%d¡¡¡¡ÍмÄÎ%s"), pDlg->m_SF.lCorpID,pDlg->m_SF.Cargo_name);
|
||
str.Format(_T("ÍмÄÎ%s"), pDlg->m_SF.Cargo_name);
|
||
x = lxBegin + 1; y = lyBegin + 15 + 10 + 10 + 16.5f; w = 100 - 2; h = 10;
|
||
dc.DrawText(str, &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_LEFT | DT_WORDBREAK);
|
||
str.Format(_T("±¸×¢£º%s"), pDlg->m_SF.remark);
|
||
x = lxBegin + 1; y = lyBegin + 15 + 10 + 10 + 18 + 2.5f; w = 100 - 20 - 2; h = 10;
|
||
dc.DrawText(str, &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_LEFT | DT_WORDBREAK);
|
||
|
||
//×îºó´òӡϵ¥ÈÕÆÚ
|
||
x = lxBegin + 1; y = lyBegin + 15 + 10 + 10 + 18 + 2.5f; w = 100 - 2; h = 10;
|
||
str.Format(_T("%04d.%02d.%02d %02d:%02d"), pDlg->m_SF.tCreate.wYear, pDlg->m_SF.tCreate.wMonth, pDlg->m_SF.tCreate.wDay, pDlg->m_SF.tCreate.wHour, pDlg->m_SF.tCreate.wMinute);
|
||
dc.SelectObject(&font7); //ºÚÌ壬7ºÅ
|
||
dc.DrawText(str, &pDlg->MakeRect(x, y, w, h, xmm, ymm), DT_RIGHT | DT_WORDBREAK);
|
||
|
||
|
||
|
||
//´òÓ¡¶þάÂë²âÊÔ
|
||
CString strQrTextA = CW2A(pDlg->m_SF.Res_mailno);
|
||
QrCode qr0 = QrCode::encodeText((const char*)szBarCode, QrCode::Ecc::MEDIUM);
|
||
|
||
x = lxBegin + 10; y = lyBegin + 15 + 10 + 10 + 18 + 2.5f; w = 20; h = 20;
|
||
CRect rect = pDlg->MakeRect(x, y, w, h, xmm, ymm);
|
||
QrDrawVC::Draw(qr0, dc, rect);
|
||
|
||
|
||
|
||
|
||
if (pOldBrush)
|
||
dc.SelectObject(pOldBrush);
|
||
if (pOldPen)
|
||
dc.SelectObject(pOldPen);
|
||
if (pOldfont)
|
||
dc.SelectObject(pOldfont);
|
||
|
||
font1.DeleteObject();
|
||
font2.DeleteObject();
|
||
font3.DeleteObject();
|
||
font4.DeleteObject();
|
||
font5.DeleteObject();
|
||
font6.DeleteObject();
|
||
font7.DeleteObject();
|
||
font9.DeleteObject();
|
||
font12.DeleteObject();
|
||
}
|
||
|
||
void DLG_Corp_LXR_SF::On_BeginPrint2(CDC *pDC, CPrintInfo *pInfo, void *pVoid)
|
||
{
|
||
// pInfo->SetMaxPage(1); //Ö»ÓÐ1Ò³
|
||
}
|
||
|
||
|
||
RECT DLG_Corp_LXR_SF::MakeRect(float x, float y, float w, float h,float xrate, float yrate)
|
||
{
|
||
RECT rect = { int((float)x*xrate+0.5f),int((float)y*yrate + 0.5f),int(float(x + w)*xrate+0.5f),int((float)(y + h)*yrate +0.5f) };
|
||
return rect;
|
||
}
|
||
|
||
POINT DLG_Corp_LXR_SF::MakePoint(float x, float y, float xrate, float yrate)
|
||
{
|
||
POINT point = { int((float)x*xrate + 0.5f),int((float)y*yrate + 0.5f) };
|
||
return point;
|
||
}
|
||
|
||
void DLG_Corp_LXR_SF::Draw_Image(HDC pDc, CString strName, float x,float y,float w,float h,float xmm,float ymm)
|
||
{
|
||
CImage image;
|
||
image.Load(strName);
|
||
if (!image.IsNull())
|
||
{
|
||
SIZE iSize = { image.GetWidth(),image.GetHeight() };
|
||
MakeRect_Pict(x, y, w, h, iSize);
|
||
CRect pRect = MakeRect(x, y, w, h, xmm, ymm);
|
||
//image.Draw(pDc, pRect);
|
||
SetStretchBltMode(pDc, STRETCH_HALFTONE);//ÉèÖÃͼÏñµÄÀÉ췽ʽ
|
||
//SetStretchBltMode(pDc, WHITEONBLACK); //±£³ÖͼƬ²»Ê§Õæ
|
||
image.StretchBlt(pDc, pRect);
|
||
}
|
||
|
||
}
|
||
|
||
void DLG_Corp_LXR_SF::MakeRect_Pict(float &x, float &y, float &w, float &h, SIZE iSize)
|
||
{
|
||
float w1 = (h * (float)iSize.cx) / (float)iSize.cy;
|
||
float h1 = (w * (float)iSize.cy) / (float)iSize.cx;
|
||
if (h1 > h) //°´³¤¼ÆËã¿í£¬µ«Ð¿í¹ý³¤¡£
|
||
{
|
||
x = x + (w - w1) / 2.0f;
|
||
w = w1;
|
||
}
|
||
if (w1 > w) //°´¿í¼ÆË㳤£¬µ«Ð³¤¹ý³¤¡£
|
||
{
|
||
y = y + (h - h1) / 2.0f;
|
||
h = h1;
|
||
}
|
||
}
|
||
|
||
void DLG_Corp_LXR_SF::OnPreparePrinting2(CPrintInfo *pInfo)
|
||
{
|
||
pInfo->SetMaxPage(1); //Ö»ÓÐ1Ò³
|
||
//ÉèºáÏò
|
||
|
||
CWinApp* pApp = AfxGetApp();
|
||
pApp->GetPrinterDeviceDefaults(&pInfo->m_pPD->m_pd);
|
||
if (pInfo)
|
||
{
|
||
LPDEVMODE lpDevmode = pInfo->m_pPD->GetDevMode();
|
||
if (lpDevmode)
|
||
{
|
||
//if (m_lPrintType == 1)
|
||
// lpDevmode->dmOrientation = DMORIENT_PORTRAIT; //×ÝÏò
|
||
//else
|
||
// lpDevmode->dmOrientation = DMORIENT_LANDSCAPE; //ºáÏò
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
void DLG_Corp_LXR_SF::GetCurrentPath(TCHAR *pPath)
|
||
{
|
||
::GetModuleFileName(NULL, pPath, 512);
|
||
for (int j = _tcslen(pPath); j>0; j--)
|
||
{
|
||
if (pPath[j] == '\\')
|
||
break;
|
||
}
|
||
pPath[j + 1] = 0;
|
||
} |