INT32 CJSKDeclareProc::DelUploadInv()
{
	CDataInvHead dataInvHead;
	CInvServ invServ;
	INT8 sqlbuf[128];
	string strErr("");
	INT32 retcode = 0;
	
	retcode = CJSKInfoFunc::GetFirstOffInvInfo(&dataInvHead, strErr);
	if(retcode == JSK_SUCCESS)
	{
		if(dataInvHead.m_fphm != 0)
		{
			memset(sqlbuf, 0, sizeof(sqlbuf));
			sprintf(sqlbuf, "where FPDM='%s' and FPHM=%u ", dataInvHead.m_fpdm.c_str(), dataInvHead.m_fphm);
			DBG_PRINT(("sqlbuf = %s", sqlbuf));
			invServ.m_filter.append(sqlbuf);
			invServ.Requery();
			if(invServ.LoadOneRecord() == SQLITE_OK)
			{
				memset(sqlbuf, 0, sizeof(sqlbuf));
				sprintf(sqlbuf, "where NO < %u ", invServ.m_no);
				DBG_PRINT(("sqlbuf = %s", sqlbuf));
				invServ.m_filter.append(sqlbuf);
				invServ.Delete();
			}
		}
		else
		{
			invServ.Delete();
		}
	}
	
	return JSK_SUCCESS;
}
Пример #2
0
INT32 CJSKMakeInvoice::FPGX_Proc(string scqrbw, string &strErr)
{
	INT32 retcode = JSK_SUCCESS;
	string mxjgmw("");

	if( ParseFpscjg(scqrbw, mxjgmw, strErr) != JSK_SUCCESS )
	{
		//return JSK_FAILURE;
		return JSK_SUCCESS;
	}

	UINT8 upInfo[JSK_LXXXMW_LEN+1];
	memset(upInfo, 0, sizeof(upInfo));
	sprintf((INT8 *)upInfo, "%s", mxjgmw.c_str());
	DBG_PRINT(("upInfo = %s", upInfo));

	int nLen = mxjgmw.length();
	DBG_PRINT(("nLen = %d", nLen));
	Base64_Decode_2((INT8 *)upInfo, &nLen);
	DBG_PRINT(("nLen = %d", nLen));

	retcode = CJSKInfoFunc::SetUpLoadFlag(upInfo, nLen, strErr);
	if(retcode != JSK_SUCCESS)
	{
		return retcode;
	}

	//删除INV_SERV中已上传的发票信息
	INT8 sqlbuf[128];
	CInvServ invServ;
	memset(sqlbuf, 0, sizeof(sqlbuf));
	sprintf(sqlbuf, "where UP_FLAG=1 ");
	DBG_PRINT(("sqlbuf = %s", sqlbuf));
	invServ.m_filter.append(sqlbuf);
	invServ.Requery();
	invServ.LoadOneRecord();

	invServ.m_filter.append(sqlbuf);
	retcode = invServ.Delete();
	if(retcode != SQLITE_OK)
	{
		retcode = JSK_COMMON_ERR_NO;
		strErr = "删除已上传发票信息错误";
		//return retcode;
	}
	else
	{
		g_globalArgLib->m_InvServNum--;
		if(invServ.m_issuetype == NORMAL_INV)
		g_globalArgLib->m_InvServSum -= invServ.m_moneySum;
	}

	return JSK_SUCCESS;
}
int CMaintenanceMenu::ProcEvent(int iEvent,unsigned char *pEventData, int iDataLen)
{
	if (LOCKED_KEY == iEvent || ESC_KEY == iEvent)
	{
		CaMsgBox msgBox("退出当前操作员?",CaMsgBox::MB_YESNO);
		msgBox.ShowBox();	
		if (msgBox.m_iStatus == OK_PRESSED)
		{	
			ChangeWin(LOGIN_WIN);
			return SUCCESS;
		}
	}

#if (0 == RELEASE_VER)
	CInvServ invServ;
	INT32 nErrCode;
	INT8 chValue[64];
	memset((void*)chValue, 0, sizeof(chValue));
	if(DISCOUNT_KEY == iEvent)
	{
		invServ.Requery();
		invServ.LoadOneRecord();

		sprintf(chValue, "where no = %u", invServ.m_no);
		invServ.m_filter = chValue;
		nErrCode = invServ.Delete();
		if (SQLITE_OK != nErrCode)
		{
			CaMsgBox::ShowMsg("删除第一条失败");
			return FAILURE;
		}
		CaMsgBox::ShowMsg("删除第一条成功");
		
		if(0 != g_globalArg->m_InvServNum)
		{
          g_globalArg->m_InvServNum--;
		}
		DBG_PRINT(("m_InvServNum = %u", g_globalArg->m_InvServNum ));
		return SUCCESS;
	}

#endif

	return CMultiBtnCommonWin::ProcEvent(iEvent,pEventData,iDataLen);
}
void CMaintenanceMenu::OnButton9(int iEvent, unsigned char * pEventData, int iDataLen)
{
	if (g_globalArg->m_initFlag == 0)
	{
		CaMsgBox::ShowMsg("机器未初始化");
		return ;
	}

	CInvServ invServ;
	CInvHead invHead;
	CInvDet  invDet;
	INT32 nErrCode;
	INT8 chValue[128];

	invServ.Requery();
	nErrCode = invServ.LoadOneRecord();
   DBG_PRINT(("nErrCode= %u",nErrCode));
	if( nErrCode != SQLITE_OK )
	{
		CaMsgBox::ShowMsg("无缓存记录");
		return;
	}

	memset(chValue, 0, sizeof(chValue));
	sprintf(chValue,"代码:'%s' 号码:%u 确认删除?", invServ.m_code.c_str(), invServ.m_InvNo);
	CaMsgBox msgBox(chValue,CaMsgBox::MB_YESNO);
	msgBox.ShowBox();	
	if (msgBox.m_iStatus == OK_PRESSED)
	{
		memset((void*)chValue, 0, sizeof(chValue));
		//sprintf(chValue, "where CODE = '%s' and INV_NO = %u", invServ.m_code.c_str(), invServ.m_InvNo);
		// 更改inv_serv中的两个字段
		sprintf(chValue, "where FPDM = '%s' and FPHM = %u", invServ.m_code.c_str(), invServ.m_InvNo);
		invHead.m_filter = chValue;
		nErrCode = invHead.Delete();
		if (SQLITE_OK != nErrCode)
		{
			CaMsgBox::ShowMsg("删除失败");
			return;
		}
		invDet.m_filter = chValue;
		nErrCode = invDet.Delete();
		if (SQLITE_OK != nErrCode)
		{
			CaMsgBox::ShowMsg("删除失败");
			return;
		}
		
		sprintf(chValue, "where CODE = '%s' and INV_NO = %u", invServ.m_code.c_str(), invServ.m_InvNo);
		invServ.m_filter = chValue;
		nErrCode = invServ.Delete();
		if (SQLITE_OK != nErrCode)
		{
	
			CaMsgBox::ShowMsg("删除失败");
			return;
		}
		CaMsgBox::ShowMsg("删除成功");

		if(0 != g_globalArg->m_InvServNum)
		{
			g_globalArg->m_InvServNum--;
		}
		DBG_PRINT(("m_InvServNum = %u", g_globalArg->m_InvServNum ));
	}
}