Пример #1
0
/**
*借贷记快捷键
*/
int TxnCrDr(void)
{
	int nSelect;
	int nRet;
	int nTrueInput;
	char szAmount[12+1] = {0};
	
	ASSERT_QUIT(ProSelectList("1.消 费||2.圈 存", "借贷记", 0xFF, &nSelect));
	switch(nSelect)
	{
	case 1:
		if(YES != GetVarIsIcFlag())
		{
			PubClearAll();
			PubMsgDlg(NULL,  "暂不支持IC卡交易", 3, 5);
			return APP_FAIL;
		}
		
		ASSERT_QUIT(TradeInit("消费", TDI_DEFAULT, TRANS_SALE, 0, YES));
		/**
		* 输入金额
		*/
		
		while(1)
		{
			int nAmtLen = 12;			
			memset(szAmount, 0, sizeof(szAmount));
			ASSERT_QUIT(PubInputAmount("消费", "请输入金额:", szAmount, &nAmtLen, INPUT_MODE_AMOUNT, INPUT_AMOUNT_TIMEOUT));
			/**
			* 检查金额的有效性
			*/
			if ( CheckTransAmount(szAmount, TRANS_SALE) == APP_SUCC )
			{
				break;
			}
		}
		nTrueInput = INPUT_PLEASE_INSERTIC; //只支持IC插卡
		nRet = EmvSale(&nTrueInput,szAmount, TRANS_SALE_CRDR);
		if (nRet == APP_FALLBACK)
		{	
			nTrueInput = INPUT_NO;
			nRet = MagSale(&nTrueInput, szAmount, (char)ATTR_FALLBACK);
		}
		DISP_OUT_ICC;
		break;
	case 2:
		MenuLoad();
		break;
	default:
		break;
	}
	return APP_SUCC;
}
Пример #2
0
static void
MenuShow(Menu * m, char noshow)
{
   EWin               *ewin;
   int                 x, y, w, h;
   int                 wx, wy, mw, mh;
   int                 head_num = 0;

   if (m->shown)
      return;

   if (MenuLoad(m) || m->redraw)
      MenuRealize(m);

   if (m->num <= 0)
      return;

   if (!m->win || !m->items[0]->win)
      MenuRealize(m);

   if (!m->style)
      return;

   ewin = m->ewin;
   if (ewin)
     {
#if 0				/* ??? */
	EwinRaise(ewin);
	EwinShow(ewin);
	return;
#else
	MenuHide(m);
#endif
     }

   EGetGeometry(m->items[0]->win, NULL, &x, &y, &w, &h, NULL, NULL);
   mw = m->w;
   mh = m->h;

   EQueryPointer(NULL, &wx, &wy, NULL, NULL);
   wx -= EoGetX(DesksGetCurrent()) + x + (w / 2);
   wy -= EoGetY(DesksGetCurrent()) + y + (h / 2);
   if (Conf.menus.onscreen)
     {
	Border             *b;

	b = BorderFind(m->style->border_name);
	if (b)
	  {
	     int                 sx, sy, sw, sh;

	     head_num = ScreenGetGeometryByPointer(&sx, &sy, &sw, &sh);

	     if (wx > sx + sw - mw - b->border.right)
		wx = sx + sw - mw - b->border.right;
	     if (wx < sx + b->border.left)
		wx = sx + b->border.left;

	     if (wy > sy + sh - mh - b->border.bottom)
		wy = sy + sh - mh - b->border.bottom;
	     if (wy < sy + b->border.top)
		wy = sy + b->border.top;
	  }
     }

   EMoveWindow(m->win, wx, wy);

   ewin = AddInternalToFamily(m->win, m->style->border_name, EWIN_TYPE_MENU,
			      &_MenuEwinOps, m);
   if (ewin)
     {
	ewin->client.event_mask |= KeyPressMask;
	ESelectInput(m->win, ewin->client.event_mask);

	ewin->head = head_num;

	EwinResize(ewin, ewin->client.w, ewin->client.h, 0);

	if (Conf.menus.animate)
	   EwinInstantShade(ewin, 0);

	if (!noshow)
	  {
	     ICCCM_Cmap(NULL);
	     EwinOpFloatAt(ewin, OPSRC_NA, EoGetX(ewin), EoGetY(ewin));
	     EwinShow(ewin);
	     if (Conf.menus.animate)
		EwinUnShade(ewin);
	  }
     }

   m->shown = 1;
   m->last_access = time(0);
   Mode_menus.just_shown = 1;

   if (!Mode_menus.first)
     {
	Mode_menus.context_ewin = GetContextEwin();
#if 0
	Eprintf("Mode_menus.context_ewin set %s\n",
		EwinGetTitle(Mode_menus.context_ewin));
#endif
	ESync(ESYNC_MENUS);
	Mode_menus.first = m;
	MenuShowMasker(m);
	TooltipsEnable(0);
	GrabKeyboardSet(m->win);
     }
   m->ref_count++;
}