Ejemplo n.º 1
0
void gamedata::change_HCpieces(short p)
{
#ifdef DEBUG_GD_HCP
    al_trace("Changing HCP by %d to %d\n",p, get_generic(0));
#endif
    change_generic(p, 0);
    return;
}
Ejemplo n.º 2
0
bool gamedata::get_cont_percent()
{
    return get_generic(6) != 0;
}
Ejemplo n.º 3
0
byte gamedata::get_cont_hearts()
{
    return get_generic(5);
}
Ejemplo n.º 4
0
byte gamedata::get_hcp_per_hc()
{
    return get_generic(4);
}
Ejemplo n.º 5
0
byte gamedata::get_canslash()
{
    return get_generic(2);
}
Ejemplo n.º 6
0
byte gamedata::get_magicdrainrate()
{
    return get_generic(1);
}
Ejemplo n.º 7
0
byte gamedata::get_HCpieces()
{
    return get_generic(0);
}
Ejemplo n.º 8
0
word gamedata::get_wlevel()
{
    return get_generic(3);
}
Ejemplo n.º 9
0
void FormatProductSummary()
{
  FORMAT_PRODUCTS_REC *prodptr;
  int i=0;
  char *money;

  trace("FormatProductSummary","writing to page structure");

  /* reset formatted flag on OCC array */
  mark_unformatted(new_charge_array);

  /* for each product, do RC, NRC, USAGE, DISCOUNT, and TAXES tables */
  for( i=0; i<=UsesRA(format_products_rec_array); i++)
  {
    prodptr = (FORMAT_PRODUCTS_REC *) RAIndex(format_products_rec_array, i);
    
    g_curr_prod = prodptr->product_line_id;
    ARB_NUM_SET_ZERO (&g_table_grand_total);
    /* supress automatic page handling on first page */
    g_curr_page = 0;
    if (/* bpr_table(new_charge_array, TABLE_COUNT) || all RCs are in rc_table */
	rc_table(new_charge_array, TABLE_COUNT) ||
	nrc_table(new_charge_array, TABLE_COUNT) ||
	usage_table(new_charge_array, TABLE_COUNT)) {
      do_new_page();
      LINE_FEED(2);
      write_product_header(g_curr_page, g_curr_prod); 
      /* enable automatic page handling */
      g_curr_page = PAGE_ACTIVITY_SUMMARY;
      /* write_table(BPR_TABLE, new_charge_array, bpr_table); all RCs are in rc_table */
      write_table(RC_TABLE, new_charge_array, rc_table);
      write_table(NRC_TABLE, new_charge_array, nrc_table);
      write_table(USAGE_TABLE, new_charge_array, usage_table);

      /* write the line if we've printed a table so far and we're 
       * going to be printing another table on the page
       */
      if ((!arb_num_is_zero (&g_table_grand_total)) && 
	  (discount_table(new_charge_array, TABLE_COUNT))) {
        safe_line_feed(3);
	put_bill_rectangle(COL_TABLE_RECT, 
				  TINY_AMOUNT_YOU_PAY_RECT, MONEY_ADJUST);
        put_bill_markup(get_markup(MARKUP_SUBTOTAL_NEW_CHARGES));
	LINE_FEED(-1);
	ALIGN(ALEFT);
        putf_bill(COL_TABLE_TOTAL,get_field(SUBTOTAL_NEW_CHARGES),
	    get_product_line_desc(prodptr->product_line_id));
	money=format_money(&g_table_grand_total,DOLLAR_SIGN,NULL,MINUS_POS, bill_inv.currency);
	flush_right(money);

	SET_CURRENCY(bill_inv.currency);

	set_generic_text(BOLD_FIXED, money);
	MONEY_put_bill(COL_TABLE_AMOUNT, get_generic(BOLD_FIXED), VOL);
	ALIGN(ALEFT);
        safe_line_feed(2);
      }
      
      write_table(DISCOUNT_TABLE, new_charge_array, discount_table);

      /* page footer */
      safe_line_feed(3);
      put_bill_rectangle(COL_TABLE_RECT, 
				TINY_AMOUNT_YOU_PAY_RECT, MONEY_ADJUST);
      put_bill_markup(get_markup(MARKUP_NET_NEW_CHARGES));
      LINE_FEED(-1);
      ALIGN(ALEFT);
      putf_bill(COL_TABLE_TOTAL, get_field(NET_NEW_CHARGES), 
	       get_product_line_desc(prodptr->product_line_id));
      money=format_money(&g_table_grand_total,DOLLAR_SIGN,NULL,MINUS_POS, bill_inv.currency);
      flush_right(money);

      SET_CURRENCY(bill_inv.currency);

      set_generic_text(BOLD_FIXED, money);
      ALIGN(AMONEY);
      put_bill(COL_TABLE_AMOUNT, get_generic(BOLD_FIXED), VOL);
      ALIGN(ALEFT);
    }
  }
  g_curr_page = 0;
}
Ejemplo n.º 10
0
/* write the adjustments table if type == TABLE_PRINT
 * otherwise return TRUE if there's anything to print.
 */
static int adjustments_table(RA charges, int type)
{

  int count, index, index1;
  Arb_numeric amount;
  PREV_CHARGE *prev_chg, *prev_chg1;
  char datebuff[256];
  char *description;
  char *money, *money1;
  int lines_left;
  unsigned char display_type;

  g_curr_table = ADJUSTMENTS_TABLE;	/* set the g_curr_table for is_valid_prev_charge */

  count = UsesRA(charges);
  for(index = 0; index <= count; index++) {
    prev_chg = (PREV_CHARGE *) RAIndex(charges, index);

    /* check prev_chg to determine if it needs to be formatted */
    display_type = is_valid_prev_charge(prev_chg, g_curr_table, g_curr_prod);
    if (!display_type)
	continue;

    /* if it matches and type is TABLE_COUNT, return, otherwise print it */
    if (TABLE_COUNT == type)
      return TRUE;

    if ((lines_left = num_rows_left()) <= 4)
	safe_line_feed(lines_left);
    lookup_descr(&description, prev_chg->description_code);
    put_bill_markup(get_markup(MARKUP_ADJ_DETAIL));
    ALIGN(ALEFT);
    putf_bill(COL_ADJ_LEFT, get_field(ADJ_TABLE_FIELD), description);
    putf_bill(COL_ADJ_SRV, get_field(ADJ_SRV_FIELD), prev_chg->subscr_no_ext);
    format_formatted_date (&prev_chg->trans_date, language->date_fmt, datebuff, 20);
    putf_bill(COL_ADJ_DATE, get_field(ADJ_DATE_FIELD), datebuff);
    /* format the zero amount as specified or as $0.00 */
    ALIGN(ARIGHT);
    if (display_type == DISPLAY_TYPE_SPECIAL)
	MONEY_put_bill(COL_ADJ_AMT_AMONEY, get_field(ZERO_AMOUNT_FORMAT_LABEL), NONVOL);
    else
    {
    	money = format_money(&prev_chg->amount, DOLLAR_SIGN, NULL, MINUS_POS, bill_inv.currency);
    	flush_right(money);

	SET_CURRENCY(prev_chg->rate_currency_code);

    	set_generic_text(FIXED, money);
    	MONEY_put_bill(COL_ADJ_AMT_AMONEY, get_generic(FIXED), VOL);
    }
    money1 = format_money(&prev_chg->tax, DOLLAR_SIGN, NULL, MINUS_POS, bill_inv.currency);
    flush_right(money1);

    SET_CURRENCY(prev_chg->rate_currency_code);

    set_generic_text(FIXED, money1);
    MONEY_put_bill(COL_ADJ_VAT_AMONEY, get_generic(FIXED), VOL);
    ALIGN(ALEFT);
    safe_line_feed(1);

    prev_chg->is_formatted = TRUE;
    arb_num_arith (&amount, &prev_chg->amount, ARB_NUM_ADD, &prev_chg->tax);
    arb_num_arith (&g_table_total, &g_table_total, ARB_NUM_ADD, &amount);
  }
  return FALSE;
}
Ejemplo n.º 11
0
static void finish_table (void)
{   
  Arb_numeric amount;
  char *money;
  int rows_required;
  WRAPVECT wrapv;
  char *text;

  /* for long tables, we put the total amount even with the last row of the 
   * table.  (Note this requires putting the shaded box on the row *after* the
   * last row, which is where the cursor starts.)
   * For shorter tables, we make sure that the text above the total does not go
   * above the first line of the table, or g_top_of_table.
   * The rows required are 2 + the number of rows of text.
   * (1 row of text except for RC, NRC, and USAGE tables.)
   *
   * In addition, the page delimiter is written two rows about ROW_BOTTOM, 
   * so rows_required has 2 added to it.
   */

  if (NUM_ROWS_LEFT <= 3)
      safe_line_feed(NUM_ROWS_LEFT);

  safe_line_feed(1);
  /* write the label */
  ALIGN(ALEFT);
  switch (g_curr_table)
    {
      case PAYMENTS_TABLE:
        put_bill_markup(get_markup(MARKUP_TOTAL_PAY_FOOTER));
	put_bill(COL_TABLE_TOTAL, get_field(TOTAL_PAY_FOOTER), NONVOL);
	break;
	
      case ADJUSTMENTS_TABLE:
        put_bill_markup(get_markup(MARKUP_TOTAL_ADJ_FOOTER));
	put_bill(COL_TABLE_TOTAL, get_field(TOTAL_ADJ_FOOTER), NONVOL);
	break;
       
      case OCC_TABLE:
        put_bill_markup(get_markup(MARKUP_TOTAL_OTHER_FOOTER));
	put_bill(COL_TABLE_TOTAL, get_field(TOTAL_OTHER_FOOTER), NONVOL);
	break;
       
      case COMPONENT_TABLE:
        put_bill_markup(get_markup(MARKUP_COMPONENT_CHGS_FOOTER));
	putf_bill(COL_TABLE_TOTAL,get_field(COMPONENT_CHGS_FOOTER),g_curr_owning);
	break;

      case RC_TABLE:
        put_bill_markup(get_markup(MARKUP_RC_CHGS_FOOTER));
	put_bill(COL_TABLE_TOTAL, get_field(RC_CHGS_FOOTER), NONVOL);
	break;
	
      case NRC_TABLE:
        put_bill_markup(get_markup(MARKUP_NRC_CHGS_FOOTER));
	put_bill(COL_TABLE_TOTAL, get_field(NRC_CHGS_FOOTER),NONVOL);
	break;

      case USAGE_TABLE:
        put_bill_markup(get_markup(MARKUP_USAGE_CHGS_FOOTER));
	put_bill(COL_TABLE_TOTAL, get_field(USAGE_CHGS_FOOTER), NONVOL);
	break;

      case DISCOUNT_TABLE:
        put_bill_markup(get_markup(MARKUP_DISCOUNT_FOOTER));
	put_bill(COL_TABLE_TOTAL, get_field(DISC_FOOTER), NONVOL);
	break;

      case BPR_TABLE:
        put_bill_markup(get_markup(MARKUP_BPR_CHGS_FOOTER));
	put_bill(COL_TABLE_TOTAL, get_field(BPR_CHGS_FOOTER), NONVOL);
	break;
      }

     LINE_FEED(1);
     put_bill_rectangle(COL_TABLE_RECT,TINY_AMOUNT_YOU_PAY_RECT, MONEY_ADJUST);

  /* undo last line feed from table */
  LINE_FEED(-1);

  /* write the amount */
  amount = g_table_total;
  money=format_money(&amount,DOLLAR_SIGN,NULL,MINUS_POS, bill_inv.currency);
  flush_right(money);

  SET_CURRENCY(bill_inv.currency);

  set_generic_text(BOLD_FIXED, money);
  MONEY_put_bill_FEED(COL_TABLE_AMOUNT, get_generic(BOLD_FIXED), VOL);
  g_in_a_table = FALSE;
  put_bill_markup(get_markup(MARKUP_TABLE_END));
  ALIGN(ALEFT);
} /* finish_table */