Exemplo n.º 1
0
int	CaInput::Create(int iX,int iY,int iW,int iH)
{
	if(m_labelPos == ON_LEFT )
	{
		m_iConMaxLen=(iW-m_iLbWidth)/CHAR_W; //ȱʡֵ
		m_iScrMaxLen=m_iConMaxLen;
		m_iLbOffSet=m_iLbWidth;
	}
	else
	{
		m_iConMaxLen=iW/CHAR_W; //ȱʡֵ
		m_iScrMaxLen=iW/CHAR_W;
		m_iLbOffSet=0;

	}
	
	CaObject::Create(iX, iY, iW, iH);
	if(m_labelPos != ON_NULL)
	{
		DBG_ASSERT_EXIT((m_iLbWidth >0),("m_iLbWidth=%d",m_iLbWidth));
		m_pLabel=new CaLabel(false,ALIGN_RIGHT,CA_INNER_LABEL);
		switch(m_labelPos) {
		case ON_LEFT:
			m_pLabel->Create(m_iX, m_iY, m_iLbWidth, m_iH);
			break;
		case ON_TOP:
			m_pLabel->Create(m_iX, m_iY-WORD_H, m_iLbWidth, m_iH);
			break;
		default:
			DBG_ASSERT_EXIT(false,("m_labelPos =%d error! ",(int)m_labelPos));
		}
	}
	return 0;
}
//-----------------------------------------------------------
//发票作废具体操作函数
//-----------------------------------------------------------
UINT8 INVM_InvWasteHandle(SaleData *pSaleData)
{
    DBG_ENTER("InvWasteHandle");
    DBG_PRINT(("进入InvWasteHandle函数"));
    DBG_ASSERT_EXIT((pSaleData != NULL), (" pSaleData == NULL!"));

    UINT8 ret;

    //构建废票
    CInvHead curInvHead;
    pSaleData->m_smallInvInfo = &curInvHead;
    DBG_ASSERT_EXIT((pSaleData->m_smallInvInfo != NULL), (" pSaleData->m_smallInvInfo == NULL!"));

    INVM_BuildWasteInv(pSaleData->m_smallInvInfo);

    //调用开票句柄
    ret = pSaleData->MakeInvoiceHandle(0, INV_ROLL_PROC);
    DBG_PRINT(("ret= %u",ret));
    if (ret != SUCCESS)
    {
        DBG_RETURN(ret);
    }

    pSaleData->InitSaleData(1);
    pSaleData->m_smallInvInfo = NULL;
    DBG_PRINT(("退出InvWasteHandle函数"));
    DBG_RETURN(SUCCESS);
}
Exemplo n.º 3
0
int CNetManager::buildTransInstance(CNetTransfers **pNetTrans, TransMode *transMode)
{
	CNetTransfers *pT=NULL;
	Sending *pS=NULL;
	int curl_flag=0;

	if (GetConnectionMode() == NET_M2M_WMMP)
	{
		DBG_ASSERT_EXIT(transMode->module!=TRANS_BY_CURL, ("CURL doesnot suport WMMP"));
		curl_flag = 0;
		pS = new SendByWmmp();
	}
	else
	{
		if (transMode->module == TRANS_BY_CURL)
		{
			curl_flag = 1;
		}
		else if (transMode->module == TRANS_BY_TRANSPROC)
		{
			pS = new SendBySocket();
		}
	}
	
	if (curl_flag == 0)
	{
		DBG_ASSERT_EXIT(pS!=NULL, ("pSending is NULL!!"));
		if (transMode->appProtocal == APP_LAYER_HTTP)
		{
			pT = new trans_http(pS);
		}
		else 
		{
			pT = new trans_direct(pS);
		}
	}
	else
	{
#if (_TRANS_MODULE_CURL != 0)
		pT = new trans_CURL();
#else
		DBG_ASSERT_EXIT(0, ("CURL not compile"));		
#endif
	}

	pT->SetDataKeepType(transMode->dataKeepType);

	*pNetTrans = pT;
	DBG_PRINT(("pT: %x", pT))

	return NET_SUCCESS;
	
}
//------------------------------------------------------------------
//存根打印
//------------------------------------------------------------------
UINT8 INVM_GetInvNum(string nCode, UINT32 nStartNo, UINT32 nEndNo, UINT32 &nNum)
{
    DBG_ENTER("GetInvNum(UINT32 &nNum)");

    nNum = 0;
    INT32 errorcode;
    INT32 nTmpNum = 0;
    CInvHead curInvHead;
    CInvHead *pInvHead = &curInvHead;
    DBG_ASSERT_EXIT((pInvHead != NULL), (" pInvHead == NULL!"));

    //查总记录数,已分发未导入,赋值pageNum

    INT8 value[256];
    memset((void*)value, 0, sizeof(value));
    pInvHead->m_filter = "where FPDM = ";
    sprintf(value,"'%s' and FPHM >= %u and FPHM <= %u",nCode.c_str(),nStartNo,nEndNo);
    pInvHead->m_filter.append(value);
    DBG_PRINT((" pInvHead->m_filter = %s", pInvHead->m_filter.c_str()));
    nTmpNum = pInvHead->GetRecordNum();

    pInvHead = NULL;

    if (nTmpNum<0)
    {
        DBG_RETURN(FAILURE);
    }
    nNum = nTmpNum;
    DBG_RETURN(SUCCESS);
}
CGInvLabelWin::CGInvLabelWin():CaWindow()
{
	m_pageIndex = 1;
	m_pageNum = 0;
	m_iBtnW = 0;
	m_iColW = 0;
	m_curH = 0;
	m_invType = 0;
	m_pInvVol = &m_Invvol;
	m_pLInvHead = &m_LInvhead;
	DBG_ASSERT_EXIT((m_pInvVol != NULL), (" m_pInvVol == NULL!"));
	DBG_ASSERT_EXIT((m_pLInvHead != NULL), (" m_pLInvHead == NULL!"));	

	m_flag1 = 0;
	m_level2 = 0;
}
void CFourLabelsCommonWin::SetTitle(int num, const char *title)
{
	DBG_ASSERT_EXIT(num > 0 && num <= m_iTotalLine,("Num %d is invalid", num));
	switch(num)
	{
	case 1:
		{
			m_pLabel1->SetTitle(title, strlen(title));
		}
		break;
	case 2:
		{
			m_pLabel2->SetTitle(title, strlen(title));
		}
		break;
	case 3:
		{
			m_pLabel3->SetTitle(title, strlen(title));
		}
	    break;
	case 4:
		{
			m_pLabel4->SetTitle(title, strlen(title));
		}
	    break;
	default:
	    break;
	}
}
int InitPara(string &strErr)
{
	DBG_PRINT(("==============InitPara Begin================"));
	if(g_initParaFlag == 0)
	{
		CDB *m_db = CDB::GetInstance();
		m_db->Open();
		m_db->Init();
		CommonSleep(300);
		
		UINT8 index;
		for(index = 0; index<DET_ARRAY_LEN; index++)
		{
			s_DetArray[index] = new CInvDet;
			//DBG_PRINT(("s_DetArray[%d] = %x", index, s_DetArray[index]));
			DBG_ASSERT_EXIT((s_DetArray[index] != NULL), (" s_DetArray[index] == NULL!"));
		}
		
		g_globalArgLib = CGlobalArgLib::GetInstance();
		g_gNetArg = CGlobalNetArg::GetInstance();
		g_globalArgLib->InitGlobalArg();
		
		INT8 tmpbuf[64];
		memset(tmpbuf, 0, sizeof(tmpbuf));
		sprintf(tmpbuf, "%u", g_globalArgLib->m_corpInfo->m_Kpjhm);
		g_gNetArg->InitGlobalNetArg(g_globalArgLib->m_corpInfo->m_Nsrsbh, "", g_globalArgLib->m_strHashNo, tmpbuf, g_globalArgLib->m_corpInfo->m_Jspsbh, "");
		g_gNetArg->SetZskl(g_globalArgLib->m_strZskl);

		g_initParaFlag = 1;
	}
	DBG_PRINT(("==============InitPara End================"));
}
Exemplo n.º 8
0
void CaGroup::Insert(CaObject *pObj,int index)
{
  DBG_ASSERT_EXIT(pObj != NULL,("pObj is NULL!"));
 // DBG_PRN("info",("index=%d",index));
  if (pObj->m_pOwner) 
  {
    CaGroup* g = (CaGroup*)(pObj->m_pOwner);
    int n = g->Find(pObj);
	if(n<index) //此对象已经在列表中了   ###
	{
		if (g == this) 
		{
		  if (index > n) index--;//      ###   repeat  need to delete this line
		  if (index == n) return;
		}
		g->Remove(pObj);
	}
  }
  pObj->m_pOwner = this;
  Insert(&m_pList,m_iObjCount,pObj,index);
  if(pObj->m_bFocus)
  {
	    m_bFocusObjChanged=true;
  }
  if( pObj->m_bFocus && m_bEndFlag)
  {
	ReCreateFocusList();
  }
 }
//-------------------------------------------------------------
//获取款机数据库中记录的发票卷数
//-------------------------------------------------------------
UINT8 INVM_GetVolNum(UINT32 &nNum)
{
    DBG_ENTER("GetVolNum(UINT32 &nNum)");

    INT32 errorcode;
    nNum = 0;
    INT32 nTmpNum = 0;
    CInvVol curInvVol;
    CInvVol *pInvVol = &curInvVol;
    DBG_ASSERT_EXIT((pInvVol != NULL), (" pInvVol == NULL!"));

    //查总记录数,已分发未导入,赋值pageNum
    pInvVol->m_filter = "where USED_FLAG = 1 and OVER_FLAG = 1";
    nTmpNum = pInvVol->GetRecordNum();
    if (nTmpNum <= 0)
    {
        pInvVol = NULL;
        DBG_RETURN(FAILURE);
    }

    nNum = nTmpNum;
    pInvVol = NULL;
    DBG_PRINT((" GetVolNum!"));
    DBG_RETURN(SUCCESS);
}
UINT8 INVM_InvRetProc(CInvHead *pInvHead)
{

    DBG_PRINT(("进入INVM_InvRetProc函数"));

    UINT8 ret;

    CaProgressBar proBar("红票打印中.....");
    proBar.ReFresh();

    if (NULL==pSaleData)//extern SaleData *pSaleData; /**< 销售数据类指针*/

    {
        pSaleData = new SaleData;
    }
    DBG_ASSERT_EXIT((pSaleData != NULL), (" pSaleData == NULL!"));

    ret = INVM_InvReturn(pSaleData,pInvHead); //退本机发票

    DBG_PRINT(("ret= %u",ret));
    if (ret != SUCCESS)
    {
        pSaleData=NULL;
        return ret;
    }

    pSaleData=NULL;

    return  SUCCESS;
}
//----------------------------------------------------
//空白发票作废
//----------------------------------------------------
UINT8 INVM_InvWasteProc()
{
    DBG_PRINT(("进入INVM_InvWasteProc函数"));

    UINT8 ret;

    CaProgressBar proBar("空白作废中.....");
    proBar.ReFresh();

    if (NULL==pSaleData)
    {
        pSaleData = new SaleData;
    }

    DBG_ASSERT_EXIT((pSaleData != NULL), (" pSaleData == NULL!"));
    UINT8 nIfInvSum =0;
    ret = INVM_InvWaste(1,pSaleData,nIfInvSum); //空白作废

    DBG_PRINT(("ret= %u",ret));
    if (ret != SUCCESS)
    {
        pSaleData=NULL;
        return ret;
    }

    pSaleData=NULL;

    return  SUCCESS;
}
Exemplo n.º 12
0
int CaInput::HalfHZCount( char *str,int len)
{
	DBG_ASSERT_EXIT(str != NULL,("str is NULL!"));
	int c=0;
	int p=0;
	while (p < len)
	{
		if (((str[p]&0xff) >= 0x81) && ((str[p]&0xff) <= 0xfe))
		{
			c++;
			p++;
			if (p < len)
			{
				if (((str[p]&0xff) >= 0x40) && ((str[p]&0xff) <= 0xfe))
				{
					c++;
					p++;
				}
			}
		}
		else
		{
			p++;
		}
	}

	return c;

}
Exemplo n.º 13
0
void CDB::Init()
{
#if PTHREAD_MUTEX_OPEN == 1
	m_db->m_rwcs = &g_skjmutex;
	DBG_ASSERT_EXIT((m_db->m_rwcs != NULL), (" m_db->m_rwcs == NULL!"));
#endif
}
Exemplo n.º 14
0
CInvStubPrnWin::CInvStubPrnWin():CaWindow()
{
	m_pageIndex = 1;
	m_pageNum = 0;

	m_pInvHead = &m_invHead;
	DBG_ASSERT_EXIT((m_pInvHead != NULL), (" m_pInvHead == NULL!"));	
}
CMonthSaleShowWIn::CMonthSaleShowWIn():CaWindow()
{
	m_pageIndex = 1;
	m_pageNum = 2;

	m_ptrTjxxhz = new CDataTjxxhz;
	DBG_ASSERT_EXIT((m_ptrTjxxhz != NULL), (" m_ptrTjxxhz == NULL!"));	
}
const char* CMainFrame::GetWinName(int id)
{
	DBG_ASSERT_EXIT( id >= 0 && id < WIN_MAX_NUM ,(" id=%d is invalid!",id));
// 	switch(id) {
// 	
// 	default:
// 		break;
// 	}
	return NULL;
}
Exemplo n.º 17
0
CFourLabelsCommonWin::CFourLabelsCommonWin(int numOfLabels)
{
	DBG_ASSERT_EXIT(numOfLabels >= 0, 
		("Num of labels in one win can't be less than 0"));

	m_iTotalLine = numOfLabels;
	m_pLabel1 = NULL;
	m_pLabel2 = NULL;
	m_pLabel4 = NULL;
	m_pLabel3 = NULL;
}
Exemplo n.º 18
0
int  CaGroup::Create(int iX,int iY,int iW,int iH)
{
	CaObject::Create(iX, iY, iW, iH);
	if(m_labelPos != ON_NULL)
	{
		DBG_ASSERT_EXIT((m_iLbWidth >0),("m_iLbWidth=%d",m_iLbWidth));
		m_pLabel=new CaLabel(true,ALIGN_LEFT);
		switch(m_labelPos) {
		case ON_LEFT:
			m_pLabel->Create(iX-m_iLbWidth, iY, m_iLbWidth, iH);
			break;
		case ON_TOP:
			m_pLabel->Create(iX, iY-WORD_H, m_iLbWidth, iH);
			break;
		case ON_INSIDE:
			m_pLabel->Create(iX, iY+WORD_H, m_iLbWidth, iH);			
		default:
			DBG_ASSERT_EXIT(false,("m_labelPos =%d error! ",(int)m_labelPos));
		}
	}
	return 1;
}
void CYWXmlBase::MutexUnlock(void)
{
#if SKJ_PTHREAD_KPMUTEX_OPEN == 1
	DBG_ASSERT_EXIT((g_skjkpmutex != NULL), (" g_skjkpmutex == NULL!"));
	
	int ret = 0;	
	DBG_PRINT(("*******************SKJ Mutex Unlock****************"));
	ret = pthread_mutex_unlock(g_skjkpmutex);
	if (ret != 0)
	{
		DBG_PRINT(("===FPKJ MUTEX UNLOCK %d====", ret));
	}
#endif
}
void CYWXmlBase::MutexLock(void)
{
#if SKJ_PTHREAD_KPMUTEX_OPEN == 1
	DBG_ASSERT_EXIT((g_skjkpmutex != NULL), (" g_skjkpmutex == NULL!"));
	
	//while (pthread_mutex_trylock(g_skjkpmutex) == EBUSY)
	while (pthread_mutex_lock(g_skjkpmutex) != 0)
	{
		DBG_PRINT(("===FPKJ MUTEX LOCK ERROR"));
		//CommonSleep(800);
	}
	DBG_PRINT(("*******************SKJ Mutex Lock******************"));
#endif
}
Exemplo n.º 21
0
//把数据写从某块内存区读出?
int CaLabel::GetTitle(char *pData,int &iLen)
{
	DBG_ASSERT_EXIT((pData != 0 ),(" pData is null!"));
	if (m_iTitleLen == 0)//m_iTitleLen = 0时,memecpy出错
	{
		iLen = 0;
		return 0;
	}
	int len = ( iLen <= m_iTitleLen )?iLen:m_iTitleLen;
	
	memcpy(pData, m_caTitle,  len );
	iLen=len ;
	return len;
}
Exemplo n.º 22
0
int CaInput::ReciveStrChar(int iEvent,char *pData,int iLen)
{

	if(ReciveIntChar(iEvent,pData,iLen) == 1 )
	{
		return 1;
	}

//	DBG_PRN("info", ("iEvent = %u , %c", iEvent, iEvent));
	if(    (iEvent >= 'a' && iEvent <= 'z' ) 
		|| (iEvent >= 'A' && iEvent <= 'Z' )
		|| (iEvent == DOT_KEY )
		|| (iEvent == '@')
		|| (iEvent == '#')
		|| (iEvent == '$')
		|| (iEvent == '^')
		|| (iEvent == '&')
		|| (iEvent == '(')
		|| (iEvent == ')')
		|| (iEvent == '%')
		|| (iEvent == '*')
		|| (iEvent == '-')
		|| (iEvent == '<')
		|| (iEvent == '>')
		|| (iEvent == '\\')
		|| (iEvent == '/')
		|| (iEvent == '_')
		|| (iEvent == '\'')
		|| (iEvent == '"')
		|| (iEvent == '~')
		|| (iEvent == ' ')
		) 
	{
		char buf[4]={0,0,0,0};
		buf[0]=iEvent;
		Insert(buf,1,m_iCurScrPos,m_iCurConPos);
		return 1;
	}
	else if( iEvent == INPUT_EVENT )
	{
		DBG_ASSERT_EXIT(pData != NULL,("pData is NULL!"));
		Insert(pData,iLen,m_iCurScrPos,m_iCurConPos);
		return 1;
	}
	else
	{
		return 0;
	}
}
Exemplo n.º 23
0
int CaInput::SetContentBuf(unsigned char *pData, int iLen)
{
	DBG_ASSERT_EXIT((pData != NULL ),("pData is NULL"));
	//DBG_ASSERT_EXIT((iLen > 0),("iLen=%d  is error!",iLen));
	if (iLen == 0)
	{
		Clear();
		ReFresh();
		return 0;
	}
	Clear();
	m_iConLen=iLen >MAX_BUF_LEN ? MAX_BUF_LEN:iLen;
	m_iScrLen=iLen > (m_iScrMaxLen - 1) ? (m_iScrMaxLen - 1) : iLen;

	if (is_gb_ex(pData, iLen - m_iScrLen) == 2)
	{
		m_iScrLen--;
	}

	if (!m_bReadOnly)//��ֻ���Ĺ�������
	{
		m_iCurScrPos=m_iScrLen;
		m_iCurConPos=m_iConLen;
	}
	else
	{
		m_iCurScrPos = 0;
		m_iCurConPos = 0;
	}
	memcpy(m_contentBuf,pData,m_iConLen);
	if(m_InputType == aPASSWORD)
	{
		memset(m_dispBuf,PASSWORD_CHAR,m_iScrLen);
	}
	else
	{
		if (!m_bReadOnly)
		{
			memcpy(m_dispBuf,pData + m_iConLen - m_iScrLen,m_iScrLen);
		}
		else
		{
			memcpy(m_dispBuf,pData,m_iScrLen);
		}
	}
	ReFresh();
	return m_iConLen;
}
Exemplo n.º 24
0
void CDB::MutexLock(void)
{
#if PTHREAD_MUTEX_OPEN == 1
	DBG_ASSERT_EXIT((m_rwcs != NULL), (" m_rwcs == NULL!"));
	DBG_PRINT(("^^^^^^^^^^^countNum = %d^^^^^^^^", countNum));
	while (pthread_mutex_trylock(m_rwcs) == EBUSY)
	{
		DBG_PRINT(("EBUSY"));
		CommonSleep(1000);
	}

	countNum++;

	DBG_PRINT(("^^^^^^^^^^^countNum = %d^^^^^^^^", countNum));
#endif
}
//--------------------------------------------------------------------------------------------------------------------
//获取未导入发票卷信息,并修改屏幕显示
//--------------------------------------------------------------------------------------------------------------------
UINT8 CMonthSaleShowWIn::QueryShow(CDataTjxxhz *pTjxxhz, UINT32 nPageIndex)
{
	DBG_ASSERT_EXIT((pTjxxhz != NULL), (" pTjxxhz == NULL!"));
	
	UINT8 ret = SUCCESS;
	char value[256];
	INT32 errorcode=0;
	memset((void*)value, 0, sizeof(value));

	DBG_PRINT((" nPageIndex == %u", nPageIndex));
	//页码序号超限
	if( (nPageIndex<1) || (nPageIndex>m_pageNum) )
	{
		return FAILURE;
	}
	if (nPageIndex == 1)
	{
		UINT32 year=0, month=0, day=0;
		year = pTjxxhz->m_Qsrq/10000;
		month = (pTjxxhz->m_Qsrq%10000)/100;
		day = pTjxxhz->m_Qsrq%100;
		sprintf(title_array[1], "起始日期:%02u/%02u, ", month,day);

		year = pTjxxhz->m_Jzrq/10000;
		month = (pTjxxhz->m_Jzrq%10000)/100;
		day = pTjxxhz->m_Jzrq%100;
		sprintf(title_array[2], "截止日期:%02u/%02u", month,day);

		sprintf(title_array[3], "期初库存:%-5u, ", pTjxxhz->m_Qckcfs);
		sprintf(title_array[4], "本期新购:%-5u", pTjxxhz->m_Lgfpfs);
		sprintf(title_array[5], "期末库存:%-5u, ", pTjxxhz->m_Qmkcfs);
		sprintf(title_array[6], "本期退回:%-5u", pTjxxhz->m_Thfpfs);
	}
	else if (nPageIndex == 2)
	{
		sprintf(title_array[1], "正票份数:%-5u, ", pTjxxhz->m_Zsfpfs);
		sprintf(title_array[2], "正废份数:%-5u", pTjxxhz->m_Zffpfs);
		sprintf(title_array[3], "负票份数:%-5u, ", pTjxxhz->m_Fsfpfs);
		sprintf(title_array[4], "负废份数:%-5u", pTjxxhz->m_Fffpfs);
		sprintf(title_array[5], "空废份数:%-5u", pTjxxhz->m_Kffpfs);
		sprintf(title_array[6], "");
	}

	sprintf(title_array[0], "[页%u/%u]", nPageIndex, m_pageNum);

	return ret;
}
Exemplo n.º 26
0
UINT8 INV_GetInvVol(UINT32 &uNum,string &strErr)
{
	INT32 Ret=SUCCESS;
	CInvVol invvol[INVVOL_MAX_NUM];
	uNum =INVVOL_MAX_NUM;

	for (int i=0; i<uNum ;i++)
	{
		invvol[i].ResetVol();
	}

	Ret =g_pAPIBase->BSPFPCXPro_API(*g_YwXmlArg, uNum, invvol, strErr);
   
	if ( Ret !=SUCCESS)
	{
		DBG_PRINT(("发票信息获取失败"));
		return FAILURE;
	}
	DBG_PRINT(("发票信息获取成功"));


	//保存获取发票信息
	Ret= invvol[0].Delete();//清空CInvVol表
    DBG_PRINT(("Ret= %d",Ret));
	DBG_PRINT(("uNum= %u",uNum));

	DBG_ASSERT_EXIT(invvol != NULL, ("invvol must not be NULL!"));

    for (int i=0; i<uNum; i++)
	{	
		DBG_PRINT(("发票信息存储条数 = %d",i))
		Ret= invvol[i].AddNew();
		DBG_PRINT(("Ret= %d",Ret))
		if (Ret != SQLITE_OK)
		{
			strErr = "发票信息存储失败";
			DBG_PRINT(("发票信息存储失败"));
			return FAILURE;
		}	
	}
	DBG_PRINT(("发票信息存储成功"));
	
	return SUCCESS;
}
Exemplo n.º 27
0
int CaLabel::SetTitle(const char * pData, int iLen)
{
	DBG_ASSERT_EXIT((pData != 0 ),(" pData is null!"));

	memset( m_caTitle, 0, OBJ_TITLE_MAX_LEN );
	memset( m_caTitleImgBuf, 0, OBJ_TITLE_MAX_LEN*IMG_BYTES );

	int len = ( iLen <= OBJ_TITLE_MAX_LEN )?iLen:OBJ_TITLE_MAX_LEN;
	memcpy( m_caTitle, pData, len );
	m_iTitleLen = len;

	int bufLen=m_iW/CHAR_W;
	char buf[OBJ_TITLE_MAX_LEN+2];
	AlignBuf(pData,buf,bufLen,m_iAlignType);

	str2image((unsigned char *)buf,bufLen,m_caTitleImgBuf);

	return len;	
}
//-----------------------------------------------------------
//打印发票存根
//-----------------------------------------------------------
UINT8 PrnInvStub(CInvHead *smallInvInfo, UINT8 IfPrnChar)
{

    DBG_ASSERT_EXIT((smallInvInfo != NULL), (" smallInvInfo == NULL!"));

    //判断装入纸质发票
    if (isPaper() != 0)
    {
        DBG_RETURN(NO_PAPER);
    }

    //开辟打印数据结构体的内存
    TPrnInvoiceInfo *pInvPrnData;
    pInvPrnData = &g_invPrnData;;
    if(pInvPrnData==NULL)
    {
        DBG_PRINT((" malloc(sizeof(pInvPrnData) error !"));
        DBG_RETURN(MALLOC_MEM_ERROR);
    }
    memset((void *)pInvPrnData, 0, sizeof(TPrnInvoiceInfo));//打印结构体内容清零
    if (1==IfPrnChar)
    {
        pInvPrnData->PrintType = STUB_PRINT; //打印类型为存根打印
    }

    //定长版,填充
    FillPrnInvHead(pInvPrnData, smallInvInfo);
    FillPrnInvDetail(pInvPrnData, smallInvInfo);
    FillPrnInvTail(pInvPrnData, smallInvInfo);

    //定长版,打印
    print_invoice_head(pInvPrnData);
    print_invoice_data_cycle(pInvPrnData, 0);
    print_invoice_tail(pInvPrnData);

    pInvPrnData = NULL;

    DBG_RETURN(SUCCESS);

}
//--------------------------------------------------------------------------------------------------------------------
//获取未导入发票卷信息,并修改屏幕显示
//--------------------------------------------------------------------------------------------------------------------
UINT8 CGInvLabelWin::QueryShow(CInvVol *pInvVol, UINT32 nPageIndex)
{
	DBG_ASSERT_EXIT((m_pInvVol != NULL), (" m_pInvVol == NULL!"));
	
	char value[256];
	INT32 errorcode=0;
	memset((void*)value, 0, sizeof(value));

	DBG_PRINT((" nPageIndex == %u", nPageIndex));
	//页码序号超限
	if( (nPageIndex<1) || (nPageIndex>m_pageNum) )
	{
		return FAILURE;
	}

	//查出一个已分发未导入的记录
	pInvVol->m_filter = "where USED_FLAG = 1 and OVER_FLAG = 1 ";
	
	sprintf(value,"and NO > %u ",(nPageIndex - 1));
	pInvVol->m_filter.append(value);
	pInvVol->m_filter.append("limit 1 ");

	pInvVol->Requery();  //查询
	errorcode = pInvVol->LoadOneRecord();
	if (errorcode != SQLITE_OK)
	{
		INVM_ErrMsgBox(QUERY_ERROR);
		return FAILURE;
	}

    //查出对应发票代码
	sprintf(title_array[0], "[页%u/%u]", nPageIndex, m_pageNum);
	sprintf(title_array[1], "发票代码: %s", pInvVol->m_code.c_str());
	sprintf(title_array[2], "购买日期: %u", pInvVol->m_date);
	sprintf(title_array[3], "始号: %08u", pInvVol->m_isno);
	sprintf(title_array[4], "止号: %08u", pInvVol->m_ieno);

	return SUCCESS;
}
Exemplo n.º 30
0
int CaInput::ReFresh()
{
	if (false == Visible())
	{
		return 0;
	}
	if(!IsRefreshAble())
	{
		return 0;
	}
	LCDFillRect(m_iX+m_iLbOffSet,m_iY,m_iScrMaxLen*CHAR_W,GRID_LINE_H,0);   
	LCDFillRectLine(m_iX+m_iLbOffSet,m_iY+GRID_LINE_H,
				m_iScrMaxLen*CHAR_W,INPUT_BOTTOM_LINE_H,1);
	str2image(m_dispBuf,m_iScrLen,m_caImgBuf);

	LCDPutImage(m_iX+m_iLbOffSet,m_iY,
		m_iScrLen*CHAR_W,GRID_LINE_H,(char *)m_caImgBuf+2);

	if(m_pLabel != NULL )
	{
		switch(m_labelPos) {
		case ON_LEFT:
			m_pLabel->Create(m_iX, m_iY, m_iLbWidth, m_iH);
			break;
		case ON_TOP:
			m_pLabel->Create(m_iX, m_iY-WORD_H, m_iLbWidth, m_iH);
			break;
		default:
			DBG_ASSERT_EXIT(false,("m_labelPos =%d error! ",(int)m_labelPos));
		}
		m_pLabel->ReFresh();
	}

//	LCDRedraw();
	m_bRefreshFlag=true;
//	DBG_PRN("------------",("LCDRedraw"));

	return 1;
}