| 1272 | } |
| 1273 | |
| 1274 | static void GUI_Purchase_ShowInvoice(void) |
| 1275 | { |
| 1276 | Widget *w = g_widgetInvoiceTail; |
| 1277 | Screen oldScreenID; |
| 1278 | uint16 y = 48; |
| 1279 | uint16 total = 0; |
| 1280 | uint16 x; |
| 1281 | char textBuffer[12]; |
| 1282 | |
| 1283 | oldScreenID = GFX_Screen_SetActive(SCREEN_1); |
| 1284 | |
| 1285 | GUI_DrawFilledRectangle(128, 48, 311, 159, 20); |
| 1286 | |
| 1287 | GUI_DrawText_Wrapper(String_Get_ByIndex(STR_ITEM_NAME_QTY_TOTAL), 128, y, 12, 0, 0x11); |
| 1288 | |
| 1289 | y += 7; |
| 1290 | |
| 1291 | GUI_DrawLine(129, y, 310, y, 12); |
| 1292 | |
| 1293 | y += 2; |
| 1294 | |
| 1295 | if (g_factoryWindowOrdered != 0) { |
| 1296 | uint16 i; |
| 1297 | |
| 1298 | for (i = 0; i < g_factoryWindowTotal; i++) { |
| 1299 | ObjectInfo *oi; |
| 1300 | uint16 amount; |
| 1301 | |
| 1302 | if (g_factoryWindowItems[i].amount == 0) continue; |
| 1303 | |
| 1304 | amount = g_factoryWindowItems[i].amount * g_factoryWindowItems[i].credits; |
| 1305 | total += amount; |
| 1306 | |
| 1307 | snprintf(textBuffer, sizeof(textBuffer), "%02d %5d", g_factoryWindowItems[i].amount, amount); |
| 1308 | |
| 1309 | oi = g_factoryWindowItems[i].objectInfo; |
| 1310 | GUI_DrawText_Wrapper(String_Get_ByIndex(oi->stringID_full), 128, y, 8, 0, 0x11); |
| 1311 | |
| 1312 | GUI_DrawText_Monospace(textBuffer, 311 - (short)strlen(textBuffer) * 6, y, 15, 0, 6); |
| 1313 | |
| 1314 | y += 8; |
| 1315 | } |
| 1316 | } else { |
| 1317 | GUI_DrawText_Wrapper(String_Get_ByIndex(STR_NO_UNITS_ON_ORDER), 220, 99, 6, 0, 0x112); |
| 1318 | } |
| 1319 | |
| 1320 | GUI_DrawLine(129, 148, 310, 148, 12); |
| 1321 | GUI_DrawLine(129, 150, 310, 150, 12); |
| 1322 | |
| 1323 | snprintf(textBuffer, sizeof(textBuffer), "%d", total); |
| 1324 | |
| 1325 | x = 311 - (short)strlen(textBuffer) * 6; |
| 1326 | |
| 1327 | /* "Total Cost :" */ |
| 1328 | GUI_DrawText_Wrapper(GUI_String_Get_ByIndex(STR_TOTAL_COST_), x - 3, 152, 11, 0, 0x211); |
| 1329 | GUI_DrawText_Monospace(textBuffer, x, 152, 11, 0, 6); |
| 1330 | |
| 1331 | GUI_Mouse_Hide_Safe(); |
no test coverage detected