From 80fca75dc87026fc0ef2a634e1f08927339cde8a Mon Sep 17 00:00:00 2001
From: lu <99954486@qq.com>
Date: 星期一, 14 四月 2025 08:10:34 +0800
Subject: [PATCH] 打印计算
---
DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs | 79 ++++++++++++++++++++++++++++++++++++---
1 files changed, 72 insertions(+), 7 deletions(-)
diff --git a/DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs b/DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs
index af6b082..fa37f22 100644
--- a/DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs
+++ b/DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs
@@ -17,7 +17,6 @@
using DevExpress.Utils;
using DevExpress.XtraEditors;
using DevExpress.XtraEditors.Controls;
-using DevExpress.XtraEditors.Repository;
using DevExpress.XtraGrid;
using DevExpress.XtraGrid.Columns;
using DevExpress.XtraGrid.Menu;
@@ -1692,7 +1691,7 @@
/// <param name="fileName">瀛楁</param>
/// <param name="icoName">鍥炬爣璺緞</param>
/// <param name="action"></param>
- public static void SetGridViewParameter(GridView gridView1, PictureBox picCheckBox = null, Form fm = null, string fileName = "checkStatus", string icoName = "", DelegateGetModel action = null, DevExpress.Utils.ToolTipController tips = null,bool isSearch=true)
+ public static void SetGridViewParameter(GridView gridView1, PictureBox picCheckBox = null, Form fm = null, string fileName = "checkStatus", string icoName = "", DelegateGetModel action = null, DevExpress.Utils.ToolTipController tips = null, bool isPostSearch = true)
{
gridView1.PopupMenuShowing += (s, e) =>
{
@@ -1715,7 +1714,8 @@
};
gridView1.OptionsView.ColumnAutoWidth = false;//鑷姩璋冩暣鍒楀
- if (isSearch == true) {
+ if (isPostSearch == true)
+ {
gridView1.OptionsView.ShowGroupPanel = false;
gridView1.OptionsCustomization.AllowGroup = false;
gridView1.OptionsFilter.AllowAutoFilterConditionChange = DevExpress.Utils.DefaultBoolean.False;
@@ -1734,6 +1734,9 @@
// gridView1.Appearance.HeaderPanel.ForeColor = DevExpress.LookAndFeel.DXSkinColors.ForeColors.ControlText;
foreach (GridColumn column in gridView1.Columns)
{
+ column.MinWidth = 10;
+ column.MaxWidth = 0;
+
column.AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Near;
column.OptionsColumn.AllowEdit = true;
// column.OptionsFilter.AutoFilterCondition = AutoFilterCondition.Contains;
@@ -1742,15 +1745,16 @@
if (column.Tag == null || column.Tag.ToString().EndsWith("edit"))
column.OptionsColumn.ReadOnly = false;
else
- column.OptionsColumn.ReadOnly = true;
+ //column.OptionsColumn.ReadOnly = true;
+ column.OptionsColumn.ReadOnly = isPostSearch;
- if (isSearch == true)
+ if (isPostSearch == true)
{
if (column.Tag == null || column.Tag.ToString().Length <= 0)
column.OptionsFilter.AllowAutoFilter = false;
}
}
-
+
gridView1.IndicatorWidth = 50;
gridView1.CustomDrawRowIndicator += (s, e) =>
{
@@ -1882,7 +1886,7 @@
column.Width = 500;
}
}
-
+
/// <summary>
/// 璁剧疆閫夐」鍗�
/// </summary>
@@ -1971,6 +1975,8 @@
{
// column.DefaultCellStyle.Alignment = true;
column.AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Near;
+ column.MinWidth = 10;
+ column.MaxWidth = 0;
}
gridView1.OptionsView.ColumnAutoWidth = false;//鑷姩璋冩暣鍒楀
gridView1.OptionsFilter.AllowFilterEditor = false;
@@ -2020,7 +2026,66 @@
Regex regex = new Regex("^[0-9]+$");
return regex.IsMatch(str);
}
+ public static bool IsNumeric2(string str)
+ {
+ string input = str;
+ decimal number;
+ bool isNumeric = decimal.TryParse(input, out number);
+ return isNumeric;
+ }
+ public static void PrintJiSuan(DevExpress.XtraEditors.TextEdit box1, DevExpress.XtraEditors.TextEdit box2, string sum, DevExpress.XtraEditors.RadioGroup rd)
+ {
+ if (rd.SelectedIndex == 2)
+ return;
+ try
+ {
+ string t1 = box1.Text.Trim();
+ string t2 = box2.Text.Trim();
+ if (!Gs.DevApp.ToolBox.UtilityHelper.IsNumeric2(t1))
+ return;
+ decimal? dc = Gs.DevApp.ToolBox.UtilityHelper.GetDecimal(sum);
+ decimal? dc1 = Gs.DevApp.ToolBox.UtilityHelper.GetDecimal(t1);
+
+ int dividend = int.Parse(sum); // 琚櫎鏁�
+ int divisor = int.Parse(t1); // 闄ゆ暟
+
+ int quotient = dividend / divisor; // 鏁存暟閮ㄥ垎
+ int remainder = dividend % divisor; // 浣欐暟
+
+ box2.Text = quotient.ToString();
+
+ if (rd.SelectedIndex == 0)
+ rd.Properties.Items[0].Description = "鍏ㄨ嚜鍔ㄣ��" + remainder.ToString() + "銆�";
+ }
+ catch (Exception ex)
+ {
+
+ Gs.DevApp.ToolBox.MsgHelper.ShowError(ex.Message);
+ }
+
+ }
+ public static void PrintAuto(DevExpress.XtraEditors.TextEdit txt_psnQty_1, DevExpress.XtraEditors.TextEdit txt_iCount_1, DevExpress.XtraEditors.RadioGroup radOut) {
+ txt_psnQty_1.Text = "";
+ txt_iCount_1.Text = "";
+ radOut.Properties.Items[0].Description = "鍏ㄨ嚜鍔�";
+ if (radOut.SelectedIndex == 2)
+ txt_iCount_1.ReadOnly = false;
+ else
+ txt_iCount_1.ReadOnly = true;
+ }
+ public static decimal PrintYuLiang(DevExpress.XtraEditors.RadioGroup rd)
+ {
+ decimal dc = 0;
+ if (rd.SelectedIndex != 0)
+ return 0;
+ string txt = rd.Properties.Items[0].Description;// = "鍏ㄨ嚜鍔ㄣ��" + remainder.ToString() + "銆�";
+ txt = txt.Trim().Replace("鍏ㄨ嚜鍔ㄣ��", "");
+ txt = txt.Replace("銆�", "");
+ if (string.IsNullOrEmpty(txt))
+ return 0;
+ return decimal.Parse(txt);
+ }
}
/// <summary>
--
Gitblit v1.9.3